Network Bonding in AlmaLinux: Boost Your Server’s Bandwidth and Reliability
If you’re running a web farm, a media server, or just want to keep two NICs from fighting each other, this is the place where you learn how to tie them together into one logical interface on AlmaLinux. By the end of this post you’ll have a working bond that either adds load‑balancing throughput or gives you fail‑over protection—whichever mode you pick.
What Is Network Bonding?
Network bonding lets two (or more) physical network adapters appear as a single logical device to the operating system and the network. The kernel then decides how to distribute traffic across the members, either balancing load or switching over if one drops out. It’s not magic; it’s just clever packet routing that most servers need for redundancy or extra speed.
When Should You Bond? A Real‑World Scenario
I once helped a small business set up a file server with two 1 GbE cards because their ISP had an old patch cable and they wanted to avoid downtime. After a buggy driver update one card stopped sending packets, and the whole share went offline—until we bonded the interfaces. The bond kept the service alive while I fixed the driver issue.
If you’re in a situation where a single NIC failure should bring down your service or you want more than 1 Gbps from two cheap adapters, bonding is worth it. If you just need one interface to stay up, a simple fail‑over mode will do; if you want maximum throughput, use balance‑round‑robin (balanced load).
Preparing the Hardware
Before you touch any configs, make sure both NICs are present and recognized:
ip link show
You should see enp0s3 and enp0s4 or something similar. If one is missing, check BIOS/UEFI to ensure it’s enabled and the driver is loaded.
Also double‑check that you’re on AlmaLinux 9 or later; older releases use different network scripts by default.
Configuring a Bonded Interface Using NetworkManager
AlmaLinux ships with NetworkManager as the standard manager. The easiest way to set up bonding is through its command line tool nmcli. Below we’ll create a bond called bond0, add two slaves, and set it to balance‑round‑robin mode.
1. Create the Bond Interface
sudo nmcli con add type bond ifname bond0 con-name bond0 \
bond.options "mode=balance-rr miimon=100"
The bond.options line tells the kernel which algorithm to use (balance-rr is load balancing). miimon=100 sets a health‑check interval of 100 ms; if one slave dies, the bond will notice quickly.
2. Add Physical Slaves
sudo nmcli con add type ethernet ifname enp0s3 con-name enp0s3 \
connection.autoconnect yes master bond0
sudo nmcli con add type ethernet ifname enp0s4 con-name enp0s4 \
connection.autoconnect yes master bond0
By attaching each NIC to the bond (master bond0) you’re telling NetworkManager to treat them as part of that logical interface. The autoconnect flag ensures they re‑join automatically after a reboot.
3. Assign IP Settings to the Bond
If you use DHCP:
sudo nmcli con mod bond0 ipv4.method auto
Or static (replace with your subnet details):
sudo nmcli con mod bond0 ipv4.addresses 192.168.1.100/24 sudo nmcli con mod bond0 ipv4.gateway 192.168.1.1 sudo nmcli con mod bond0 ipv4.dns 8.8.8.8,8.8.4.4
4. Bring the Bond Up
sudo nmcli con up bond0
Now you should see a new bond0 interface in ip addr show. Verify that both slaves are listed as part of it:
cat /proc/net/bonding/bond0
The output will detail each slave’s state and the active mode.
Tweaking Kernel Parameters (Optional)
If you’re using a very busy server, tweak the kernel’s bonding module:
sudo sysctl -w net.ipv4.conf.bond0.arp_interval=200 sudo sysctl -w net.ipv4.conf.bond0.arp_ip_target="192.168.1.100"
These adjust ARP pinging to keep neighbors in sync, useful for large networks where the default 30 s interval is too slow.
Testing Your Bond
A quick test: ping an external host while dropping one NIC:
sudo ip link set enp0s3 down ping -c 10 google.com sudo ip link set enp0s3 up
If you’re on a fail‑over bond (mode=active-backup) the ping should keep going. If you’re on load balancing, watch ip -s link show bond0 to see traffic split evenly.
Common Pitfalls and How to Avoid Them
- Wrong bonding mode: Using balance-alb on non‑IEEE 802.3ad setups will silently drop packets. Stick with balance-rr, active-backup, or 802.3ad if you have a LACP switch.
- Missing miimon: Without it the bond may not detect a dead NIC, leaving the system stuck on one interface until reboot.
- Conflicting static IPs: Don’t set an IP on both slaves; only the bond should own the address stack.
- NetworkManager vs. legacy scripts: If you still have /etc/sysconfig/network-scripts around, it can clash with nmcli. Pick one system and stick to it.
Wrapping It Up
That’s all there is to it: a couple of nmcli commands, a dash of patience, and a bond that either doubles your bandwidth or gives you peace of mind when a cable goes bad. If you run into hiccups, check the logs in /var/log/messages or use journalctl -u NetworkManager.service; most problems show up there.