LACP Link aggregation bonding on Debian and Ubuntu

Bonding multiple interfaces together is kind of a pain.

bonding-glue

Every vendor wants to call it something different, and the various modes available completely change the way it works from implementation to implementation.

After some trial and error, I got the trunking working between my Debian Squeeze installation and the switch with LACP support. Here’s the config to make it work:

You should only need to configure one file and install one package to make everything work on the Linux side.

The config file: /etc/network/interfaces
The package: ifenslave

Here’s my configuration with 4 interfaces. Adjust for your address, interface names, and desired bond mode.

auto bond0
allow-hotplug bond0
iface bond0 inet static
    address 192.168.5.5
    netmask 255.255.0.0
    network 192.168.0.0
    gateway 192.168.1.1
    slaves eth0 eth1 eth2 eth3
    bond-mode 802.3ad
    bond-miimon 100
    bond-downdelay 200
    bond-updelay 200
    pre-up ifconfig eth0 up
    pre-up ifconfig eth1 up
    pre-up ifconfig eth2 up
    pre-up ifconfig eth3 up

Using a pre-up command for each slave interface, I bring the slave interfaces up and don’t give them any parameters. I add the ports to an aggregate group in the switch’s web interface and voila, everything just works.

If you don’t have a switch to handle trunking in this way, you can use one of the other bonding modes and still get high bandwidth and/or fault tolerance.

To do all of this manually just to try it out, do the following:

# modprobe bonding mode=4 miimon=100
# ifconfig bond0 192.168.5.5 netmask 255.255.0.0 broadcast 192.168.255.255
# ifenslave bond0 eth0 eth1 eth2 eth3 eth4
# route add default gw 192.168.1.1

If you need more than one bonding interface (or want to use a name other than bond0) you need to edit /etc/modprobe.d/aliases.conf and add them. Even if you’re just using the one bond0 and don’t really need the alias, you can add it anyway and while you’re there add the options so dmesg won’t complain about a lack of miimon.

# dmesg | grep bonding.txt

bonding: Warning: either miimon or arp_interval and arp_ip_target module parameters must be specified, otherwise bonding will not detect link failures! see bonding.txt for details.

When I added a second bonding interface, I added these lines to /etc/modprobe.d/aliases.conf:

alias bond0 bonding
alias bond1 bonding
options bonding mode=802.3ad miimon=100 downdelay=200 updelay=200 max_bonds=2
Posted by admica   @   29 December 2011

Related Posts

0 Comments

No comments yet. Be the first to leave a comment !
Leave a Comment

Name

Email

Website

*

Previous Post
«
Next Post
»
Powered by Wordpress   |   Lunated designed by ZenVerse

Valid XHTML 1.0 Transitional