[CentOS] network redundancy via two nics, two routers?

Feizhou feizhou at graffiti.net
Tue Mar 27 09:34:40 UTC 2007

Jeff Potter wrote:
> Hi List,
> I'm trying to configure two switches to provide redundancy (i.e. in case 
> one switch goes down), and am wondering if there is a standard way to 
> configure a CentOS box to use different gateways in a bonded interface, 
> depending upon which physical nic is being used?
> A bit more detail might help answer the "And why do you want to do 
> that?" questions...
> - Switch 1, Port 1: has an uplink to upstream provider, and is in VLAN-1
> - Switch 2, Port 1: has a 2nd uplink to upstream provider, and is in VLAN-1
> - Switch 1, Port 25+26 are trunked (link aggregation; depends on your 
> terminology; these are procurve 2600's) and connected to Switch 2, Port 
> 25+26. All vlans configured run on the trunked link, with tagging.
> - Uplinks to provider are running HSRP. Upstream provider creates a 
> virtual IP (say, that is the gateway to the outside world on 
> one of the links, randomly.
> - Server A is connected to Switch 1, Port 2 on eth0; and Switch 2, Port 
> 2 on eth1. Server is assigned an IP address, say,, inside VLAN-2 
> (
> - Server B, C, etc. exist in different VLANs. (Just saying this so as to 
> avoid the suggestion of "don't use vlans" because that would make this 
> mess go away, but create a security problem.)
> - Switch 1 does light routing. For VLAN-2, it is listening on, say, 
> - Switch 2 also does light routing. For VLAN-2, it is listening on, say, 
> So, Server A's eth0 should use as its gateway; and Server A's 
> eth1 should use as its gateway. The HSRP link will create 
> and an associated MAC address on one of its links; the two 
> switches will throw the packets to the HSRP link on the correct switch. 
> It doesn't matter which router ( of is used, since 
> they will both route packets to the appropriate VLAN.
> If one of the switches goes down, the surviving HSRP link will claim the 
> virtual IP ( and the switch will receive an arp to let it know 
> to update its arp table. (I've also set mac and arp timeouts to 1 minute.)
> So, the question remains... is there a way to tell linux that, given a 
> bonded interface, the gateway for one physical nic is X while for a 
> second physical nic it is Y? (Bonding can be active/standby.)
> (If I had tons of $'s; I would just go buy some Cisco gear that's 
> capable of creating a virtual chassis and be done with this. I don't 
> have tons of $'s. If there are other ways of configuring this; I'd love 
> to know; but from everything I can gather, passing the various VLAN 
> traffic between the two switches (via tagged-VLANs on the interswitch 
> connection) seems the only viable solution. Or should I really be 
> looking at XRRP? Or Stacking? But that's a different list...)
> How do people normally do this? (This seems too complicated to be right.)

Should it not be that there would be a third ip that would be set as the 
gateway and the two routers will claim the ip as needed? So it would be 
the same ip used as the gateway whether the packets go out through eth0 
or eth1. As for bonded interface...should not that be on the same 
switch? You have a bonded interface on a VLAN that uses ports on two 
separate switches?

More information about the CentOS mailing list