2 minutes
Simple LACP Ubuntu 18.04/20.04 configuration
You want to learn how to setup LACP in Ubuntu 18.04/20.04? Take a look!
Intro:
I was struggling with the new netplan configuration options under Ubuntu 18.04 LTS or Ubuntu 20.04.1 LTS. In this post I will you will find to production ready configurationexamples. The first with simple LACP and the second with a bit advanced + VLAN on bond. I hope this configuration will help you guys. Works for me like a charm.
The first thing to learn is how to set interfaces up and down
ip a
ip link set INTERFACE_NAME up
ip link set INTERFACE_NAME down
to configure a basic LACP in Ubuntu 18.04 or 20.04 you can use this configuration. Just adjust it for your needs:
sudo vim /etc/netplan/01-lacp.yaml
network:
ethernets:
eno1:
dhcp4: true
switchports:
match: eno* # for example if your interfaces are named with eno1np0 and eno2np1
version: 2
bonds:
bond0:
dhcp4: false
addresses:
- 192.168.1.3/24
interfaces:
- switchports
parameters:
mode: 802.3ad
mii-monitor-interval: 5
lacp-rate: slow
min-links: 1
or if you want to setup a VLAN too here or close to production configuration:
network:
bonds:
bond0:
addresses:
192.168.1.5/24 # Server-IP
gateway4: 192.168.1.1 # Gateway or Router IP
interfaces: # Interfaces for LACP / Bonding
eno1np0
eno2np1
nameservers:
addresses:
- 192.168.1.2 # first nameserver
- 192.168.1.3 # second nameserver
search:
- YOUR.LOCAL.DOMAIN # If you needed
parameters:
lacp-rate: fast
mode: 802.3ad
transmit-hash-policy: layer2
ethernets:
eno1np0: {}
eno2np1: {}
version: 2
vlans:
bond0.455:
addresses:
- 10.59.0.1/24
id: 455
link: bond0
nameservers:
addresses: []
search: []
To apply the changes you have to enter sudo netplan apply
but double check the configuration. In the worst case you will be disconnected from your SSH session or disconnecting the server from your network!