What is Network Bonding?
In Linux, network bonding is a mechanism for combining several network interfaces (NICs) into a single logical interface to improve redundancy and load balancing. It’s widely used in Linux servers, high-availability systems, and enterprise networking.
Also known as NIC bonding or teaming, this technique integrates two or more interfaces into one logical interface (a bond).
The two major benefits of network bonding are:
- Redundancy: Ensures failover and uninterrupted connectivity if one interface fails.
- Load Balancing: Distributes traffic across multiple interfaces for better performance.
Bonding Modes in Linux
Linux supports multiple bonding modes, each with different use cases:
- Mode 0 (Round Robin): Sends packets across interfaces in a round-robin fashion. Provides basic load balancing.
- Mode 1 (Active-Backup): Only one interface is active at a time. If it fails, a backup interface takes over.
- Mode 2 (XOR): Balances traffic based on XOR of MAC addresses.
- Mode 3 (Broadcast): Sends traffic on all interfaces for high availability.
Mode 4 (802.3ad – LACP): Uses Link Aggregation Control Protocol to dynamically create aggregated links. Requires switch support. - Mode 5 (Adaptive Load Balancing): Provides fault tolerance and dynamic load balancing using ARP monitoring.
- Mode 6 (Balance-ALB): Adaptive load balancing without needing switch support.
-
Installing the Bonding Module
Most modern Linux kernels include the bonding module. If not, load it manually:
sudo modprobe bonding
Ensure it loads after reboot:
echo “bonding” | sudo tee –a /etc/modules
-
Creating a Bonded Interface
(a) Identify Interfaces
List all available NICs:
ip link show
Example: bond eth0 and eth1.
(b) Configure the Bond Interface
Using Network Configuration Files (older RHEL/CentOS systems):
- Create /etc/sysconfig/network-scripts/ifcfg-bond0:
DEVICE=bond0
NAME=bond0
BONDING_MASTER=yes
BOOTPROTO=static
IPADDR=192.168.2.100
NETMASK=255.255.255.0
GATEWAY=192.168.2.1
ONBOOT=yes
BONDING_OPTS=”mode=1 miimon=100 primary=eth0″
- Configure eth0 and eth1 as slaves:
DEVICE=eth0
NAME=eth0
MASTER=bond0
SLAVE=yes
ONBOOT=yes
Repeat for eth1.
Restart networking:
sudo systemctl restart network
- Using Netplan (Ubuntu 18.04+):
Create /etc/netplan/01-bonding.yaml:
network:
version: 2
renderer: networkd
ethernets:
eth0: {}
eth1: {}
bonds:
bond0:
interfaces: [eth0, eth1]
parameters:
mode: active-backup
primary: eth0
mii-monitor-interval: 100
dhcp4: false
addresses:
– 192.168.2.100/24
gateway4: 192.168.2.1
Apply changes:
sudo netplan apply
-
Testing the Bond
Check bond status:
cat /proc/net/bonding/bond0
-
- Unplug one NIC and verify failover.
- Run ping to confirm connectivity.
Conclusion
Network bonding in Linux boosts both performance and availability by merging multiple interfaces into one logical interface. Whether using traditional scripts or modern tools like Netplan, proper bonding configuration ensures reliability and efficiency in your systems.
Need help setting up network bonding, high-availability systems, or advanced Linux server configurations? The ServerAdminz expert team can handle it for you with 24/7 support.
