Open In App

Interface (NICs) Bonding in Linux using nmcli

Last Updated : 30 Jan, 2023
Improve
Improve
Like Article
Like
Save
Share
Report

A network interface card (NIC) is a hardware component that connects computers over a network. This is a circuit board attached to your computer that provides a dedicated network connection for your computer. Also called a network interface controller, network adapter, or LAN adapter. A NIC provides a computer with a dedicated, permanent connection to a network. Implements the physical layer circuitry required to communicate using data link layer standards such as Ethernet.

Interface(NICs)

(NIC) Network Interface Cards are a useful technique for configuring groupings of physical network users to improve the performance and redundancy of network systems.

NIC Bonding 

In the Linux operating system, NIC bonding refers to the process of combining multiple network interfaces into a single logical “connected” interface. That is, two or more NICs are combined and connected to function as one. Note that one of the requirements for configuring bonding is to have a network switch that supports EtherChannel (almost all switches do).

NICs Bonding Modes 

The Characteristics of the bonded NICs come under the type of bonding modes adopted, so generally, we specify two and three modes of the object of the bonding NICs.

  • Mode=0 (Round-robin) It’s a kind of default mode. In round-robin mode, packets are sent and received in order from the first available slave to his last slave.
  • Mode=1 (Active-backup) – So that Only one slave is active while another is sleeping. This standby NIC becomes active when the active NIC fails. Assuming there are N* interfaces, the resource utilization is 1/N.
  • Mode=2 XOR(exclusive-or) – By this mode, XOR the source and destination MAC addresses are multiplied by the modulo port interface number.
  • Mode=3 (Broadcast) – So in this mode, all packets are sent to all slave interfaces at the expense of resource usage. Usually used for a specific purpose. B. The financial industry requires a highly reliable network etc. 

So in this article for creating the Interface(NICs) basically we will use the mode=1 active-backup 

Note: One NICs Bonding interface can only specify one mode at a time.

NICs Using nmcli 

So, as we know that nmcli is a widely used Linux command to create Interface(NICs). In Linux, the nmcli is a command line that is mostly used for controlling (maintaining) the Network Manager. nmcli command is also used to display the network devices.

Block Diagram of Interface(NICs) 

figure- Network Interface Configuration

figure- Network Interface Configuration

Interface (NICs) Bonding Stepwise Implementation 

Before beginning, you must first install the VirtualBox or VMware and configure the virtual machines following.

  • CentOS7 Linux.
  • Windows Virtual Machine

So In this article to Perform the ” Interface (NICs) Bonding in Linux using nmcli “ we use the Linux distribution CentOS7 Linux. that’s why we said to download CentOS7.

Creating Team Interface 

Step 1:  Logged as root server via ssh

So firstly we have to open our Linux CentOS7 terminal, and logged in to the server via SSH console as user root. using the following line of command.

$ ssh root@ipAddress

 

Step 2: Check the status of nmcli

So now in this step, we will check the nmcli device status in our CentOS7 like what the network ethernet connections are pre-introduced with the following command line.

# nmcli device status

 

As you can see in the device status system, there is a type of ethernet, bridge, and loopback connected.

Step 3:Create and connect the NICs configure as team0

All we have to do now is add a connection and create a type as a team. This is called NICs Bonding. Then enter the connection name as team0 in the following command line to get the IP configuration.

# nmcli connection add type team con-name team0 ifname team0 config ‘{“runner”: {“name” :”activebackup”}}’

 

So you can see that our mode=1 active-backup connection team0 is connected successfully added.

Step 4: Check nmcli device status 

Now, we check the nmcli device status. using the step 2 command, whether it is added or not.

 

Assigning IP Address 

Step 5: Now we will assign an ipv4 version IP Address for that interface using the following line of command.

# nmcli connection modify team0 ipv4.addresses 192.168.5.100/24 ipv4.method manual

 

Step 6:  Connect nmcli device team0

So, our IP Address is assigned now we will connect this IP Address and check the nmcli device status with the following command line.

# nmcli device connect team0
# nmcli device status

 

In the above output image, you can see the state of NICs team0 connected successfully.

Adding Slave Devices –

Step 7: Add connection team two slave devices using nmcli

Now we will be adding two slaves devices for team0 backing the physical LAN card. Failure of either of these two will not bring down the network. If Slave1 fails, Slave2 can be used. with the following command line.

# nmcli connection add type team-slave con-name team0-slave1 ifname eth1 master team0

 

# nmcli connection add type team-slave con-name team0-slave2 ifname eth2 master team0

 

Step 8: Now present the Interface(NICs) connection team0

Now we will check like our added Interface(NICs) is working or not, therefore we use the team0 to show. using the following line of command.

# nmcli connection show team0

 

All the kinds of connections are showing here and others are also there, which means it is working fine.

Step 9: Ping assigned eth IP Address

In this step, we will check the network connection. All, we need to do is shut down one ethernet and ping the second ethernet with the following command line.

 # ping 192.168.5.100

 

Step 10: Check Interface(NICs) team0 state

So this is the final step here we will check the state of team0 NICs Bonding with the following line of command.

# teamdctl team0 state

 

Conclusion 

So successfully our Interface(NICs) Bonding team0 mode=1 active-backup is created, above all the steps for creating Interfacing the NICs Bonding in Linux. Interface NIC offers an excellent and very suitable solution for network redundancy. Here we choose a CentOS7 Linux distribution, you can choose any other Linux yourself which supports nmcli. 



Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads