This article will show how to “bond” two Ethernet connections together to create an auto failover interface.
Bonding
Install packages
First install the ifenslave-2.6 package, necessary to enable bonding:
# apt-get install ifenslave-2.6
Shutdown / Unconfigure Existing Interfaces
# ifdown eth0 (Repeat for all interfaces included in the bond) # /etc/init.d/networking stop
Note: Sometimes, ifdown doesn’t work, in that case use ifconfig eth0 down
Config file for Lenny
When you use Lenny, you have to modify /etc/network/interfaces only.
auto bond0 iface bond0 inet static address 10.31.1.5 netmask 255.255.255.0 network 10.31.1.0 gateway 10.31.1.254 slaves eth0 eth1 bond_mode active-backup bond_miimon 100 bond_downdelay 200 bond_updelay 200
For more detail, see /usr/share/doc/ifenslave-2.6/README.Debian and /usr/src/linux/Documentation/networking/bonding.txt.
Additional Note For Debian Lenny On Sparc (may be applicable on other architectures as well).
# cd /etc/modprobe.d # cat > aliases-bond alias bond0 bonding options bonding mode=1 arp_interval=2000 arp_ip_target=192.168.3.1 <CTRL-D>
Without this file, you will get a warning when starting up the bonded interface similar to this:.
bonding: Warning: either miimon or arp_interval and arp_ip_target module parameters must be specified, otherwise bonding will not detect link failures! see bonding.txt for details.
Startup / Configure New Interfaces
# ifup bond0 # /etc/init.d/networking start
And more, if you use Lenny environment which has been upgraded from Etch or older versions, it is strongly recommended to check the result of the following command to check the bonding device mode, because config files for Etch and older versions do not work for Lenny.
cat /sys/class/net/bond0/bonding/mode
Config files for Etch (and older versions)
There are a few config files that need to be edited. Change your /etc/network/interfaces to look like this. You will need to remove the listings associated with the bonded interfaces such as eth0 and eth1. Change the interfaces (ie: eth0; eth1) to match your needs as well as the IP address information
auto bond0 iface bond0 inet static address 10.31.1.5 netmask 255.255.255.0 network 10.31.1.0 gateway 10.31.1.254 up /sbin/ifenslave bond0 eth0 eth1 down /sbin/ifenslave -d bond0 eth0 eth1
Add the following lines to /etc/modprobe.d/arch/i386
alias bond0 bonding options bonding mode=1 miimon=100 downdelay=200 updelay=200
Last add this line to /etc/modules
bonding
and run
#update-modules