Configuring LACP (802.3ad) on Ubuntu

When I was installing Ubuntu linux, I tried to set up 20.04.2 with LACP bonding during the install, and the installer kept crashing. So, to get through the install, I just configured one port with the basic info, and then updated the OS after to have the bonding.

I do recommend that you make the changes on the console rather than over ssh, and you may lock yourself out and necessitate getting on the console anyway.

In checking in netland on how to properly set up the network on Ubuntu, I stumbled across the /etc/netplan directory. In this directory, you should find a YAML file with a name similar to 00-installer-config.yaml. This file was created during the install. You can edit this file to re-do in the “install”. The contents of the file when I set up one interface was:

# This is the network config written by 'subiquity'
network:
  ethernets:
    eno1:
      addresses:
      - 10.1.1.105/24
      gateway4: 10.1.1.1
      nameservers:
        addresses:
        - 10.1.49.15
        - 10.2.49.15
        search:
        - technomancer.local
        - technomancer.com
    eno2:
      dhcp4: true
    ens8f0:
      dhcp4: true
    ens8f1:
      dhcp4: true
  version: 2 

I edited this file to reflect the desired bonding. In my case, I am only using 2 of the 4 physical interfaces:

# This is the network config written by 'subiquity'
network:
  ethernets:
    eno1:
      dhcp4: no
    eno2:
      dhcp4: no
    ens8f0:
      dhcp4: no
    ens8f1:
      dhcp4: no
  version: 2
  bonds:
    bond0:
      interfaces: [eno1,ens8f0]
      parameters:
        mode: 802.3ad
        transmit-hash-policy: layer3+4
        mii-monitor-interval: 1
      addresses:
      - 10.1.1.105/24
      gateway4: 10.1.1.1
      nameservers:
        addresses:
        - 10.1.49.15
        - 10.2.49.15
        search:
        - technomancer.local
        - technomancer.com

There are a number of possible hash policies; layer 2 is the default. I chose layer3+4 to better distribute the traffic, as is splits the traffic based on the source and destination IP and port, rather than just on the MAC address which, in theory, provides more balance to the load balancing. Your milage may vary.

Once you have edited the file to your needs, to commit the settings, just run the command:

netplan apply 

Leave a Comment