[lug] Two NICs, one IP

Scott Herod herod at dimensional.com
Thu Aug 12 10:34:37 MDT 2004


On Wed, 11 Aug 2004, Jeff Schroeder wrote:

> Hey all--
> 
> I manage a Linux server for a client, and he has asked me to set things 
> up so the server will be able to withstand the failure of a physical 
> cable on the LAN.  The server has two NICs (eth0 and eth1, in 
> Linuxspeak) and he wants both to have the same IP address.
> 
> I don't believe this is possible, since the box won't know where to 
> route outgoing packets (eth0? eth1? both?), and I've seen instances 
> where a network interface won't even come up if the system thinks 
> there's another machine with that IP on the network.
> 
> However, before I tell him it isn't possible, I wanted to confirm it 
> with the group here.  I don't have any hard-and-fast documentation to 
> support my claim, but it just doesn't seem right to me.  Can anyone 
> tell me for sure that it's not possible?  Or, if it is, how to do it 
> properly?
> 
> TIA,
> Jeff

The system that I am working on is set up this way.  (We have two
interfaces connecting two machines that use the linux-ha package to add
reliability.)  Basically it uses the brctl (bridge-utils RPM) command to
create a bridge and add physical interfaces to it.  In order to avoid
network loops you may have to turn on brctl's spanning tree protocol.  
The commands are roughly:

PMI_BRIDGE=pmi_if

INTERFACE_1=eth1
INTERFACE_2=eth2

ifconfig ${INTERFACE_1} 0.0.0.0
ifconfig ${INTERFACE_2} 0.0.0.0
# Create the bridge interface.
brctl addbr ${PMI_BRIDGE}
# Add interfaces to the bridge.
brctl addif ${PMI_BRIDGE} ${INTERFACE_1}
brctl addif ${PMI_BRIDGE} ${INTERFACE_2}

# Bring up the bridge.
ifconfig ${PMI_BRIDGE} ${HEARTBEAT_ADDR} netmask 255.255.255.0 broadcast 1.2.3.255 up

# Add route for the communication
/sbin/route add -net 1.2.3.0 netmask 255.255.255.0 dev ${PMI_BRIDGE}


Use "brctl delif" to remove interfaces.  The person setting up the bridge 
did have to modify the bridge module in kernel 2.4.20 to make the spanning 
tree work correctly.




More information about the LUG mailing list