Mikko Kortelainen

NIC bonding with Ubuntu

Network interfaces can be bonded to provide fault-tolerant operation. Here's how to do it in Ubuntu. I will assume the interfaces to be bonded are eth0 and eth1.

First, install the ifenslave package. The ifenslave tool will be used to actually bond the interfaces.

apt-get install ifenslave

Create file /etc/modprobe.d/bonding with the following contents:

alias bond0 bonding
options bonding mode=0 miimon=100

Load the bonding module:

modprobe bonding

Add a bonded interface into /etc/network/interfaces:

auto bond0
iface bond0 inet static
  address 192.168.0.1
  gateway 192.168.0.254
  netmask 255.255.255.0
  pre-up modprobe bonding
  up ifenslave bond0 eth0 eth1
  pre-down ifenslave bond0 -d eth0 eth1
  post-down rmmod bonding

Restart networking:

/etc/init.d/networking restart

That's it! The bonded interface should come up automatically after a reboot as well.