@alysson_lynch
Network interface bonding, or teaming multiple network interfaces, can improve network throughput and fault tolerance. Here's how to configure network interface bonding on Ubuntu:
- Install the bonding kernel module:
1
|
sudo apt-get install -y ifenslave
|
- Edit the network interfaces configuration file:
1
|
sudo nano /etc/network/interfaces
|
- Add a new bond interface:
1
2
3
4
5
6
7
|
auto bond0
iface bond0 inet static
address <IP address>
netmask <netmask>
gateway <gateway>
bond_mode <mode>
bond_slaves <interfaces>
|
Change the <IP address>
, <netmask>
, and <gateway>
values to match your network settings. <mode>
specifies the bonding mode, which can be balance-rr
, active-backup
, balance-xor
, broadcast
, 802.3ad
, balance-tlb
, or balance-alb
. <interfaces>
is a comma-separated list of the slave network interfaces that will be bonded, such as eth0,eth1
.
- Configure the slave network interfaces:
1
2
3
4
|
auto <interface>
iface <interface> inet manual
bond-master bond0
bond-primary <interface>
|
Replace <interface>
with the name of the network interface, such as eth0
or eth1
. The inet manual
configuration means that the interface will not be configured with an IP address, and will instead be controlled by the bond interface. bond-master bond0
specifies that the interface is a slave of the bond interface named bond0
, and bond-primary <interface>
specifies that this interface is the primary interface for the bond.
- Disable NetworkManager:
1
|
sudo systemctl disable NetworkManager.service
|
- Restart the network service:
1
|
sudo systemctl restart networking.service
|
Network interface bonding should now be configured on Ubuntu. Test the bond interface by pinging another device on the network and checking the bond interface status with cat /proc/net/bonding/bond0
.