Default Route question when there are two nic cards

Jeff Vian jvian10 at charter.net
Thu Oct 12 01:55:09 UTC 2006


On Wed, 2006-10-11 at 18:46 -0600, David G. Miller wrote:
> "Styma, Robert E (Robert)" <stymar at lucent.com> wrote:
> 
> >>> Mine is set in /etc/sysconfig/network
> >>> 
> >>> GATEWAY=148.197.29.254
> >>> 
> >>> but sometimes appears in all of the 
> >>> 
> >>> /etc/sysconfig/network-scripts/ifcfg-ethx's
> >>> 
> >>> Don't think there is any harm in having it in all of them - 
> >>> provided it
> >>> says the same thing!
> >>> 
> >>    
> >>
> >That did the trick.  That an removing the erroneous one from ifcfg-eth1.
> >Turns out the last one processed won.
> >
> The default route is tried last.  I end up with the following routing 
> table using the ifcfg-ethX files below:
> 
> [root at fraud ~]# netstat -n -r
> 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
> [root at fraud ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0
> # 3Com Corporation 3c905C-TX/TX-M [Tornado]
> DEVICE=eth0
> ONBOOT=yes
> BOOTPROTO=static
> IPADDR=72.19.169.230 <-- My external IP address
> NETMASK=255.255.255.0
> GATEWAY=72.19.169.1 <-- My ISP's gateway
> [root at fraud ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth1
> DEVICE=eth1
> ONBOOT=yes
> BOOTPROTO=none
> IPADDR=192.168.255.254
> NETMASK=255.255.0.0
> GATEWAY=72.19.169.230 <-- Set GW for internal NIC to external IP address
This line can cause problems.  There should only be one default gateway
entry.  If you have multiple entries, and you then relocate the system
so it has a different gateway, then you have to locate and change
*every* applicable entry.  With only one entry in a standard location, a
single update handles the change.

If your system is acting as a gateway router for other systems on your
local network there are different issues involving static routes.  For a
workstation on 2 different networks, only one default gateway can be
used.


> TYPE=Ethernet
> USERCTL=no
> IPV6INIT=no
> PEERDNS=yes
> MTU=9000
> 
> Internal traffic from the server goes out eth1 since that route gets 
> tried before the default route.
> 
> Cheers,
> Dave
> 
> -- 
> Politics, n. Strife of interests masquerading as a contest of principles.
> -- Ambrose Bierce
> 




More information about the fedora-list mailing list