How to set up dual-NIC bonding in Ubuntu

REPOST: Source: Only Ubuntu Linux:

Bonding is creation of a single bonded interface by combining 2 or more ethernet interfaces. This helps in high availability and performance improvement.

How to setup dual-dual bonding (two bonds of two interfaces each) on Ubuntu as quickly as possible.

1. Add two lines to /etc/modules

bonding bond0 -o bond0 mode=1 miimon=100

bonding bond1 -o bond1 mode=1 miimon=100

If you’re very good at managing your time, just remember that miimon’s option determines how often the bond is monitored for failure and that mode can be one of:

0 – Round robin balancing

1 – Active back-up

2 – Transmit based on MAC address for load balancing/fault tolerance

3 – Broadcasting – provides fault tolerance by transmitting on all slave interfaces

4 – Aggregates links, assuming all nics support same speeds and duplex settings

5 – Transmit load balancing – balancing is handled by the bond based on load

6 – Same as 5, but also uses arp to balance load “better

2. Install the ifenslave package if you haven’t already. You can use apt-get to grab it if you don’t:

sudo apt-get install ifenslave-x.x

3. Ensure that the package actually installed:

sudo dpkg –get-selections | grep enslave

ifenslave-x.x install

4. Set up your interface files:

# cat /etc/network/interfaces (only including the parts you probably need – substitute IP addresses, netmasks, etc):

auto lo

iface lo inet loopback

auto bond0

iface bond0 inet static





post-up ifenslave bond0 eth0 eth2

pre-down ifenslave -d bond0 eth0 eth2

auto bond1

iface bond1 inet static





post-up ifenslave bond1 eth1 eth3

pre-down ifenslave -d bond1 eth1 eth3

5. Add lines to the bottom of your architecture’s modprobe files, reboot
and pray:

sudo cat /etc/modprobe.d/arch/i386

alias bond0 bonding

options bond0 mode=1 miimon=5000 max_bonds=2

alias bond1 bonding

options bond1 mode=1 miimon=5000 max_bonds=2

Leave a Reply