LFCE 22 ๐ง Bonding โ Modes and Configuration
The previous chapter established why link aggregation exists: to increase aggregate throughput across many flows and to provide redundancy when a link fails. This chapter is the operational counterpart. It examines the seven bonding modes in detail, the parameters that control failover timing, and the configuration syntax for both the running kernel and persistent network managers. The distinction between a bond that works temporarily and a bond that survives a reboot is the central concern, because ip link commands modify kernel memory only, and production systems require the configuration to be written to NetworkManager, systemd-networkd, or the distribution’s native interface files.
Key point: The default bonding mode is balance-rr (mode 0), which is rarely the correct choice. active-backup (mode 1) is the safest default for servers because it requires no switch configuration and provides pure failover. 802.3ad (mode 4) provides both throughput and redundancy but requires LACP negotiation with the switch. The miimon parameter must be set explicitly; without it, link failure detection does not work reliably.
Why bonding modes require careful selection
The default-mode trap.
The Linux bonding driver defaults to balance-rr when no mode is specified. This mode transmits packets in round-robin order across all active slaves, which can increase throughput for a single flow but may cause out-of-order packet delivery at the receiver due to interrupt coalescing and NAPI processing differences across interfaces . Most switches do not support round-robin load balancing for EtherChannel, so the switch may not distribute return traffic evenly. The result is a bond that appears configured but behaves unpredictably. The mode must be chosen deliberately, not left at the default .
The switch-negotiation requirement.
Modes 0, 2, and 4 require switch configuration. If the switch is not configured to match, the bond may create a loop, a broadcast storm, or silent packet loss. Mode 4 (802.3ad) uses LACP to negotiate the aggregation, which prevents loops by refusing to aggregate links that do not match the switch’s port-channel configuration . Modes 1, 5, and 6 do not require switch configuration, but modes 5 and 6 depend on driver support for adaptive load balancing and have limitations behind bridges with virtual machines .
The failover-detection problem.
A bond without link monitoring does not know when a slave has failed. The miimon parameter specifies the interval in milliseconds at which the driver polls the link state of each slave using MII or ethtool ioctls . The default is 0, which disables monitoring. Without miimon, failover occurs only when the driver detects a carrier loss through other means, which may be slower or unreliable depending on the NIC driver. Setting miimon=100 polls every 100 milliseconds, providing failover within a fraction of a second .
a. The seven bonding modes
Each mode defines a different trade-off between throughput, redundancy, and switch requirements.
# Load the bonding module before creating any bond
modprobe bonding
# Check available parameters for the bonding module
modinfo bonding
balance-rr (mode 0) transmits and receives packets sequentially on each slave, starting with the first available. It provides load balancing and fault tolerance, but a single TCP connection can experience out-of-order delivery. It requires a switch configured for static EtherChannel or trunking .
active-backup (mode 1) uses only one slave at a time. The other slaves are standby. If the active slave fails, one of the standby slaves becomes active. This mode requires no switch configuration because the switch sees only one MAC address at a time. It is the safest choice for most servers .
balance-xor (mode 2) uses a hash of the source and destination MAC addresses to select the slave. Traffic to a specific peer always uses the same slave. It requires a switch configured for static EtherChannel .
broadcast (mode 3) transmits all frames on all slave interfaces. It is useful for high-availability applications where duplicate packets are sent to separate networks, but it requires switch support if sending to a single network .
802.3ad (mode 4) implements IEEE 802.3ad dynamic link aggregation. It negotiates with the switch using LACP to form aggregation groups that share the same speed and duplex settings. It provides both load balancing and fault tolerance. The switch must be configured with an LACP port channel .
balance-tlb (mode 5) provides transmit load balancing based on the current load on each slave. Incoming traffic is received by the current slave. If the receiving slave fails, another slave takes over its MAC address. It does not require switch configuration, but it is only suitable for local addresses known to the kernel and cannot be used behind a bridge with virtual machines .
balance-alb (mode 6) includes transmit and receive load balancing for IPv4 traffic. Receive load balancing is achieved through ARP negotiation. Like mode 5, it does not require switch configuration, but it has limitations behind bridges .
b. Key configuration parameters
Beyond the mode, several parameters control failover timing and traffic distribution.
miimon is the link monitoring interval in milliseconds. A value of 100 is commonly recommended for fast failover . updelay and downdelay specify the delay before considering a link up or down, which prevents flapping on unstable links .
# Create a bond with miimon and delays
ip link add bond0 type bond mode active-backup miimon 100 updelay 200 downdelay 200
xmit_hash_policy controls how outgoing traffic is distributed across slaves in modes 0, 2, 4, and 5. layer2 hashes MAC addresses. layer2+3 includes IP addresses. layer3+4 includes TCP/UDP port numbers, providing finer distribution for routed traffic . The policy is set through sysfs.
# Set the hash policy for an 802.3ad bond
echo layer3+4 > /sys/class/net/bond0/bonding/xmit_hash_policy
primary specifies which slave should be the active one in active-backup, balance-tlb, or balance-alb mode. The primary slave is used while it is available; another slave is used only if the primary goes offline .
# Set a primary slave for active-backup mode
ip link set bond0 type bond primary eth0
lacp_rate controls the rate at which LACPDUs are sent in 802.3ad mode. slow sends every 30 seconds; fast sends every second. The switch must support the requested rate .
c. Persistent configuration
The ip link commands modify the running kernel only. A reboot removes the bond. Persistence requires the network manager.
# NetworkManager: create the bond
nmcli connection add type bond con-name bond0 ifname bond0 \
bond.options "mode=active-backup,miimon=100"
# Add slave interfaces
nmcli connection add type bond-slave ifname eth0 master bond0
nmcli connection add type bond-slave ifname eth1 master bond0
# Assign an IP address
nmcli connection modify bond0 ipv4.addresses 192.168.1.100/24 ipv4.method manual
# Bring up the bond
nmcli connection up bond0
The bond.options string accepts the same parameters as the ip link command: mode, miimon, primary, xmit_hash_policy, lacp_rate, and others . The slave interfaces are added as separate connection profiles with master bond0.
For Debian systems using /etc/network/interfaces, the syntax uses bond-* options.
# /etc/network/interfaces
auto bond0
iface bond0 inet static
address 192.168.1.100/24
bond-mode active-backup
bond-miimon 100
bond-slaves eth0 eth1
The bond-slaves option lists the member interfaces. The bond-mode and bond-miimon options correspond to the kernel parameters .
For systemd-networkd, the bond is defined in a .netdev file and the slaves are attached in .network files.
# /etc/systemd/network/10-bond0.netdev
[NetDev]
Name=bond0
Kind=bond
[Bond]
Mode=active-backup
MIIMonitorSec=100ms
# /etc/systemd/network/20-eth0.network
[Match]
Name=eth0
[Network]
Bond=bond0
The [Bond] section accepts Mode, MIIMonitorSec, UpDelaySec, DownDelaySec, PrimarySlave, and TransmitHashPolicy .
Complete Example Session
# ============================================
# PART 1: LOAD THE BONDING MODULE
# ============================================
modprobe bonding
lsmod | grep bonding
# ============================================
# PART 2: CREATE AN ACTIVE-BACKUP BOND
# ============================================
# miimon=100 enables link monitoring
ip link add bond0 type bond mode active-backup miimon 100
# ============================================
# PART 3: ENSLAVE THE PHYSICAL INTERFACES
# ============================================
# Bring interfaces down before enslaving
ip link set eth0 down
ip link set eth1 down
ip link set eth0 master bond0
ip link set eth1 master bond0
# ============================================
# PART 4: ASSIGN ADDRESS AND BRING UP
# ============================================
ip addr add 192.168.1.100/24 dev bond0
ip link set bond0 up
ip link set eth0 up
ip link set eth1 up
# ============================================
# PART 5: VERIFY BOND STATUS
# ============================================
cat /proc/net/bonding/bond0
# Output shows:
# Bonding Mode: fault-tolerance (active-backup)
# Currently Active Slave: eth0
# MII Polling Interval (ms): 100
# ============================================
# PART 6: TEST FAILOVER
# ============================================
ip link set eth0 down
cat /proc/net/bonding/bond0 | grep "Currently Active"
# Output: Currently Active Slave: eth1
ip link set eth0 up
# ============================================
# PART 7: RECREATE AS 802.3ad
# ============================================
ip link set eth0 nomaster
ip link set eth1 nomaster
ip link delete bond0
ip link add bond0 type bond mode 802.3ad miimon 100 lacp_rate fast
ip link set eth0 down
ip link set eth1 down
ip link set eth0 master bond0
ip link set eth1 master bond0
ip addr add 192.168.1.100/24 dev bond0
ip link set bond0 up
ip link set eth0 up
ip link set eth1 up
# ============================================
# PART 8: SET HASH POLICY
# ============================================
echo layer3+4 > /sys/class/net/bond0/bonding/xmit_hash_policy
# ============================================
# PART 9: VERIFY LACP STATUS
# ============================================
cat /proc/net/bonding/bond0
# Output includes:
# Bonding Mode: IEEE 802.3ad Dynamic link aggregation
# LACP rate: fast
# LACP status: active (for each slave if switch is configured)
# ============================================
# PART 10: PERSIST WITH NMCLI
# ============================================
nmcli connection add type bond con-name bond0 ifname bond0 \
bond.options "mode=active-backup,miimon=100,primary=eth0"
nmcli connection add type bond-slave ifname eth0 master bond0
nmcli connection add type bond-slave ifname eth1 master bond0
nmcli connection modify bond0 ipv4.addresses 192.168.1.100/24 ipv4.method manual
nmcli connection up bond0
The ten parts demonstrate the complete lifecycle: load the module, create an active-backup bond, verify failover, recreate as LACP, set the hash policy, verify negotiation, and persist. The critical verification is cat /proc/net/bonding/bond0, which shows the active slave, the MII status, and the LACP status.
Quick Reference
Bonding Modes
| Mode | Name | Switch Requirement | Key Characteristic |
|---|---|---|---|
| 0 | balance-rr | Static EtherChannel | Round-robin; may reorder packets |
| 1 | active-backup | None | One active slave; pure failover |
| 2 | balance-xor | Static EtherChannel | Hash-based; peer always same slave |
| 3 | broadcast | Switch support | All frames on all slaves |
| 4 | 802.3ad | LACP port channel | Dynamic negotiation; load balancing |
| 5 | balance-tlb | None | Transmit load balancing; no bridge |
| 6 | balance-alb | None | Transmit and receive load balancing |
Key Parameters
| Parameter | Value | Purpose |
|---|---|---|
miimon | 100 | Link monitoring interval (ms) |
updelay | 200 | Delay before link considered up |
downdelay | 200 | Delay before link considered down |
xmit_hash_policy | layer2, layer3+4 | Traffic distribution algorithm |
primary | eth0 | Preferred active slave |
lacp_rate | slow, fast | LACPDU transmission rate |
Verification Files
| File | Content |
|---|---|
/proc/net/bonding/bond0 | Mode, active slave, MII status, LACP status |
/sys/class/net/bond0/bonding/ | Mode, hash policy, miimon, slaves |
Best Practices
โ Do This:
# Set miimon explicitly
ip link add bond0 type bond mode active-backup miimon 100 # โ
# Use active-backup when no switch configuration is possible
# It is the safest default for servers # โ
# Use 802.3ad when the switch supports LACP
ip link add bond0 type bond mode 802.3ad miimon 100 # โ
# Set the primary slave in active-backup mode
ip link set bond0 type bond primary eth0 # โ
# Verify LACP status after configuration
cat /proc/net/bonding/bond0 | grep "LACP status" # โ
# Persist through NetworkManager
nmcli connection add type bond ... # โ
โ Don’t Do This:
# Leave the default mode (balance-rr)
# It rarely works as expected without careful switch config # โ
# Forget miimon
# Link failure detection is disabled by default # โ
# Use 802.3ad without switch LACP configuration
# The bond does not pass traffic on unaggregated links # โ
# Expect a single flow to use multiple links
# Hashing assigns each flow to one slave # โ
# Rely on ip link commands surviving reboot
# They modify running kernel state only # โ
# Use balance-tlb or balance-alb behind a bridge
# These modes have limitations with virtual machines # โ
Common Pitfalls
| Pitfall | Why It Happens | Fix |
|---|---|---|
| Bond created but no traffic | Switch port channel missing for 802.3ad | Configure LACP on switch |
| Failover does not occur | miimon not set | Add miimon=100 |
| LACP status down | Cable on wrong port or switch mismatch | Verify switch port channel includes correct ports |
| Packets out of order | balance-rr used | Use 802.3ad or active-backup |
| Bond lost after reboot | ip link is not persistent | Configure through nmcli or interfaces file |
| Primary slave ignored | primary not set or driver does not support it | Set primary explicitly |
Real-World Examples
1. Active-backup with miimon
ip link add bond0 type bond mode active-backup miimon 100
2. LACP with fast rate
ip link add bond0 type bond mode 802.3ad miimon 100 lacp_rate fast
3. Set primary slave
ip link set bond0 type bond primary eth0
4. Set hash policy
echo layer3+4 > /sys/class/net/bond0/bonding/xmit_hash_policy
5. Verify active slave
cat /proc/net/bonding/bond0 | grep "Currently Active"
6. Verify LACP status
cat /proc/net/bonding/bond0 | grep "LACP status"
7. Test failover
ip link set eth0 down
cat /proc/net/bonding/bond0 | grep "Currently Active"
8. nmcli bond creation
nmcli connection add type bond con-name bond0 ifname bond0 bond.options "mode=active-backup,miimon=100"
9. nmcli slave addition
nmcli connection add type bond-slave ifname eth0 master bond0
10. Debian interfaces syntax
bond-mode active-backup
bond-miimon 100
bond-slaves eth0 eth1
Visual
Mode Selection Decision
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ CHOOSING A BONDING MODE โ
โ โ
โ Is the switch configurable? โ
โ โ โ
โ โโโ YES โ Does the switch support LACP? โ
โ โ โ โ
โ โ โโโ YES โ Use 802.3ad (mode 4) โ
โ โ โ Throughput + redundancy โ
โ โ โ Requires LACP port channel โ
โ โ โ โ
โ โ โโโ NO โ Use balance-xor (mode 2) โ
โ โ Static EtherChannel required โ
โ โ โ
โ โโโ NO โ Is redundancy the only goal? โ
โ โ โ
โ โโโ YES โ Use active-backup (mode 1) โ
โ โ Safest default โ
โ โ No switch config โ
โ โ โ
โ โโโ NO โ Use balance-tlb (mode 5) โ
โ or balance-alb (mode 6) โ
โ No switch config โ
โ Driver support required โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Active-Backup Failover
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ ACTIVE-BACKUP WITH MIIMON โ
โ โ
โ Normal: โ
โ โโโโโโโโโโ โ
โ โ eth0 โโโโโ ACTIVE (primary) โโโโโถ โ
โ โโโโโโโโโโ โ
โ โโโโโโโโโโ โ
โ โ eth1 โโโโโ STANDBY โโโโโโโโโโโโโถ (no traffic) โ
โ โโโโโโโโโโ โ
โ โ
โ miimon polls eth0 every 100ms โ
โ โ
โ eth0 fails: โ
โ โโโโโโโโโโ โ
โ โ eth0 โโโโโ DOWN โโโโโโโโโโโโโโโโถ (no carrier) โ
โ โโโโโโโโโโ โ
โ โโโโโโโโโโ โ
โ โ eth1 โโโโโ ACTIVE โโโโโโโโโโโโโโถ โ
โ โโโโโโโโโโ โ
โ โ
โ Failover occurs within miimon + updelay โ
โ /proc/net/bonding/bond0 shows the new active slave โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
LACP Negotiation States
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ /proc/net/bonding/bond0 FOR 802.3ad โ
โ โ
โ Bonding Mode: IEEE 802.3ad Dynamic link aggregation โ
โ LACP rate: slow โ
โ โ
โ Slave Interface: eth0 โ
โ MII Status: up โ
โ LACP status: active โ Aggregated successfully โ
โ Aggregator ID: 1 โ
โ โ
โ Slave Interface: eth1 โ
โ MII Status: up โ
โ LACP status: down โ Not aggregated โ
โ Aggregator ID: 2 โ
โ โ
โ If LACP status is "down": โ
โ - Switch port channel missing โ
โ - Cable on wrong port โ
โ - Switch does not support LACP โ
โ The link will not pass traffic. โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Summary
| Item | Value |
|---|---|
| Default mode | balance-rr (mode 0); rarely correct |
| Safest mode | active-backup (mode 1); no switch config |
| LACP mode | 802.3ad (mode 4); requires switch port channel |
| Link monitoring | miimon=100 (ms); default is 0 (disabled) |
| Hash policy | layer2, layer3+4; set via sysfs |
| Primary slave | primary=eth0; only for modes 1, 5, 6 |
| Verification | /proc/net/bonding/bond0 |
| Persistence | nmcli, interfaces file, systemd-networkd |
Key takeaways:
- The default mode is not the safe mode.
balance-rrrequires careful switch configuration and can cause out-of-order delivery.active-backupis the correct default for servers that need redundancy without switch changes . miimonmust be set explicitly. Without it, the driver does not poll link state, and failover depends on slower carrier detection.miimon=100provides failover within a fraction of a second .- Mode 4 requires LACP on the switch. The bond and the switch exchange LACPDUs to negotiate the aggregation. If the switch is not configured, the link does not pass traffic.
LACP status: activein/proc/net/bonding/bond0confirms negotiation . - Hashing assigns flows, not packets. A single TCP connection uses one slave. Aggregate throughput requires many flows.
layer3+4provides finer distribution for routed traffic thanlayer2. - The primary slave is a preference, not a guarantee. In
active-backup, the primary slave is used while available. If it fails, another slave becomes active. When the primary recovers, it does not automatically become active again unlessprimary_reselectis configured . - Persistence is separate from the running configuration.
ip link add bond0disappears on reboot. NetworkManager,/etc/network/interfaces, or systemd-networkd must recreate the bond at boot .
Remember: Bonding mode selection is a decision about switch capability and traffic pattern. If the switch is not configurable, active-backup is the only safe choice. If the switch supports LACP, 802.3ad provides both throughput and redundancy. Set miimon explicitly, verify the active slave or LACP status in /proc/net/bonding/bond0, and persist the configuration through the network manager. A bond that appears in ip link but has no miimon and no LACP negotiation is a bond that looks configured but fails when a link goes down.
Stop using slow, ad-bloated tool sites! ๐คฎ
๐ Search “KandZ Tools” on Google to use many professional utilities for free.
KandZ.me is the ultimate minimalist hub for:
โ
Finance (Mortgage, Interest, Inflation)
โ
Tech (Base64, JSON, Dev Suite, IP)
โ
Health (BMI, BMR, TDEE)
โ
Productivity (Timer, Workspace, QR)
โก๏ธ Fast & Private
๐ No data leaves your device
๐ 100% Free
๐ Use it now: https://tools.kandz.me
๐ Bookmark itโyouโll need it later!