Introduction
This guide will help you set up the LACP bonding using the IEEE 802.3ad specification. LACP which stands for “Link Aggregation Control Protocol”, is used to combine several physical network connections with the aim of the increasing the speed and reliability of a network. By the end of this tutorial, you will have a bonded network of two network interfaces.
Prerequisites
- The network switch your server is connected to must be set up accordingly in for a successful procedure
Step 1 – Login using SSH
You need to log in as root or a user with root privileges. You can check this article for instructions on how to log in using SSH.
Step 2 – Install the ifenslave dependency
sudo apt-get install ifenslave
Step 3 – Ensure presence of the “bonding” module
sudo modprobe bonding
Step 4 – Load bonding modules during boot
sudo nano /etc/modules
Append the following lines:
bonding
Step 5 – find the active network interface
clear && echo $(ip -o -4 route get 8.8.8.8 | sed -nr 's/.*dev ([^\ ]+).*/\1/p')
Step 6 – Configure the network interface
The output of step 4 is the network interface which is active at the moment. You should use that name for the bond. In our case this is enp2s0 and the second interface enp3s0
sudo nano /etc/network/interfaces auto enp6s0 iface enp6s0 inet manual bond-master bond0 auto enp7s0 iface enp7s0 inet manual bond-master bond0 auto bond0 iface bond0 inet static address 89.207.134.XXX gateway 89.207.134.1 netmask 255.255.255.01 dns-nameservers 89.207.128.252 89.207.130.252 slaves enp6s0 enp7s0 bond-mode 4 bond-miimon 100 bond-lacp-rate 1 bond-slaves none
Step 7 – Restart the server
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 8 – Check bonding interface status
If everything went well, you should have a working bonding interface. You can check this by executing the following command:
cat /proc/net/bonding/bond0
Conclusion
Congratulations, you have configured LACP network interface according to IEEE 802.3ad on a Ubuntu server. If you are interested in other modes which are available check this url section “Descriptions of bonding modes”.
Hi, thanks for this article.
Could you also tell if this is the same on Ubuntu 19.04 or somehow different?
If Ubuntu 19.04 is not using Netplan it should be quite the same. If it's using netplan you can try to use this article https://www.snel.com/support/how-to-set-up-lacp-bonding-on-ubuntu-18-04-with-netplan/.
Thanks!
How do enp6s0 and enp7s0 get configured?
They have to have ip addresses for any of this to work, but you show nothing about that
The first and second interface get configured as followed:
auto enp6s0
iface enp6s0 inet manual
bond-master bond0
auto enp7s0
iface enp7s0 inet manual
bond-master bond0
Since we are making a bond we do not have to assign an IP address to a nic but to a bond. Does this answer your question?
what is the difference
slaves eno1 eno2
bond-mode 4
bond-miimon 100
bond-lacp-rate 1
bond-slaves none
and
bond-mode 4
bond-miimon 100
bond-lacp-rate 1
bond-slaves eno1 eno2
thanks for the reply..
Hi,
can I run some commands, instead of restart the server (step 7)?
Thanks!
What kind of commands do you want to run? We are performing the reboot in order to see if it's working with the new configuration.
I see you're using
bond-mode 4
bond-miimon 100
bond-lacp-rate 1
bond-slaves none
However, I have found in numerous occasions that one has to use _ instead of –
bond_mode 4
bond_miimon 100
bond_lacp_rate 1
bond_slaves none
Do you know why this is? I have found examples of both the web…
Hi Roland!
I have also seen both – and _ on different options in the /etc/networking/interfaces file. Unfortunately I don't know the reasoning behind this. The Debian Wiki mentions the use of bond-mode instead of bond_mode.