Something that came up for me recently was setting up bonding on Ubuntu Server 20.04. Bonding is useful to give more throughput and redundancy. There are multiple bonding modes available to a virtual interface in Netplan.

Some (not all) Boding Types

  1. balance-rr

Round Robin using the interfaces in sequential order. This provides higher throughput and redundancy.

  1. active-backup

One interface is up while the other provides redundancy in the event of a failure.

  1. balance-xor

This uses an algorithm to use all interfaces in a bond. This provides both higher throughput and redundancy.

Sample YAML

Here is the YML required for a bond in Netplan:

network:
  bonds:
    bond0:
      dhcp4: true
      interfaces:
      - enp0s3
      - enp0s8
      parameters:
        mode: balance-rr
  ethernets:
    enp0s3: {}
    enp0s8: {}
  version: 2

Placing Config

Make sure to backup the YAML file at /etc/netplan/ by adding .backup to the end of it. Then create the new config there with the extension .yml.

Then apply the changes.

sudo netplan apply

Reboot

Now reboot to ensure the bond comes up correctly.

sudo reboot

Verification

To verify the configuration is correct upon reboot, check aggregator IDs.

cat /proc/net/bonding/bond0

Both aggregator IDs should match.