Linux Network Bonding — High Availability & Link Aggregation Guide
In this tutorial, you'll learn about Linux Network Bonding. We cover key concepts, practical examples, and best practices to help you understand and apply this topic effectively.
Linux network bonding combines multiple physical network interfaces into a single logical link, providing redundancy, increased throughput, or both depending on the bonding mode.
What You'll Learn
How to configure Linux bonding modes including active-backup for failover and 802.3ad for Load Balancing, set up bonds with nmcli and manual config files, verify link status, and troubleshoot common bonding issues on RHEL and Ubuntu.
Why Bonding Matters
A single network interface is a single point of failure. If the cable fails, the switch port dies, or the NIC malfunctions, the server goes offline. Bonding gives you automatic failover with no downtime. For high-traffic systems, link aggregation multiplies bandwidth beyond what a single NIC can handle. DodaZIP's distributed build infrastructure uses active-backup bonding across dual 25 GbE links for zero-downtime connectivity.
Learning Path
flowchart LR A[iptables & nftables] --> B[Network Bonding
You are here] B --> C[Performance Tuning] B --> D[System Rescue] style B fill:#f90,color:#fff
Bonding Modes
| Mode | Name | Description | Use Case |
|---|---|---|---|
| 0 | balance-rr | Round-robin — packets sent sequentially across interfaces | Maximum throughput, identical switches |
| 1 | active-backup | One active link, others standby | Redundancy, simplest setup |
| 2 | balance-xor | XOR of MAC addresses selects interface | Load Balancing, simple hashing |
| 3 | broadcast | All packets on all interfaces | Very specific redundancy needs |
| 4 | 802.3ad | Dynamic link aggregation (LACP) | Industry standard, switch negotiation |
| 5 | balance-tlb | Adaptive transmit Load Balancing | Outbound load, no switch config |
| 6 | balance-alb | Adaptive Load Balancing (transmit + receive) | Full Load Balancing, no switch config |
For most production environments, choose mode 1 (active-backup) for simplicity and reliability, or mode 4 (802.3ad/LACP) when you need both redundancy and increased throughput with a compatible switch.
Configuration with nmcli
NetworkManager is the default on modern distributions:
# Create a bond interface
sudo nmcli connection add type bond ifname bond0 con-name bond0 \
mode active-backup \
bond.options "miimon=100,updelay=200,downdelay=200"
# Add slave interfaces
sudo nmcli connection add type ethernet ifname eth0 con-name bond0-slave1 \
master bond0
sudo nmcli connection add type ethernet ifname eth1 con-name bond0-slave2 \
master bond0
# Assign IP to bond
sudo nmcli connection modify bond0 ipv4.addresses 192.168.1.100/24
sudo nmcli connection modify bond0 ipv4.gateway 192.168.1.1
sudo nmcli connection modify bond0 ipv4.dns 8.8.8.8
sudo nmcli connection modify bond0 ipv4.method manual
# Bring up the bond
sudo nmcli connection up bond0
sudo nmcli connection up bond0-slave1
sudo nmcli connection up bond0-slave2
Manual Configuration (netplan)
On Ubuntu with netplan:
# /etc/netplan/01-bonding.yaml
network:
version: 2
renderer: networkd
ethernets:
eth0:
dhcp4: no
eth1:
dhcp4: no
bonds:
bond0:
interfaces: [eth0, eth1]
addresses: [192.168.1.100/24]
gateway4: 192.168.1.1
nameservers:
addresses: [8.8.8.8]
parameters:
mode: active-backup
mii-monitor-interval: 100
updelay: 200
downdelay: 200
sudo netplan apply
Manual Configuration (ifupdown)
On Debian with /etc/network/interfaces:
sudo tee -a /etc/network/interfaces << 'EOF'
auto bond0
iface bond0 inet static
address 192.168.1.100/24
gateway 192.168.1.1
dns-nameservers 8.8.8.8
bond-slaves eth0 eth1
bond-mode 802.3ad
bond-miimon 100
bond-lacp-rate fast
bond-xmit-hash-policy layer3+4
auto eth0
iface eth0 inet manual
bond-master bond0
auto eth1
iface eth1 inet manual
bond-master bond0
EOF
sudo systemctl restart networking
Configuring LACP (802.3ad) Mode
For mode 4, the switch must be configured for LACP on the corresponding ports:
# nmcli configuration for LACP
sudo nmcli connection add type bond ifname bond0 con-name bond0 \
mode 802.3ad \
bond.options "miimon=100,lacp_rate=fast,xmit_hash_policy=layer3+4"
# Verify LACP status
sudo cat /proc/net/bonding/bond0
Expected output:
Ethernet Channel Bonding Driver: v5.15.0-86-generic
Bonding Mode: IEEE 802.3ad Dynamic link aggregation
Transmit Hash Policy: layer3+4 (1)
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 200
Down Delay (ms): 200
Peer Notification Delay (ms): 0
802.3ad info
LACP rate: fast
Min links: 0
Aggregator selection policy (ad_select): stable
System priority: 65535
System MAC address: 00:1a:2b:3c:4d:5e
Active Aggregator Info:
Aggregator ID: 1
Number of ports: 2
Actor Key: 9
Partner Key: 1
Partner Mac Address: 00:50:56:ab:cd:ef
Slave Interface: eth0
MII Status: up
Speed: 10000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 00:1a:2b:3c:4d:5e
Aggregator ID: 1
Slave Interface: eth1
MII Status: up
Speed: 10000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 00:1a:2b:3c:4d:5f
Aggregator ID: 1
Active-Backup with Failover Testing
# Check current active slave
sudo grep "Currently Active Slave" /proc/net/bonding/bond0
# Simulate a link failure
sudo ip link set eth0 down
# The active slave should switch automatically
sudo grep "Currently Active Slave" /proc/net/bonding/bond0
# Verify connectivity is maintained
ping -c 3 192.168.1.1
# Restore the link
sudo ip link set eth0 up
Expected output during failover:
$ sudo grep "Currently Active Slave" /proc/net/bonding/bond0
Currently Active Slave: eth0
$ sudo ip link set eth0 down
$ sudo grep "Currently Active Slave" /proc/net/bonding/bond0
Currently Active Slave: eth1
$ ping -c 3 192.168.1.1
PING 192.168.1.1 (192.168.1.1) 56(84) bytes of data.
64 bytes from 192.168.1.1: icmp_seq=1 ttl=64 time=0.3 ms
64 bytes from 192.168.1.1: icmp_seq=2 ttl=64 time=0.4 ms
64 bytes from 192.168.1.1: icmp_seq=3 ttl=64 time=0.3 ms
Advanced Bonding Parameters
# Set via sysfs directly
echo 100 > /sys/class/net/bond0/bonding/miimon
echo 200 > /sys/class/net/bond0/bonding/updelay
echo 200 > /sys/class/net/bond0/bonding/downdelay
# Primary slave (preferred interface)
echo eth0 > /sys/class/net/bond0/bonding/primary
echo active-backup > /sys/class/net/bond0/bonding/mode
echo 1 > /sys/class/net/bond0/bonding/primary_reselect
# Minimum links for 802.3ad to activate
echo 2 > /sys/class/net/bond0/bonding/min_links
Common Errors
1. Bond Interface Not Coming Up
Check that slaves are not already configured with IP addresses. Bond slaves must be manual — the bond interface owns the IP. Run ip addr show eth0 to verify.
2. LACP Not Negotiating
The switch must have LACP enabled on the corresponding ports. Check with sudo cat /proc/net/bonding/bond0 — if Partner Mac Address shows all zeros, the switch is not sending LACP frames.
3. Performance Worse Than Single Interface
In balance-rr mode, out-of-order packet delivery can degrade TCP performance. Use LACP (802.3ad) with a hash policy that suits your traffic pattern, or stick with active-backup.
4. ARP Monitoring Fails
Bonding can use ARP requests instead of MII to check link status. If ARP monitoring is configured but the target IP is unreachable, the bond marks all slaves as down. Use arp_ip_target to specify a reliable gateway.
5. Bond Slaves in Error State
Run sudo journalctl -u networking or check kernel messages with dmesg | grep bonding. Common causes: driver issues, cable faults, or switch port misconfiguration.
6. VLANs Not Working Over Bond
Create VLAN interfaces on top of the bond, not on individual slaves:
sudo nmcli connection add type vlan ifname bond0.100 con-name bond0.100 \
dev bond0 id 100 ipv4.addresses 10.0.100.1/24
7. Jumbo Frames Break on Failover
Ensure all interfaces in the bond have matching MTU. Change the bond MTU, which propagates to slaves:
sudo nmcli connection modify bond0 802-3-ethernet.mtu 9000
sudo nmcli connection up bond0
Practice Questions
1. Which bonding mode provides failover without switch configuration? Mode 1 (active-backup). One link carries all traffic; the others stay in standby.
2. What is the difference between miimon and arp_interval? miimon polls the MII status register of the NIC (hardware-level). arp_interval sends ARP requests to verify reachability. MII is faster and more reliable.
3. Why does mode 0 (balance-rr) sometimes cause TCP performance issues? Packets may arrive out of order because round-robin sends them across different links with different latency. TCP interprets this as packet loss and triggers retransmission.
4. How do you check which slave is currently active in an active-backup bond?
Read /proc/net/bonding/bond0 and look for Currently Active Slave.
5. What switch feature is required for mode 4 (802.3ad)? LACP (IEEE 802.3ad Link Aggregation Control Protocol) must be enabled on the switch ports.
Challenge: Set up a dual-NIC server with LACP bonding. Configure two VLAN interfaces on the bond (VLAN 100 for web traffic, VLAN 200 for database traffic). Verify that failing one NIC does not interrupt traffic on either VLAN. Use iperf3 to measure throughput with one and two active links.
What's Next
Built by the developers of Doda Browser, DodaZIP, and Durga Antivirus Pro. Updated 2026-06-24.
Built by the developers of DodaTech
Doda Browser, DodaZIP & Durga Antivirus Pro