How to set up LACP bonding with Netplan

How to set up LACP bonding with Netplan

Step 1 – Login using SSH

Step 2 – Install the ifenslave dependency

  • sudo apt-get install ifenslave

Step 3: Load bonding kernel module

Before you can configure the network cards you need to ensure that the kernel module called bonding is present and loaded.

  • sudo lsmod | grep bonding

If the module is not loaded. Use the following command to load it

  • sudo modprobe bonding

To ensure that the bonding module is loaded during boot time change file the following file

  • sudo nano /etc/modules

Add the following line:

  • bonding

Step 4 – find the active network interface

  • clear && echo $(ip -o -4 route get 8.8.8.8 | sed -nr ‘s/.*dev ([^\ ]+).*/\1/p’)

Step 5 – 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 eno1 and the second interface eno2

  • # This is the network config written by ‘subiquity’
  • network:
  • bonds:
  • bond0:
  • addresses:
  • – 89.47.232.155/27
  • gateway4: XX.XX.XX.XX
  • interfaces:
  • – eno1
  • – eno2
  • nameservers:
  • addresses:
  • – 8.8.8.8
  • search: []
  • parameters:
  • lacp-rate: fast
  • mode: 802.3ad
  • transmit-hash-policy: layer3+4
  • mii-monitor-interval: 100
  • ethernets:
  • eno1: {}
  • eno2: {}
  • version: 2

Apply the changes

  • sudo netplan apply

Step 6 – Reboot

  • reboot