Pascal's TechBlog

Sunday, April 23, 2006

Ubuntu Bonding

It's quite easy to configure network interface fail-over on Ubuntu, this feature is called bonding in the Linux kernel. Bonding allows you to do two things: fail-over and load-balancing.

To configure fail-over make sure the bonding kernel module gets loaded during the boot process, this can be achieved by editing the /etc/modules file and adding the following line:
bonding mode=active-backup miimon=100

The mode module parameter tells the bonding module what to do, either fail-over or load-balancing. The miimon module parameters defines the monitoring interval in milliseconds.

Next install ifenslave, ifenslave binds the physical slave interfaces to the master logical interface:
# apt-get install ifenslave-2.6

Finally you need to edit the /etc/network/interfaces file:
auto bond0
iface bond0 inet static
address 192.168.9.9
netmask 255.255.255.0
gateway 192.168.9.1
post-up ifenslave bond0 eth0 eth1
pre-down ifenslave -d bond0 eth0 eth1

The post-up and pre-down lines make sure the physical slave interfaces are bound and unbound when the logical master interface goes up or is being taken down.

23 Comments:

Post a Comment

<< Home