Master Linux Multi‑NIC Bonding: Modes, Configuration Steps & Best Practices
This guide explains Linux network interface bonding, detailing all seven bonding modes, their characteristics, required switch configurations, and provides step‑by‑step instructions for setting up bond0 with configuration files, modprobe options, and verification commands to achieve high‑availability and load‑balanced networking.
Linux NIC Bonding Overview
Linux kernel provides a bonding driver that can aggregate up to seven physical network interfaces into a single logical interface (e.g., bond0). The most frequently used modes are 0 (balance‑rr), 1 (active‑backup) and 6 (balance‑alb).
Bonding Modes
mode=0 – balance‑rr : round‑robin transmission across slaves; preserves packet order per slave but can cause out‑of‑order delivery for a single TCP flow. Requires switch support for link aggregation (static or LACP).
mode=1 – active‑backup : only one slave is active; others are standby. Provides fault‑tolerance without load‑balancing. The bond presents a single MAC address taken from the active slave, avoiding switch MAC conflicts.
mode=2 – balance‑xor : selects a slave based on an XOR hash of source/destination MAC (or IP) addresses; offers load‑balancing and fault‑tolerance. Hash algorithm can be changed with xmit_hash_policy.
mode=3 – broadcast : every packet is sent on all slaves; maximizes redundancy but does not balance load.
mode=4 – 802.3ad (LACP) : implements IEEE 802.3ad link aggregation; requires switch support and matching LACP configuration on both ends. Each slave must report speed/duplex via ethtool.
mode=5 – balance‑tlb : adaptive transmit load‑balancing; distributes outgoing traffic according to each slave’s current load. No special switch configuration needed.
mode=6 – balance‑alb : combines TLB with receive load‑balancing (RLB) using ARP negotiation; each slave uses a unique MAC address, so no switch configuration is required.
Key Parameters
mode: bonding mode (0‑6). miimon: link‑monitoring interval in milliseconds (e.g., 200 ms). max_bonds: maximum number of bond interfaces that can be created. xmit_hash_policy: hash algorithm for mode 2 (default XOR) or mode 4. updelay and downdelay: delay before bringing a slave up or down; important for ARP‑based modes.
Configuration Example for a Single Bond (bond0)
Create the bond interface definition /etc/sysconfig/network-scripts/ifcfg-bond0 Typical content:
DEVICE=bond0
BOOTPROTO=none
ONBOOT=yes
IPADDR=192.168.0.100
NETMASK=255.255.255.0
NETWORK=192.168.0.0
BROADCAST=192.168.0.255Configure each slave interface Example for eth0 :
/etc/sysconfig/network-scripts/ifcfg-eth0 DEVICE=eth0
BOOTPROTO=none
MASTER=bond0
SLAVE=yesRepeat the same file for eth1 (change DEVICE ).
Set bonding module options Create /etc/modprobe.d/bonding.conf with the desired mode and monitoring interval:
alias bond0 bonding
options bonding mode=0 miimon=200Load the module (or reboot): modprobe bonding Restart networking and verify /etc/init.d/network restart Check the bond status:
cat /proc/net/bonding/bond0Multiple Bonds
If more than one bond is required, the bonding.conf file can apply a common set of options to all bonds or specify per‑bond options.
Uniform mode for all bonds
alias bond0 bonding
alias bond1 bonding
options bonding max_bonds=2 miimon=200 mode=1Different modes per bond
alias bond0 bonding
options bond0 miimon=100 mode=1
install bond1 /sbin/modprobe bonding -o bond1 miimon=200 mode=0Verification Output Example
Typical /proc/net/bonding/bond0 excerpt:
Ethernet Channel Bonding Driver: v3.5.0 (November 4, 2008)
Bonding Mode: fault-tolerance (active-backup)
Primary Slave: None
Currently Active Slave: eth0
MII Status: up
MII Polling Interval (ms): 200
...The bond and all slaves share the same MAC address in active‑backup mode, preventing switch MAC‑flapping.
Practical Caveats
Mode 0 requires the connected switch ports to be configured as an aggregated link (static or LACP) because all slaves use the same MAC address.
Mode 6 (balance‑alb) rewrites ARP replies so each slave presents a distinct MAC address; no switch configuration is needed.
When adding or removing slaves, set updelay to a value larger than the switch’s forwarding delay to avoid temporary loss of ARP entries.
Use ethtool to verify that each NIC reports speed and duplex; this information is required for LACP (mode 4) and for accurate load‑balancing in modes 5 and 6.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
ITPUB
Official ITPUB account sharing technical insights, community news, and exciting events.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
