Bonding Interfaces on Ubuntu 12.04LTS
Having multiple interfaces on a server helps for a variety of reasons, and recently I had to get a server (a Sun Micrososystems X4100 incidentally), up and running with Ubuntu 12.04LTS and bonded interfaces.
Although we doubted we’d get more bandwidth and speed than a regular 1Gb links it had already, we liked the idea of using the four inbuilt ethernet adapters to their maximum potential across different switches.
Interface bonding, otherwise known as teaming or link aggregation is covered in many tutorials around the web, however I quickly found that there appears to have been a recent update to ifenslave which makes most of the information out there useless. It also appears to have broken a few existing setups too. Also I found contradictory information in quite a few sources.
Ideally you want console or local access to the server since we’ll be restarting the networking services you cannot guarantee to keep your connection through this tutorial. Use at your own risk…
On your Ubuntu 12.04LTS box type in the following:
At the bottom put in “bonding”, so it should look like this:
# /etc/modules: kernel modules to load at boot time. # # This file contains the names of kernel modules that should be loaded # at boot time, one per line. Lines beginning with "#" are ignored. loop lp rtc bonding
I gave my server a reboot at this point.
When we’re back online, lets copy the networking config:
cp /etc/network/interfaces /root/interfaces-backup
We’ll assume you’ll want to use 192.168.0.100 for your IP address, and that you’ve got 4 network interfaces. You’ll want to make your interfaces file look like this:
Then you want a config like the following:
## This file describes the network interfaces available on your system # and how to activate them. For more information, see interfaces(5). # The loopback network interface auto lo iface lo inet loopback # # Bonded NICs setup # # eth0 is manually configured and slave to bonded NIC auto eth0 iface eth0 inet manual bond-master bond0 # eth1 is manually configured and slave to bonded NIC auto eth1 iface eth1 inet manual bond-master bond0 # eth2 is manually configured and slave to bonded NIC auto eth2 iface eth2 inet manual bond-master bond0 # eth3... well you get the point already don't you? auto eth3 iface eth3 inet manual bond-master bond0 # bond0 is the bonded NIC in use by the standard NICs auto bond0 iface bond0 inet static address 192.168.0.100 netmask 255.255.255.0 broadcast 192.168.0.255 gateway 192.168.0.1 dns-nameservers 22.214.171.124 126.96.36.199 bond_mode balance-alb bond_miimon 100 bond_lacp-rate 1 bond_slaves eth0 eth1 eth2 eth3
Give your server a reboot and you should be good to go!