Setup Network Bonding on Ubuntu 1

How to Setup Network Bonding in Ubuntu

In Ubuntu, you can setup network bonding. Creating multiple LAN connections to create a single network is called Network Bonding. The objective of Network bonding is to increase bandwidth and improve redundancy. In case you don’t know, setting up Network bonding to improve your connection is very easy.

Network bonds work on both physical and virtual ethernet devices. This process also enables the network to avoid a single point of failure as it promotes data redundancy. Thus, it increases fault tolerance too.

In this article, we will cover how you can setup Network bonding in Ubuntu. In addition, this write up will  serve as a guide on how to configure, verify and view bonding logs. 

Advantages of Network Bonding 

Apart from fault tolerance, increased throughput, and improved redundancy, a few other advantages of Network bonding are:

  • Uninterrupted services
  • Faster internet connections and bandwidth
  • Easier to implement
  • Software applications needed to set up Network bonding can be easily downloaded

Network Bonding Types

There are a total of 7 types of bonding modes. Each bonding mode provides a different networking policy and implementation. Let’s take a careful look at each one:

  • balance-rr, mode=0: This mode is based on the Round Robin policy. It activates round robins for fault tolerance and load balancing. 
  • active-backup, mode=1: It is based on the Active-Backup policy and provides fault tolerance.
  • balance-xor, mode=2: This mode performs XOR (exclusive-OR) operations on the source MAC addresses and destination MAC addresses. 
  • broadcast, mode=3: This mode utilizes broadcast policy in its implementation. 
  • 802.3ad, mode=4: It is based on Dynamic-Link Aggregation mode.
  • balance-tlb, mode=5: This mode is based on adaptive transmission load balancing or Transmit Load Balancing (TLB). Specifically, this method determines the distribution of packets depending on the current load of the network node. 
  • balance-alb, mode=6: It is based on Adaptive or Active Load Balancing (ALB). 


For this guide, ensure that you have:

  • Sudo access to the server
  • More than two network interfaces available on Ubuntu

Setup Network Bonding in Ubuntu

In this tutorial, we will set up Network Bonding on the virtual LAN connections. The same process can be applied to the physical LAN connection. So, let’s get started!

1. Update the System

First, update all the packages and repositories to their latest versions. This is a crucial step before installing any new packages. In addition, it also ensures that there is no conflict between the versions of dependent packages. Execute the command given below:

sudo apt update && sudo apt upgrade

The output should look something like this:

Update packages

2. Install the Network Bonding Module on Ubuntu

Second, install the Bonding Module on Ubuntu. It might already exist on your system. Hence, checking if the bonding driver is loaded first is necessary. To check if it is already installed, use the modprobe command. For example: 

sudo modprobe bonding

This command will load all the bonding modules. To verify the bonding module, use the lsmod command. For instance, type: 

sudo lsmod | grep bonding

On the other hand, you will have to install it if it is not available. For this step, use the install command followed by the package name. 

For instance: 

sudo apt install ifenslave

You will get a similar output:

Install packages

Next, enable the autoload. This will automatically activate all the modules on boot. 


echo 'bonding' | sudo tee -a /etc/modules 

3. Configure Network Bonding

There are two types of Network bonding: temporary and permanent. For now, we are configuring temporary bonding. This means the bonding will be lost after the system reboots. 

Create a Temporary Network Bond on Ubuntu

To begin, check the ethernet interfaces on your system with the ip command. For example: 

ip a

You will get a similar output as this:

Setup Network Bonding on Ubuntu 2

From the screenshot above, we can see that there are two ethernet interfaces. Next, ensure that both are disconnected. For this step, use the ifconfig command. For example:

sudo ifconfig enp9s0 down
sudo ifconfig enp10s0 down

After that, create the network bond mode0. 


sudo ip link add bond0 type bond mode 802.3ad

Next, add both the interfaces to it. For this step, use the ip link set command. For example:

sudo ip link set enp9s0 master bond0
sudo ip link set enp10s0 master bond0

Restart the service. Specifically, type:

sudo systemctl restart networking.service

Lastly, verify the bond using the ip link command. Specifically, type: 

sudo ip link

The output should look something like this:

setup network bonding in ubuntu

Finally, you have created a temporary bond successfully. Remember, it will not exist if you reboot the system. 

Create a Permanent Network Bond on Ubuntu

Alternatively, if you want to create a permanent bond, edit the Netplan file. The file exists in the /etc/netplan directory. Open the file using the editor of your choice. For example:

sudo vim /etc/netplan/00-installer-config.yaml

And then, add the following configuration in the installer-config file:

  version: 2
      dhcp4: no
      dhcp4: no
      interfaces: [enp9s0, enp10s0]
      addresses: []
        mode: active-backup
        transmit-hash-policy: layer3+4
        mii-monitor-interval: 1
          - ""
          - ""
setup network bonding in Ubuntu

Save the file and exit the editor. Next, stop both the ethernet interfaces. For this step, execute the commands given below: 

sudo ifconfig enp9s0 down
sudo ifconfig enp10s0 down

After that, restart the network using the reboot command. For example:

sudo reboot.

Lastly, apply the settings as shown below:

sudo netplan apply

Once a permanent bond is created, you can then start the Network bond using the ifconfig command.


sudo ifconfig bond0 up

Also, verify that the bond is running correctly. Use the ifconfig command for this step. Specifically, type: 

sudo ifconfig bond0

You should get a similar output:

setup network bonding on Ubuntu

4. Get Details About the Network Bonding

To get details about the bond interface and display it on the console, use the cat command.


cat /proc/net/bonding/bond0

You can also verify the bond interface using the verify command. For example: 

verify bond0 interface

5. Check Network Bonding Information in Ubuntu

In addition, you can also investigate the other bonding information and generate its log. For this step, type: 

tail -f /var/log/messages

And that’s a wrap! You have covered an in-depth tutorial on how to set up Network bonding in Ubuntu. So now you know how to configure and get information about Network bonding. For more information on Binding and LAN interfaces, check out Linux kernel documentation

We hope the article was useful to you. In case you have any queries, drop them in the comments section. 

If this guide helped you, please share it.

Leave a Reply
Related Posts