Network Bonding in Debian

Bonding is the process in which two or more NICS are linked or bonded together to form one virtual interface. Bonding provides two immediate benefits:
- Redundancy
With two or more connections, one can fail and connectivity is still maintained. In highly redundant setups, it’s common for each connection to be connected to a different switch further improving redudnancy as the connection can now also handle a potential switch failure.
When the two connections are both connected to a single switch, LACP (Link Aggregate Control Protocol) is used. When each connection is connected to different independent switches (aka. not stacked) MLAG (Mutli-chassis Link Aggregation Group) is used.
- Improved Throughput
Given two 10G connections, connectivity to the server can now serve twice as much bandwidth. It should be noted however that while bandwidth is increased speed is not.
Configuration
In this post, we’ll be setting up bonding on Debian 13 using ifenslave. For this post, two interfaces will be bonded together connected to a single switch using LACP.
Start by installing the ifenslave package.
apt-get install ifenslaveOnce installed, we need to have the bonding module loaded by the kernel. The first command adds the module so it will be automatically loaded on bootup. The second command tells the kernel to load the bonding module so a reboot is not necessary.
echo 'bonding' >> /etc/modules
modprobe bondingThe bond is created by adding a new bonding interface to /etc/network/interfaces. Open the file with your preferred editor and add in the following (adjusting as needed).
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
source /etc/network/interfaces.d/*
auto bond0
iface bond0 inet static
address 192.168.1.5/24
gateway 192.168.1.1
dns-domain ad.twobyte.blog
dns-search ad.twobyte.blog
dns-nameservers 8.8.8.8 8.8.4.4
bond-mode 802.3ad
bond-slaves eth0 eth1
bond-miimon 100
bond-downdelay 0
bond-updelay 0
bond-lacp-rate 1This configuration essentially says create a new bonding interface called bond0 using two existing interfaces: eth0 and eth1. Communicate with the switch via LACP (Link Aggregation Control Protocol).
bond-mode 802.3ad
ond-slaves eth0 eth1
bond-miimon 100
bond-downdelay 0
bond-updelay 0
bond-lacp-rate 1eth0 and eth1 are not pre-defined in the interfaces file.
Here we’re using static rather than manual when telling ifupdown to create the interface (shown below). This ensures the IP address, gateway and DNS entries are configured as specified. If manual was used ifupdown would ignore these entries. This can be useful setting up an interface without an IP address (bridging) for example.
...
auto bond0
iface bond0 inet static
address 192.168.1.5/24
...To verify that the bonded interface, run:
cat /proc/net/bonding/bond0Once confirmed operational give your server a reboot just to make sure its reboot safe!
See you on the next post.