HowTo do Ethernet Bonding on Ubuntu - Properly 8 Sep 08
It’s amazing how quickly guides on the Internet go out of date. I suppose this one will be no exception. However as I’ve been looking around there doesn’t appear to be a good guide as to how to get bonded ethernet to work in Ubuntu using the network helper scripts. So I thought I’d scribble down what I know.
This guide is designed for the Intrepid Ibex version of Ubuntu (8.10) with a small addendum covering Hardy Heron (8.04.1).
The Debian/Ubuntu networking system is a bit opaque. It works via a default script in /etc/network/interfaces and is described in interfaces(5). (run man interfaces to read it).
This gives you all the standard entries, but it also points out that other packages can install scripts that extend the options the interfaces file understands. And that is how you configure Ethernet bonding.
Configure your switch
Almost certainly you will have to activate LACP on the relevant ports on your switch to get automatic bonding to work. How you do this depends on your switch. (On my test HP 1800-8G switch I just use the web interface and check a couple of boxes).
For Intrepid and Hardy
- Install the bonding enslave programs and network scripts:
apt-get install ifenslave - Shutdown any active network interfaces you intend to use with bonding
sudo -s ifdown eth0 ifdown eth1 etc, etc... - Comment out the ethernet configurations from
/etc/network/interfaces#auto eth0 #iface eth0 inet dhcp - Add in the bonding configuration into
/etc/network/interfacesauto bond0 iface bond0 inet dhcp slaves all bond-mode 4 bond-miimon 100 - Bring up the interface with:
sudo ifup bond0
This brings up a bonded interface using the 802.3ad Link Aggregation Control Protocol (LACP) which is by far the easiest way of configuring a resilient trunk if your switch supports it (and even quite small switches do these days).
There are other modes and options available in the bonding driver all of which can now be specified in the interfaces file. Full gory details in the bonding.txt.gz file in the current linux-doc package.
Similarly you can specify which network interfaces you want to use as the slaves to the bonding driver e.g. slaves eth0 eth1. Look at the documentation in /usr/share/doc/ifenslave-2.6/README.Debian for more details.
Extra Work for Hardy
Hardy’s ifenslave scripts are a little more primitive than Intrepid. It doesn’t auto-load the bonding module the first time you try to use it and it doesn’t set the options automatically. You have to do that the old fashioned way.
- Create a file called
bondingin/etc/modprobe.dwith the following config in it.alias bond0 bonding options bond0 mode=4 miimon=100 - Load the module into the kernel
sudo modprobe bond0 - Clear out any failed bond interface by running ifdown
sudo ifdown bond0 - Bring the bond interface up.
sudo ifup bond0 - Once you done this once, the system will ensure that the module is loaded automatically on subsequent reboots and the network brought up.


2 months ago mike said:
This works great. How would I go about attaching multiple IP addresses to this newly created bond?
On my ubuntu server with dual bonded nics, I also want to host from that server multiple web services with unique IP Addresses.
2 months ago nic said:
In the example above, bond0 will ask for dhcp through eth0 or eth1?
1 month ago Rob H said:
Do you have an example of some “commodity” switches that support 802.3ad ? I can only find 1 (hp 8 port…not enough ports really to do bonding usefully) that is within my budget.
1 month ago Martin said:
hi,
me and others would love to do this with WLAN interfaces. Do you know wether thats possible? Our problem is to assign encryption keys to the respective interfaces.
thanks, Martin
1 month ago John Leach said:
mike: re:multiple IP addresses, just like any other interface. Either with bond0:1, bond0:2 etc. or just add them and secondary addresses using ip addr add…
nic: not so sure about broadcasts actually, will need to investigate.
Rob: I think our commodity one is a HP 8 port actually. There are some cheap Dell switches that support it too
Martin: your switch needs to support LACP. I don’t know of any switches with wireless interfaces and LACP support.
3 weeks ago alkisg said:
Thanks a lot, this worked great with my unmanaged switch.
And you’re right, this was the only guide to bonding in Intrepid I could find! :)