Jump to content

* * * * * 1 votes

LACP Bonding and Linux

  • Please log in to reply
No replies to this topic

#1 systems_glitch


    Dangerous free thinker

  • Moderating Team
  • 1,782 posts
  • Gender:Male

Posted 20 June 2014 - 08:53 AM

I've been playing with a new workstation I'm building and got into link aggregation/bonding under Linux last night. Since none of the guides I looked through had a distro-agnostic approach, here goes:


Kernel Modules / Utilities


You're going to need the bonding module as well as the ifenslave tool. There's a good chance you'll already have bonding compiled for your kernel (Arch Linux, Slackware 14.1 and Slax 7 all do, CentOS 6.3 did not); if not, search your distro's package repo or build from source.


Chances are pretty good you won't have ifenslave (none of my systems did). Again, check your repos -- quick test shows Arch Linux and Debian-based distros should have it, but Slackware/Slax does not. Grab the appropriate Linux kernel source from your distro's repos, or you can grab vanilla source for Slackware. In testing with Slax, I grabbed the 3.8.2 source from kernel.org. Compile ifenslave:

cd /path/to/src/linux/Documentation/networking
gcc -Wall -O -I/path/to/src/linux/include ifenslave.c  -o ifenslave
cp ifenslave /sbin/ifenslave

Worked fine for Slax, I booted in "persistent changes" mode and saved the resulting binary to avoid having to compile in the future.


Manually Preparing a LACP Interface


This bit should be distro-agnostic and will allow you to get a LACP link up without altering your current persistent system config. See your distro's docs for making it permanent.


You will need to have your switch configured for LACP on the ports you're wanting to bond. How you do this will depend on your switch. Most managed gigabit switches seem to support LACP; however, some use their own thing or predate the 802.3ad standard. My BlackBox switch calls it LACP, while my Allied Telesis AT-GS950 calls it "Aggregation" (as opposed to "Trunking," which is strictly switch-to-switch). Anyway, configure per your switch's docs.


Now, as root, we'll bring up the bonded interface. Assuming you're using eth1 and eth2 as the interfaces to be bonded:

# modprobe bonding miimon=100 mode=4 lacp_rate=1
# ifconfig eth1 down
# ifconfig eth2 down
# ifconfig bond0 up
# ifenslave bond0 eth1 eth2

I tried using DHCP on bond0 with weird results. I got an IPv6 address from my router, but no IPv4. Manually setting the address worked fine.


Make sure you don't have a network management daemon running in the background. I spent probably half an hour trying to figure out why my Ethernet interfaces in the LACP group were getting individual IPs after I bought up the bonded interface!

BinRev is hosted by the great people at Lunarpages!