The practice of merging different network interfaces into one is known as network bonding or pairing. The main goal of network binding is to enhance performance and capacity while also ensuring network redundancy. Furthermore, network bonding is advantageous where fault allowances are a crucial consideration, such as in load balancing connections. Packages for network bonding are available in the Linux system. Let’s have a look at how to set up a network connection in Ubuntu using the console. Before you start, make sure you have the following items:
- An administrative or master user account
- There are two or more interface adapters available.
Install the bonding module in Ubuntu
We need to install the bonding module first. Hence log in from your system and open the command-line shell quickly by “Ctrl+Alt+T”. Make sure to have the bonding module configured and enabled in your Linux system. To load the bonding module type the below command followed by the user password.
$ sudo modprobe bonding
The bonding has been enabled as per the below query:
$ lsmod | grep bond
If your system has missed the bonding, make sure to install the ifenslave package in your system via the apt package followed by adding the password.
$ sudo apt install ifenslave
Affirm your installation action process by hitting “y” from the typewriter. Otherwise, press “n” to quit the installation.
You can see the system has successfully installed and enabled network bonding on your system as per the below last lines of output.
Temporary Network Bonding
Temporary bonding is only lasting until the next reboot. This means when you reboot or restart your system it fades away. Let’s begin the temporary bonding. First of all, we need to check how many interfaces are available in our system to be bonded. For this purpose, write out the below command in the shell to check it out. Add your account password to proceed. The output below shows that we have two Ethernet interfaces enp0s3 and enp0s8 available in the system.
$ sudo ifconfig
First of all, you need to change the state of both the Ethernet interfaces to “down” using the following commands:
$ sudo ifconfig enp0s3 down $ sudo ifconfig enp0s8 down
Now, you have to make a bond network on master node bond0 via the ip link command as below. Make sure to use bond mode as “82.3ad”.
$ sudo ip link add bond0 type bond mode 802.3ad
After the bond network bond creation, add both the interfaces to the master node as below.
$ sudo ip link set enp0s3 master bond0 $ sudo ip link set enp0s8 master bond0
You can affirm the creation of network bonding using the below query.
$ sudo ip link
Permanent Network Bonding
If somebody wants to make a permanent networking bonding, they have to make changes to the configuration file of network interfaces. Hence, open the file in GNU nano editor as below.
$ sudo nano /etc/network/interfaces
Now update the file with the below following configuration. Make sure to add bond_mode as 4 or 0. Save the file and quit it.
To enable the network bond, we need to change the states of both slaves interfaces to down and change the state of the master node to up, using the below query.
$ sudo ifconfig enp0s3 down && sudo ifconfig enp0s8 down & sudo ifconfig bond0 up
Now restart the network service using the below systemctl command.
$ sudo systemctl restart networking.service
You can also use the below command instead of the above command.
$ sudo systemctl restart network-manager.service
Now you can confirm whether the master interface has been “up” or not using the below query:
$ sudo ifconfig bond0
You can check out the status of a newly created network bond that has been created successfully by utilizing the below query.
$ sudo cat /proc/net/bonding/bond0
This article explains how to combine several network interfaces into a single platform using the Linux bridging package. Hope you got no issues while implementation.