Network bonding (also known as NIC teaming or link aggregation) allows combining multiple network interfaces into a single logical interface to increase bandwidth and provide redundancy.
This article walks you through configuring network bonding in Ubuntu 24.04 LTS and Debian 12, both of which use Netplan for network management.
Prerequisites
- A system running Ubuntu 24.04 LTS or Debian 12.
- At least 2 physical NICs (e.g.,
ens3
,ens4
). - Root or sudo privileges.
In the commands that follow below we assume you are connected with root account, therefore you don’t need to prepend the sudo to your commands.
Step 1: Install Required Packages
root@localhost:~$ apt update
root@localhost:~$ apt install ifenslave net-tools
ifenslave
is required to attach and detach physical interfaces to a bonding interface.
Step 2: Load the Bonding Kernel Module
Temporarily load the bonding module:
sudo modprobe bonding
To load it at every boot, add it to the file /etc/modules as follows:
root@localhost:~$ echo "bonding" | sudo tee -a /etc/modules
Step 3: Configure Bonding via Netplan
On servers which utilize multiple NIC ports, it is important to identify the interfaces which are involved in bonding/aggregation.
List all interfaces:
root@localhost:~$ ip link
Take note of the NICs you want to bond (e.g., ens3
and ens4
).
Create or Edit the Netplan Configuration
Netplan configs are stored under /etc/netplan/
. You’ll either edit an existing .yaml
file or create a new one.
root@localhost:~$ nano /etc/netplan/01-bonding.yaml
Example Configuration (Active-Backup Mode)
network:
version: 2
renderer: networkd
bonds:
bond0:
interfaces: [ens3, ens4]
parameters:
mode: active-backup
primary: ens3
mii-monitor-interval: 100
dhcp4: no
addresses:
- 192.168.1.100/24
gateway4: 192.168.1.1
nameservers:
addresses: [8.8.8.8, 1.1.1.1]
You can change the mode to balance-rr
, 802.3ad
, etc., based on your switch capabilities.
You can read more information about the bonding modes in this official Ubuntu tutorial.
Step 4: Apply the Netplan Configuration
Once you are done with your netplan configuration, its better to validate for any syntax errors. Do it as follows:
root@localhost:~$ netplan try
If no errors come up, proceed with applying your configuration:
root@localhost:~$ netplan apply
Optional: Enable LACP (802.3ad mode)
If your switch supports LACP, you can use 802.3ad
mode as follows:
Edit your netplan file (e.g. /etc/netplan/01-bonding.yaml) and do the following:
From the configuration we used in this article,
replace:
mode: active-backup
primary: ens3
mii-monitor-interval: 100
with:
mode: 802.3ad
mii-monitor-interval: 100
transmit-hash-policy: layer2+3
LACP requires switch configuration for aggregation (usually called LAG or EtherChannel).
Bonding Modes Summary
Mode | Description | Switch Support Needed |
---|---|---|
balance-rr | Round-robin load balancing | Yes |
active-backup | One active, others standby | No |
balance-xor | Transmit based on hash policy | Yes |
802.3ad | IEEE 802.3ad (LACP) | Yes |
tlb | Adaptive transmit load balancing | No |
alb | Adaptive load balancing (Tx and Rx) | No |
Summary: Increase Traffic Throughput & Maximize Uptime
Network bonding provides redundancy and performance benefits. By using Netplan on Ubuntu 24.04 or Debian 12, you can configure bonding cleanly and persistently.
As NetShop ISP’s network infrastructure is fully redundant by design, grab the opportunity to take full advantage of this by enabling additional network redundancy on your Dedicated Servers.
Contact our Customer Care team for a free consultation or more information about applying LACP on your servers.