Boost Reliability with Ethernet Bonding and Linux - page 3
Recycling the Ethernet
Your next step is to install
ifenslave-2.6, which means "interface slave":
# aptitude install ifenslave-2.6
Now load the
# modprobe bonding mode=balance-alb miimon=100
This works some special magic, so let's take a quick detour to talk about it.
adaptive load balancing. This is the special option that rewrites ARP mappings so that ARP sees your two NICs as the same one.
miimon=100 means "tell MII to check every 100 milliseconds to see if the interface is up." This is important because the
bonding driver provides automatic failover if one of the links goes down, so their state must be continually monitored.
bond0 is your new logical bonded interface name. You'll configure this pretty much like ordinary
eth0, eth1 etc. interfaces. For now create it temporarily with
# ifconfig bond0 192.168.1.101 netmask 255.255.255.0 up
ifconfig to make sure, even though you'll get an error message if it didn't work, because being too careful is just fine:
# ifconfig bond0 Link encap:Ethernet HWaddr 00:00:00:00:00:00 inet addr:192.168.1.101 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST MASTER MULTICAST MTU:1500 Metric:1 [...]
And now, the big moment: assign your slave devices. Both interfaces must be down and not have IP addresses assigned to them:
# ifenslave bond0 eth0 eth1
If everything works, your new bonded interface is operational and you'll be able to ping back and forth between your new interface and the other nodes on your network. You can use iperf to test throughput, and a really fun test is to disconnect one of the interfaces while ping is running. You shouldn't see any interruptions.