Sunday, 14 November 2010

How to do Ethernet Bonding on Ubuntu Properly (hotplug edition)

For those of you who have faithfully followed my guide on how to do ethernet bonding in older versions of Ubuntu and now find that it doesn't work on Karmic, Lucid etc, here's an update that works with the new upstart hotplug ethernet system and installs an 802.3ad LACP bonded pair.

  1. Install the bonding enslave programs and scripts
  2. apt-get install ifenslave-2.6
    
  3. Make sure you've removed any old bond startup file from /etc/modprobe.d. grep for bonding in there and get rid of the files. The upstart hotplug system will launch the bonding module.
     
  4. From the console edit the /etc/network/interfaces and make it look like this:
    # The loopback network interface
    auto lo
    iface lo inet loopback
    
    # The bond interface - mode 4 is 802.3ad LACP. No slaves are defined here.
    auto bond0
    iface bond0 inet dhcp
      bond-slaves none
      bond-mode 4
      bond-miimon 100
    
    # The slaves now reference the master
    auto eth0
    iface eth0 inet manual
      bond-master bond0
    
    auto eth1
    iface eth1 inet manual
      bond-master bond0
    
  5. Restart the server


There are other options of you want to use a different mode, but the difference now is that many of those options are specified on the slave stanzas rather than the master. See /usr/share/doc/ifenslave-2.6/README.Debian and /usr/share/doc/ifenslave-2.6/examples/two_hotplug_ethernet on your server for the gory details.