[CentOS] Multiple Internet facing Nics - Gateway issue

Wed Jul 1 20:07:20 UTC 2009
Alexander Dalloz <ad+lists at uni-x.org>

Doug Coats schrieb:
> I have a server with 4 nics.  Two are using different internet connections,
> both with static IP's, and two are connected to our private network.
> The two internet facing nics seem to be battling over the gateway
> designation.  Which ever I designate as the gateway the other stops
> responding to incoming traffic.  I need both to listen to inbound traffic.
> One for our main web page and the other for another web server.  I found
> some information of Iproute2 but that did not seem to solve my issues.
> Here are the config files:
> ifcfg-eth2
> DEVICE=eth2
> BOOTPROTO=static
> HWADDR=00:24:E8:52:92:8E
> ONBOOT=yes
> IPADDR=xx.yy.51.45
> GATEWAY=xx.yy.51.46
> ifcfg-eth3
> DEVICE=eth3
> BOOTPROTO=static
> HWADDR=00:24:E8:52:92:90
> ONBOOT=yes
> IPADDR=aa.bb.166.2
> GATEWAY=aa.bb.166.1
> network
> HOSTNAME=heritage01
> GATEWAY=xx.yy.51.46
> rt_tables
> #
> # reserved values
> #
> 255     local
> 254     main
> 253     default
> 0       unspec
> #
> # local
> #
> #1      inr.ruhep
> 200 Cable
> 201 T1
> iproute2 routes
> ip route add xx.yy.51.44/30 dev eth2 src xx.yy.51.46 table Cable
> ip route add default via xx.yy.51.46
> ip route add xx.yy.51.44/30 dev eth2 src xx.yy.51.46
> ip route add default via xx.yy.51.46
> ip rule add from xx.yy.51.46 table Cable
> ip route add aa.bb.166.0/27 dev eth3 src aa.bb.165.2 table T1
> ip route add default via aa.bb.166.1
> ip route add aa.bb.166.0/27 dev eth3 src aa.bb.166.2
> ip rule add from aa.bb.166.2 table T1
> ip route flush cache
> Other people seem to be using this configuration successfully but I seem to
> be missing something important.
> Any help is greatly appreciated!!!!!!!  Thanks!

The GATEWAY parameter within the ifcfg-<ethX> configuration files tries
to set the default gateway. There can be just 1 default gateway for a
system. So, the interface which comes up first will set the route and
the other has no effect.

Remove the GATEWAY entry from all ifcfg-<ethX> files and place the
GATEWAY parameter into /etc/sysconfig/network only.

Running different networks you must can set additional routings by
route-<ethX> configuration files inside /etc/sysconfig/network-scripts/.

Given your default gateway is set as xx.yy.51.46 for the network
configured on eth2, you set to use a gateway aa.bb.166.1 for other
destinations by

ip route add targetnet/CIDR via aa.bb.166.1 dev eth3

Please see


You multiple uplink topic is documented in this howto