How to create NIC Bonding in Linux

Using 2 ethernet ports to bond one interface.

Network Interface Card (NIC) bonding in Linux offers several advantages, particularly in scenarios where high availability and improved network performance are crucial. One significant benefit is enhanced bandwidth and load balancing.

In my home lab I had some issues with multiple backups at the same time, as the NFS shares were reaching their limit. I combined multiple NICs into a bonded interface, so during network-heavy operations theย  traffic could be distributed across these interfaces, preventing bottlenecks and optimizing overall data throughput. I did this for multiple networks so the NAS can serve the proxmox hosts and seperately run migrations/backups on a seperate NFS share and network.ย 

Moreover, NIC bonding provides fault tolerance; if one NIC fails, the bonded interface can seamlessly switch to the functioning NIC, ensuring continuous network connectivity.ย 

This will not be able to create speeds higher than your network allows to one host but can reach maximum for each network device on multiple devices.ย 

ย To set it up on rocky/debian you can edit the below file to add the bonding options

/etc/sysconfig/network-scripts/ifcfg-bond0


DEVICE=bond0
BOOTPROTO=static
ONBOOT=yes
IPADDR=192.168.0.182
NETMASK=255.255.255.0
BONDING_OPTS="mode=6 use_carrier=1 miimon=100 updelay=100"
USERCTL=no

and then in the below networks you require to bond, set slave to yes and point the master to bond0 as defined in the above. In this example I would add to eth0, eth1 and so forth.

/etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE=eth0
BOOTPROTO=static
ONBOOT=yes
IPADDR=192.168.0.182
NETMASK=255.255.255.0
SLAVE=yes
MASTER=bond0
USERCTL=no


/etc/sysconfig/network-scripts/ifcfg-eth1

DEVICE=eth1
BOOTPROTO=static
ONBOOT=yes
SLAVE=yes
MASTER=bond0
USERCTL=no

Restart networking for your distro, and check status of the bond below, see the output in the screenshots.ย 

cat /proc/net/bonding/bond0

ย 

ip a

I also have bond1 setup for another network, this is the same setup but a different subnet. (bond1)

More To Explore