Default Route question when there are two nic cards

David G. Miller dave at davenjudy.org
Thu Oct 12 14:28:31 UTC 2006


John Austin <ja at jaa.org.uk> wrote:

>>I point people in this direction because their next question is usually, 
>>> "How do I get the "other system" onto the internet?"  Also, only one 
>>> default gateway ends up defined in the routing table.  The system does 
>>> the right thing and uses the the default gateway specified for eth0 even 
>>> though the gateway specified by eth1 comes "later:"
>>> 
>>> Kernel IP routing table
>>> Destination     Gateway         Genmask         Flags   MSS Window  irtt 
>>> Iface
>>> 72.19.169.0     0.0.0.0         255.255.255.0   U         0 0          0 
>>> eth0
>>> 169.254.0.0     0.0.0.0         255.255.0.0     U         0 0          0 
>>> eth1
>>> 192.168.0.0     0.0.0.0         255.255.0.0     U         0 0          0 
>>> eth1
>>> 0.0.0.0         72.19.169.1     0.0.0.0         UG        0 0          0 
>>> eth0
>
>There is no gateway shown associated with eth1 !?
>
>So no notice has been taken of the GATEWAY=72.19.169.230
>in /etc/sysconfig/network-scripts/ifcfg-eth1
>
>I cannot see that this entry achieves anything
>
>John
>
There is a difference between a "gateway" and a route.  192.168.0.0/16 
through eth1 does not need a gateway since all addresses on that subnet 
are directly accessible.  Likewise, the 72.19.169.0/24 subnet is 
directly accessible through eth0.  The default route shows up as a 
gateway since addresses other than some subnet of 72.19.169.0/24 are 
indirectly accessible (traffic has to go through other routers).  I ran 
across the following which puts all this a little more succinctly:

> Gateways are a type of router. /Routers/ connect two or more networks 
> and provide the routing function. Some routers, for example, route at 
> the network interface level or at the physical level. /Gateways/, 
> however, route at the network level.

My approach may not work if I had multiple gateways or a more complex 
network.  I don't and it works quite well.  I think I originally came up 
with this approach after reading the O'Reilley book "Linux Network 
Administration" probably when I was running RHL-5 or RHL-6.X.

Cheers,
Dave

-- 
Politics, n. Strife of interests masquerading as a contest of principles.
-- Ambrose Bierce




More information about the users mailing list