Interface Bonding
Network interface bonding is a critical technique for enhancing redundancy and load balancing in Linux systems. By aggregating multiple physical interfaces into a single logical bond, administrators can achieve fault tolerance, increased bandwidth, and optimized traffic distribution. This section covers configuring bonding modes like active-backup (for redundancy) and balance-alb (for load balancing), along with practical examples and best practices.
Prerequisites and Kernel Support¶
Before configuring bonding, ensure:
- Physical interfaces are connected and functional.
- The bonding kernel module is loaded (modprobe bonding).
- The bonding driver is supported by your kernel (check /boot/config-$(uname -r) for CONFIG_BONDING).
Configuring Bonding Modes¶
1. Active-Backup Mode¶
Use Case: Redundancy with a single active interface and a backup.
Steps:
1. Create the bond interface:
eth0 and eth1):3. Set the primary interface (optional):
4. Bring the bond online:
5. Assign an IP address:
Note: Failover occurs automatically if the primary interface fails.
2. Balance-ALB Mode¶
Use Case: Load balancing with ARP-based traffic distribution.
Steps:
1. Create the bond interface:
3. Bring the bond online:
4. Assign an IP address (same as above).
Key Behavior:
- Traffic is distributed based on ARP tables.
- Requires the balance-alb mode to be supported by the bonding driver.
Persistent Configuration with systemd-networkd¶
To ensure bonding survives reboots, configure it in /etc/systemd/network/ (e.g., bond0.network):
[Match]
Name=bond0
[Network]
BondMode=balance-alb
BondSlaves=eth0 eth1
Address=192.168.1.100/24
Gateway=192.168.1.1
Routes=8.8.8.8
Troubleshooting and Monitoring¶
- Check bond status:
- Verify ARP tables:
- Check kernel logs:
- Common issues:
- Missing
bondingmodule. - Incorrect mode configuration (e.g.,
balance-albrequires specific kernel support). - Misconfigured ARP settings for load balancing.
Key takeaways¶
- Bonding modes like
active-backup(redundancy) andbalance-alb(load balancing) address different use cases. - Persistent configuration via
systemd-networkdornmcliensures reliability across reboots. - Monitoring tools like
ipanddmesghelp diagnose bonding issues. - Always verify kernel support and ARP settings for advanced modes.
- Use
modprobeto load the bonding module if it’s not already active.