In the previous article about NIC bonding the example referred to the "active-backup" bonding mode which ensures redundancy. Another very useful mode in NIC bonding is "balance-alb", which is the most general mode for load balancing and throughput. Our purpose here is to create a new interface that will have twice the throughput of the two slave ports.
NIC bonding configuration
The first steps are the same and the two configurations differ only at a few points. Nevertheless for the sake of simplicity we shall describe all the steps. First, we assume that we know the IP address of the bonded interface (for this article’s purpose it will be 192.168.0.15) and the domain name of the server (here mydomain.com). The process described in this article creates a bonded interface that works in the balance-alb mode (mode 6), which ensures load balancing and throughput. All the commands described here should be entered at the Linux console, so a basic understanding of the console and command line is necessary. The commands will be coloured green and all the points that will need editing are marked red. Use the editor of your choice like nano or vim.
First update the system:
sudo apt-get update && sudo apt-get upgrade -y
Install the ifenslave package which ensures that two or more NICs can be bonded together.
sudo apt-get install ifenslave-2.6 -y
Edit your /etc/modules configuration file. This file describe which kernel modules are initialized at start-up. Ensure that the bonding module is loaded:
sudo vim /etc/modules
After editing the file 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.
The configuration of the bonding module is described in a separate file. Edit /etc/modprobe.d/bonding.conf file
sudo vim /etc/modprobe.d/bonding.conf
The contents of the file should be:
alias bond0 bonding
options bonding mode=6 miimon=100
Now load the bonding kernel module:
sudo modprobe bonding
Backup the existing interfaces file, in case you will need to undo bonding.
sudo cp -f /etc/network/interfaces /etc/network/interfaces.nobond
Edit your interfaces configuration:
sudo vim /etc/network/interfaces
For example, to combine eth0 and eth1 as slaves to the bonding interface bond0 using a simple balance-alb setup, with eth0 being the primary interface:
# 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
iface lo inet loopback
# The primary network interface
iface bond0 inet manual
address 192.168.01.15 #EDIT HERE THE ACTUAL IP ADDRESS
network 192.168.0.0 # EDIT THE ACTUAL NETWORK ADDRESS
broadcast 192.168.0.255 #EDIT HERE THE BROADCAST ADDRESS
gateway 192.168.0.250 #EDIT HERE YOUR GATEGAY ADDRESS
# bond0 may uses balance-alb. The balance-alb mode is the most general for load balancing and throughput
bond-slaves eth0 eth1
dns-nameservers 192.168.0.100 #EDIT HERE THE ACTUAL ADDRESS OF THE DNS SERVER
#eth0 - the first network interface
iface eth0 inet manual
hwaddress ether aa:bb:cc:dd:ee:ff #edit the mac address of eth0 here
#eth1 - the second network interface
iface eth1 inet manual
hwaddress ether aa:bb:cc:dd:ee:ff #edit the mac address of eth1 here
copy the interfaces.bonding file to interfaces:
sudo cp -f /etc/network/interfaces /etc/network/interfaces.bonding
Restart the networking service or reboot the system.
 Wikipedia - Link Aggregation
 Ubuntu Bonding