Production Ubuntu servers hosting high-traffic web applications, database clusters, virtualization hypervisors, or Network Attached Storage (NAS) endpoints cannot afford network connectivity outages caused by a faulty switch port, damaged Ethernet cable, or failing network interface card (NIC). Furthermore, a single 1Gbps or 10Gbps interface can become an I/O bottleneck under heavy concurrent client traffic.
Network interface bonding (link aggregation) combines multiple physical network adapters into a single logical virtual interface (such as bond0). Using Netplan—the default network configuration abstraction tool in modern Ubuntu releases—administrators can easily configure active-backup failover or IEEE 802.3ad Link Aggregation Control Protocol (LACP) to double network bandwidth and guarantee seamless failover redundancy.
Prerequisites and Kernel Bonding Module
Ensure the Linux kernel bonding module is available on your Ubuntu server:
- Load the bonding module into the kernel:
sudo modprobe bonding
- Ensure the module loads automatically on system boot:
echo "bonding" | sudo tee /etc/modules-load.d/bonding.conf
- Identify the names of the physical network interfaces you intend to aggregate using
ip link:
ip -br link
Assume our server has two physical Ethernet interfaces: enp3s0 and enp4s0.
Understanding Bonding Modes in Netplan
Netplan supports several bonding modes:
- active-backup (Mode 1): One interface remains active while the other stays in standby. If the active link drops, the backup takes over instantly. Requires zero special configuration on network switches.
- 802.3ad (Mode 4 – LACP): Aggregates bandwidth across links and provides dynamic failover. Requires an enterprise switch configured with LACP on the corresponding ports.
- balance-rr (Mode 0): Round-robin transmission across interfaces.
Configuring Netplan for Active-Backup Failover
To configure robust fault-tolerant failover without requiring managed switch configuration:
- Open your active Netplan configuration file in
/etc/netplan/(e.g.01-netcfg.yamlor50-cloud-init.yaml):
sudo nano /etc/netplan/01-netcfg.yaml
- Structure the YAML file with physical interfaces under
ethernetsand the aggregated interface underbonds:
network:
version: 2
renderer: networkd
ethernets:
enp3s0: {}
enp4s0: {}
bonds:
bond0:
interfaces:
- enp3s0
- enp4s0
addresses:
- 192.168.1.100/24
routes:
- to: default
via: 192.168.1.1
nameservers:
addresses:
- 1.1.1.1
- 8.8.8.8
parameters:
mode: active-backup
primary: enp3s0
mii-monitor-interval: 100
The mii-monitor-interval: 100 directive instructs the kernel to poll link health every 100 milliseconds.
Configuring 802.3ad (LACP) Bandwidth Aggregation
If your physical server connects to an enterprise switch configured with LACP trunks:
parameters:
mode: 802.3ad
lacp-rate: fast
transmit-hash-policy: layer2+3
mii-monitor-interval: 100
Testing and Applying the Netplan Configuration
Always test Netplan YAML adjustments using netplan try to prevent accidental remote SSH lockouts:
- Test the configuration with automated rollback:
sudo netplan try
If the network remains functional and you can confirm connectivity, press Enter to accept the changes within 120 seconds.
- Verify the operational health of the bonded interface:
cat /proc/net/bonding/bond0
The output reports the active bonding mode, currently active slave interface, MII polling status, and link state across all participating physical NICs.