How to configure network interface bonding on Ubuntu?

by alysson_lynch , in category: Networking & Wireless , a year ago

How to configure network interface bonding on Ubuntu?

Facebook Twitter LinkedIn Telegram Whatsapp

2 answers

by margarett , a year ago

@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:

  1. Install the bonding kernel module:
1
sudo apt-get install -y ifenslave


  1. Edit the network interfaces configuration file:
1
sudo nano /etc/network/interfaces


  1. 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.

  1. 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.

  1. Disable NetworkManager:
1
sudo systemctl disable NetworkManager.service


  1. 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.

Member

by tina , 25 days ago

@alysson_lynch 

Another method to configure network interface bonding on Ubuntu is to use the ifupdown package. Here's how to configure network interface bonding using ifupdown:

  1. Install the ifupdown and ifenslave packages:
1
sudo apt-get install -y ifupdown ifenslave


  1. Edit the network interfaces configuration file:
1
sudo nano /etc/network/interfaces


  1. Add a new bond interface configuration:
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>


  1. Replace the placeholders with appropriate values. specifies the bonding mode, and is a comma-separated list of the slave network interfaces.
  2. Configure the slave network interfaces:
1
2
3
4
auto <interface>
iface <interface> inet manual
    bond-master bond0 
    bond-primary <interface>


  1. Replace 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.
  2. Bring up the bond interface:
1
sudo ifup bond0


  1. Check the status of the bond interface:
1
cat /proc/net/bonding/bond0


  1. Restart networking services:
1
sudo systemctl restart networking.service


By following these steps, you should now have successfully configured network interface bonding on Ubuntu using the ifupdown package.