[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Routing table question



> "David H. Silber" <dhs@orbits.com> writes:
> 
> 
> I still don't understand something. Doesn't the line:
> 
> 192.168.1.0     0.0.0.0         255.255.255.0   U         0 0          0 eth0
> 
> mean "send everything addressed to IP's 192.168.1.* through default
> gateway"? But this way the kernel will be sending communications for
> 192.168.1.1 through 209.226.71.1. So I must be wrong in translating
> the line above...

It more means "send everything addressed to a host on the 
192.168.1.0/24 network to -no- gateway."

The gateway column specifies which machine to gateway through, so 
should be host addresses, not network addresses.  "0.0.0.0" does not 
mean "default", but rather "none".

Perhaps a bigger example will make it clearer...

(Abbreviated) routing table:

Destination      Gateway          Iface
192.168.1.0/24   0.0.0.0          eth0
192.168.2.0/24   192.168.1.254    (eth0)
192.168.3.0/24   192.168.1.253    (eth0)
209.226.71.0/24  0.0.0.0          eth1
0.0.0.0/0        209.226.71.1     (eth1)

This is your setup, but I've added two more local nets that have 
gateways on the 192.168.1.0 network.

The interfaces in parenthesis are computed by the routing algorithm, 
not set by route or ifconfig.

If you send a packet to 192.168.1.34, the routing algorithm would see 
that you have a direct connection (no gateway) to 192.168.1.0/24, which 
is the network for your destination, so it would know to send through 
the eth0 interface directly to 192.168.1.34.

If you send a packet to 192.168.2.34, the routing algorithm would see 
that 192.168.1.254 is the gateway, and it's precomputed that the 
gateway is on eth0, so it would send your packet for ...2.34 to 
...1.254 on eth0.  Similarly, a packet to ...3.34 would be sent to 
...1.2553 on eth0.  Presumably, the two gateways would forward it along.

If you sent a packet to 208.4.23.5, the routing algorithm would see 
that there is no defined route to that machine, so it uses the default 
route, and sends it to 209.226.71.1 for forwarding.

Clearer?

> 
> -- 
> Arcady Genkin
> "... without money one gets nothing in this world, not even a certificate
> of eternal blessedness in the other world..." (S. Kierkegaard)
> 
> 
> -- 
> Unsubscribe?  mail -s unsubscribe debian-user-request@lists.debian.org < /dev/null
> 
> 

-- 
     Buddha Buck                      bmbuck@zaphid.dhis.edu
"Just as the strength of the Internet is chaos, so the strength of our
liberty depends upon the chaos and cacaphony of the unfettered speech
the First Amendment protects."  -- A.L.A. v. U.S. Dept. of Justice



Reply to: