LACP Bonding on Debian versions

Estimated reading time: 2 min

Introduction

In this article, we’ll look at how to set up LACP bonding on a server running Debian. LACP bonding, uses the Link Aggregation Control Protocol to combine two network interfaces into one logical interface. Today, we’ll use it to combine two ethernet interfaces. This is useful to increase the throughput from each ethernet device, and to provide for a way to failover if there’s an error with one of the devices.

Prerequisites

We’re setting LACP up on a server running Debian 8. The instructions are valid for any of Debian 7, 8 or 9 since the dependencies haven’t changed for those versions. We’re assuming you have SSH access and root access.

All of the commands below require root access. We’ll leave off sudo, and we suggest that you start by running sudo su

Another thing to keep in mind is that LACP will only work if the switch you’re using supports it. If you’re unsure whether you have switch support, reach out to our support team.

Finally, we’ll be changing the networking settings on a server that we’re remotely accessing. This always entails the possibility of accidentally disabling access to that service. Make sure you follow the commands carefully and think through the consequences of commands.

Step 1: Install the ifenslave Dependency

We need to install some networking dependencies to get LACP up and running. Run the following command to install ifenslave:

apt-get install ifenslave

Step 2: Edit Networking Config

We’ll be treating eth1 & eth2 as the devices we’re looking to bond. You’ll need to adjust the names as necessary. To find out the names of the active devices on the server, you can use the following command:

echo $(ip -o -4 route get 8.8.8.8 | sed -nr 's/.dev ([^\ ]+)./\1/p')

To start, we need to edit the networking config to create the new device. Edit the /etc/network/interfaces file and enter the following description at the end:

auto bond0
iface bond0 inet static
address 10.29.1.11
netmask 255.255.255.0
network 10.29.1.0
gateway 10.29.1.254
slaves eth1 eth2
bond-mode 802.3ad
bond-miimon 100
bond-downdelay 200
bond-updelay 200

In this configuration, we’re making a new interface with the device name bond0. We supply the two devices mentioned above, eth1 and eth2, as the slaves. For the bond-mode, we chose 802.3ad, which means that the LACP uses link aggregation to treat the two hardware devices as one logical device.

If you’re interested in other modes, you should take a look at some of the options provided in the documentation. Long story short, you should try something like “balance-rr” which load balances incoming traffic in a round robin fashion and “active-backup” for failover.

Step 3: Reboot

Now that editing is done, double check that all the steps have been executed properly and reboot your machine by running the reboot command:
reboot

Step 4: Confirm Success

Of course, after making networking changes the biggest test of success is being able to ssh back into your machine. However, if you want to check the status of the new bonded interface, you can always run:

cat /proc/net/bonding/bond0

And check the output.

Conclusion

You now have an LACP-bonded ethernet device at bond0. You can use this as you would any other network device, and ifenslave will manage the status, failing over or load balancing the traffic as you specified.

Was this article helpful?
Dislike 0
Views: 98

Reader Interactions

Leave a Reply

Your email address will not be published. Required fields are marked *