January 21, 2017

Boost Reliability with Ethernet Bonding and Linux - page 3

Recycling the Ethernet

  • August 30, 2007
  • By Carla Schroder

Your next step is to install ifenslave-2.6, which means "interface slave":

# aptitude install ifenslave-2.6

Now load the bonding module:

# modprobe bonding mode=balance-alb miimon=100

This works some special magic, so let's take a quick detour to talk about it. balance-alb means 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:

# ifconfig bond0 netmask up

Then run 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:  Bcast:  Mask:

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.

Sitemap | Contact Us