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

Jeff Potter

jpotter-centos at codepuppy.com
Tue Mar 27 01:46:00 UTC 2007


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, 2.2.2.1) 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, 1.1.1.2,  
inside VLAN-2 (1.1.1.0/24)
- 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,  
1.1.1.254.
- Switch 2 also does light routing. For VLAN-2, it is listening on,  
say, 1.1.1.253.

So, Server A's eth0 should use 1.1.1.254 as its gateway; and Server  
A's eth1 should use 1.1.1.253 as its gateway. The HSRP link will  
create 2.2.2.1 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 (1.1.1.254 of 1.1.1.253) 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 (2.2.2.1) 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.)

best,
Jeff



More information about the CentOS mailing list