The principle is to have a special network device that is using two or more underlying NICs. The main propose of bonding is to have a redundant connectivity between a host and your switching layer. If one of the links is down for whatever reason: cable is detached, the switch is down due an error or maintenance, the NIC dies, etc; the other NIC takes all the traffic and no connectivity is lost.
The schema could be something like:
---- ---- eth0 eth1 ---- ---- | | | | \ / \ / ------ bond0 192.168.1.100/24 ------
Both interfaces don't have any IP address, and is this virtual bond0 interface who is managing the physical interfaces, and it has an IP assigned.
The configuration is pretty straightforward. Lets take a look of my /etc/network/interfaces file:
auto lo iface lo inet loopback auto bon0 iface bon0 inet static address 192.168.1.100 netmask 255.255.255.0 network 192.168.1.0 gateway 192.168.1.1 slaves eth0 eth1 bond_mode active-backup bond_miimon 100 bond_downdelay 200 bond_updelay 200
After that just /etc/init.d/networking restart and you are done.
Apart from the normal IP parameters the most important parameter is the "slaves" one. It tells the bond what are the physical interfaces that should be used in this bond. Note that I don't have any configuration for any of the physical interfaces. The other important parameter is the bond_mode. There are different modes. Just to name some of them:
- balance-rr: Round robin policy. This mode provides load balancing and fault tolerance.
- active-backup: Only one slave of the bond is active. If the primary fails, the backup adapters comes into life. This option is used when you don't want to confuse the switch with different MAC addresses. Provides fault tolerance.
- balance-xor: Select the NIC based on the destination MAC address. Provides fault tolerance.
- etc.... see more options here https://help.ubuntu.com/community/UbuntuBonding
And this is it, fellas. Play with you old PC that has to NICs and you will see how it really works and you don't loose any ping! :D
Next post: Bonding in linux with XEN