Configuring LACP on Ubuntu 16.04

After installing Ubuntu 16.04 the following guide can be used to set up LACP. If you are still installing the server, select Do not configure the network at this time after the auto-config failed and finish the installation.

Getting started:

In order for LACP to work, it also needs to be set up on the switch the server is connected to.

Because some files might not be accessible from your default user, it's easier to follow this tutorial while being root. You can easily become root by running: sudo -i.

Step 1 - Finding the interfaces

Run the following command: ip link

You will see a list of interfaces, you can ignore the lo interface, if that only leaves two interfaces, those interfaces have to be configured. If more than two interfaces remain LACP should usually be configured on the first two interfaces. You should take notice of which interfaces are up, as you will need them for the next step.

root@elias-demo:~# ip link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: em1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DEFAULT group default qlen 1000
link/ether 3c:a8:2a:54:f5:40 brd ff:ff:ff:ff:ff:ff
3: em2: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
link/ether 3c:a8:2a:54:f5:44 brd ff:ff:ff:ff:ff:ff

Step 2 - Installing ifenslave

By default, Ubuntu 16.04 does not come with the bonding module. This module is not installed by default on Ubuntu 16.04 and you will have to install this, to do this you will need internet access on your machine.

Conveniently our network will be configured in order to accept non-bonded connections as well in order to ease setup, this means you can just use your IP address on one of the connected interfaces during setup (this should not be done long-term as performance will be degraded).

You can quickly configure one of the state UP interfaces with your IP details in order to download this package, replace the information with the IP information for your server.

ip addr add 192.168.2.2/24 dev em1
ip route add default via 192.168.2.1
echo 'nameserver 8.8.8.8' > /etc/resolv.conf

You can now install the ifenslave package by running: apt install ifenslave -y.

To make sure the bonding module loads on the next boot, edit the /etc/modules file (nano /etc/modules) and add a new line with bonding on it.

You can now load the module for the current boot by running: modprobe bonding, this is not neccesary was we are going to be rebooting the server to apply the configuration.

Step 3 - Configuring the bond

To configure the bond, we need to edit the interfaces configuration, you can find this in /etc/network/interfaces.

Edit the file with your preferred editor (nano /etc/network/interfaces) and create the configuration. Configuration example:

auto em1
iface em1 inet manual
    bond-master bond0

auto em2
iface em2 inet manual
    bond-master bond0

auto bond0
iface bond0 inet static
    address 192.168.2.2
    gateway 192.169.2.1
    netmask 255.255.255.0
    dns-nameservers 8.8.8.8 9.9.9.9
    bond-slaves em1 em2
    bond-mode 4
    bond-miimon 100
    bond-lacp-rate 1
    bond-xmit_hash_policy layer3+4

Save the configuration and proceed to the next step.

Step 4 - Applying the configuration

In order to erase the temporary configuration and apply the new configuration, it is recommended to reboot the server, you can do this by typing reboot on the terminal.

Step 5 - Checking the configuration

After the reboot, you can take the following steps to ensure the configuration has been applied corretly, you can do the following:

  • Run the ip link command (again). The output should show a new interface: bond0 should now also be there. If you replace link with address to get ip address you should also see the IP address you entered appear in the output of this command. Example:
    root@elias-demo:~# ip address
    1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
        link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
        inet 127.0.0.1/8 scope host lo
           valid_lft forever preferred_lft forever
        inet6 ::1/128 scope host 
           valid_lft forever preferred_lft forever
    2: em1: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc mq master bond0 state UP group default qlen 1000
        link/ether 72:d6:bf:a4:32:8a brd ff:ff:ff:ff:ff:ff
    3: em2: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc mq master bond0 state UP group default qlen 1000
        link/ether 72:d6:bf:a4:32:8a brd ff:ff:ff:ff:ff:ff
    4: bond0: <BROADCAST,MULTICAST,MASTER,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
        link/ether 72:d6:bf:a4:32:8a brd ff:ff:ff:ff:ff:ff
        inet 192.168.2.2/24 brd 192.168.2.255 scope global bond0
           valid_lft forever preferred_lft forever
        inet6 fe80::70d6:bfff:feb4:188c/64 scope link 
           valid_lft forever preferred_lft forever
    ​
  • Run cat /proc/net/bonding/bond0, this will show a lot of information about the bond0 interface. Here are some of the key lines and what they mean:
    • Bonding Mode: IEEE 802.3ad Dynamic link aggregation
      • Shows the bond is configured with 802.3ad (LACP), this way it negotiates with our switch.
    • Transmit Hash Policy: layer3+4 (1)
      • Shows the bond hashing mode is set to layer3+4, this means it's configured properly in our case.
    • You should also see a (system mac address) mac-address in the Slave interface sections at the details partner lacp pdu.
  • run ping 8.8.8.8, or another IP which has a low chance of being offline. This will confirm internet connectivity, by default the firewall will allow this type of outbound traffic. If you notice missing icmp_seq numbers, there may be packet loss, please contact our support about this.

 

  • networking, lacp, bonding, linux, ubuntu
  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

Configuring LACP on CentOS 7

After completing the installation of CentOS 7, this guide can be used to configure the network...

Configuring LACP on Windows Server 2016 or Windows Server 2019

After installing Windows Server 2016/2019, LACP can be configuring by following the steps in this...

Configuring LACP on Ubuntu 18.04 and Ubuntu 20.04

After installing Ubuntu 18.04/20.04 you can use the following guide to configure LACP on the...

How to setup rDNS (PTR-records)

In order to setup rDNS (or PTR-records), first login to our portal. Then select the server,...