You can find an easier to read version here: 5dollarwhitebox.org
The concept of NIC Bonding (or sometimes called NIC Teaming) is that you have two NICs bonded together to appear as if they are the same physical device. I.e. They will both present the same Hardware (MAC) address. This is accomplished through the ifenslave utility, which enables the kernel to see/use only one device, while it sends out packtes via the two slave devices using a round-robbin scheduler.
System: Debian Sarge 3.1 (vanilla kernel 126.96.36.199)
Modules Involved: bonding, mii, nic_module (e100 in this example)
Utilities: ifenslave, mii-tool
Before attempting to bond two NICs, it is highly recommended that you verify the integrity and functionality of each NIC on its own. This document assumes that you've already done that. Using 'mii-tool' you should see something like the following:
eth0: negotiated 100baseTx-FD, link ok
eth1: negotiated 100baseTx-FD, link ok
In order for this to work, the kernel must have support for bonding
devices. A few ways to check would be:
testbox:/# modprobe --list | grep bonding/lib/modules/188.8.131.52-vs2.0/kernel/drivers/net/bonding/bonding.ko
testbox:/# cat /boot/config-184.108.40.206-vs2.0 | grep -i bonding
We use the mii-tool (mii.o module) to monitor the interfaces for
failover… though, as most ethernet adapters use an MII (Media
Independant Interface) to autonegotiate link speeds, its pretty standard
that you'd have this.
testbox:/# cat /boot/config-220.127.116.11-vs2.0 | grep -i mii# CONFIG_MPENTIUMII is not set
# CONFIG_MPENTIUMIII is not set
testbox:/# modprobe --list | grep -i mii
Second, your going to need to install the ifenslave utility.
testbox:/# apt-get update && apt-get install ifenslave
………. removed standard output (nothing interesting)
Theres no configuration here, so that is that. Now we are ready for
the configuration files.
There are many different variations of this, but for now... this is how I did it to get it working.
vi /etc/modutils/aliases and add/edit the following:
alias bond0 bonding
alias eth0 e100
alias eth1 e100
options bonding mode=0 miimon=100
vi /etc/modutils/actions and add/edit the following:
probeall bond0 eth0 eth1 bonding
After editing the modprobe config files you need to run the command:
vi /etc/network/interfaces and add/edit the following:
iface bond0 inet static
hwaddress ether 00:02:B3:48:50:2C
up ifenslave bond0 eth0 eth1
down ifenslave -d bond0 eth0 eth1
You do NOT set up entries for 'eth0' or 'eth1' outside of whats listed above under the 'bond0' entry. Bond0 will now be the interface that the kernel works with. running an 'ifconfig' will show all three interface (bond0,eth0,eth1), all with the same MAC and IP addresses.
And thats basically it. Now, all you should need to do is load the 'bonding' module and stop/start networking... and the apropriate modules should load automagically:
testbox:/# modprobe bonding
testbox:/# /etc/init.d/networking stoptestbox:/# /etc/init.d/networking start
You might have to play around with this part for a bit. For me I had to manually ifconfig up the bond0 device:
testbox:/# ifconfig bond0 10.1.15.63 netmask 255.255.255.0 up
Assuming that there were no errors, you should be able to test this out. Try and ping your IP address from another box. You'll notice both NICs responding to the ping requests back and forth (round robin). If you unplug eth0, you'll get an error the console the "eth0 has failed, eth1 becoming primary" or something like that (and visa versa if you unplug eth1). But you shouldn't drop any of the ping requests (or no more than a few), as it now has a redundant network connection.
In a higher end environment, you could plug each NIC into a separate switch (staying on the same VLAN) and further improve your high availability config... and so on and so forth.