Network bonding is a procedure through which you can combine multiple network interfaces into a single one. In this way, you can gain a network interface that has intensified output and superfluity. Additionally, it has an increased bandwidth that you can change in accordance with your needs. It is a convenient instrument for you if you’re in the networking industry. In this blog, we will continue the topic of Network bonding and discuss ‘How to Setup Network Bonding in Ubuntu?’.

Network Bonding produces a reliable interface. It will protect the network from any possible data loss resulting in the optimal balancing of loads. For example, loss of data because there is a fault in cables. With the help of this blog ‘How to Setup Network Bonding in Ubuntu?’, you’ll easily be able to combine interfaces through network bonding.

Also Read: Install MongoDB in Ubuntu: Everything you need

Modes of Network Bonding

Let’s know about the various modes of Network bonding so that you can transfer data. However, you can do so by utilizing various policies for the execution.

  • Mode_0: This is a default mode that will complete the task in most cases. It will fulfill the job via Round-robin scheduling. It means the information is being transferred in form of packets constantly (beginning from the first and finishing at the last interface of the bonded network.)
  • Mode_1: This mode makes use of the Active Backup policy, i.e., one interface runs concurrently. When this interface fails then a different one will activate. Users don’t prefer this mode in relation to load balancing.
  • Mode_2: This mode of network bonding follows the XOR policy. It executes the XOR operation between the base(source) and the MAC addresses (destinations).
  • Mode_3: This mode makes use of the Broadcast policy. This means that packets are transferred to all bond network interfaces. Users utilize it in some cases that provide fault tolerance.
  • Mode_4: This mode touches on IEEE 802.3ad. It collects interfaces into groups that have equal speeds. Transmit hashing regulates the interface for throughput.
  • Mode_5: In this mode, Adaptive Transmission Load Balancing is used. It means that the distribution of outgoing packets is governed according to the current load on each interface.
  • Mode_6: Lastly, this mode makes use of the balance-TLB and Receive Load Balancing (rlb). In return, it uses ARP negotiation. You can use this method to deal with IPV4 traffic. Please note that there is no switch support available in this mode.

How to Setup Network Bonding in Ubuntu?

Now that we have understood the modes of Network bonding, let’s move on to the main topic of ‘How to Setup Network Bonding in Ubuntu?’

1. Checking and Installing the Bonding Module

Firstly, you have to ensure that the bonding module is installed in your Linux distribution. If it is not then you have to install it by using the terminal. In this way, there will be no need to follow the unnecessary process of trying to install the bonding module. You can use Command-Line Input(CLI) to check for the module with the help of the $ lsmod command. 

Please note that network bonding can be set up only in case you are a root user. Additionally, you will require multiple network interfaces for this to work. Follow the steps given below to verify the installation of the module on your Linux distribution:

  • Firstly, navigate to the terminal by pressing Ctrl + Alt + T on your keyboard.
  • Secondly, you have to type in the following command:
$ sudo lsmod | grep bonding

You have to type the following command in case the module is not installed:

$ sudo apt-get install ifenslave
  • Thirdly, you can Load the module with the help of the following command:
$ sudo modprobe bonding

The bonding module will successfully load now on your Linux distribution.

2. Set up a Bond Interface

You can set up a bond interface in two ways. The difference between the two methods is the duration of the new network interface. One will create a temporary (ephemeral) network bond. On the other hand, the other one will create a more permanent solution. The following steps will create the temporary bonding:

  • Firstly, press Ctrl + Alt + T to reach the terminal.
  • Secondly, type the following command:
$ sudo ipconfig

There are some cases when ipconfig doesn’t work. You can try the following command then:

$ sudo ip a

Now all the interfaces will be available.

How to Setup Network Bonding in Ubuntu
  • You can create a network bond by using the command given below. You have to use the names of the network interfaces that need to be bonded.
$ sudo ifconfig lo down
$ sudo ifconfig enp0s3 down
$ sudo ip link add bond0 type bond mode 802.3ad
  • Follow this command to combine both interfaces.
$ sudo ip link set lo master bond0
$ sudo ip link set enp0s3 master bond0

If you have followed all the above-mentioned steps correctly then a new bond interface is available now. But please remember that the bond interface will expire after restarting your system.

Permanent bond interface

  • Firstly, navigate to the terminal and type the command given below:
$sudo nano /etc/network/interfaces

You have the option to replace nano with any text editor, for example, gedit.

  • Secondly, you have to type the following text in the new file that will open:
auto bond0
iface bond inet static
dns-search domain-name.local
slaves lo enp0s3
bond_mode 4
bond-miimon 100
bond-downdelay 0
bond-updelay 0
How to Setup Network Bonding in Ubuntu
  • After doing so, follow the command given below:
$ sudo ifconfig lo down && sudo ifconfig enp0s3 down & sudo ifconfig bond0 up
$ sudo service restart network-manager

In this way, your new bond interface will be enabled.

  • Please ensure that the interface keeps running by using the following command:
$ sudo ipconfig bond0

If the above one doesn’t work then use the following command:

$ sudo ip a

The above steps will successfully create a permanent bond interface. You can know the workings of your network bond by using the following command:

$ sudo cat proc/net/bonding/bond0

Conclusion on ‘How to Setup Network Bonding in Ubuntu?’

We hope that you understood ‘How to Setup Network Bonding in Ubuntu.’ This blog also includes extra information on its modes that will help you in understanding the topic better. Now you can easily Setup Network bonding in Ubuntu on your own. Thank you for reading our blog!

Tagged in:

, ,