How to set up LACP bonding on Ubuntu 16.04

Estimated reading time: 1 min

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”.

Was this article helpful?
Dislike 4
Views: 27569

Reader Interactions

Comments

    • Ahmet Bas says

      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/.

    • Ahmet Bas says

      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?

  1. sagar says

    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..

  2. Roland Giesler says

    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…

    • Yavuz Aydin says

      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.

Leave a Reply

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