Linux

How to Create NIC Teaming or Bonding in CentOS / RHEL

In this article will discuss about How to Create NIC Teaming or Bonding in CentOS / RHEL Machine.

Port Trunking, Channel Bonding, Link Aggregation, NIC teaming, and other terms are used to describe network interface bonding.

Multiple network connections are combined or aggregated into a single channel bonding interface. This enables two or more network interfaces to function as one, increasing throughput while also providing redundancy or failover.

Before going to start How to Create NIC Teaming or Bonding in CentOS / RHEL topic, we need to understand a concept called “connections“.

 

Create NIC Teaming or Bonding in CentOS / RHEL Machine:

Below machine is running on RHEL/CENTOS contains an Ethernet Adapter called ens160.Every adapter has one configuration file (ls /etc/sysconfig/network-scripts/) to assign IP Address. Below image contains adapter and configuration file.

 

Interface for RHEL/CENTOS machine
                                                                                                                          

Root Rhel
                                                                             ifcfg-ens160 called configuration file

 

If you want to use more than one IPaddress for single adapter without changing configuration file, it is possible with “Profiles“. example – we can use one profile for office work (or) one profile work for home (or) one profile for datacenter connection etc.

Three interfaces
                                                                                                               Single Adapter with Multiple connections

 

The above picture shows 3 profiles, and each profile is called a connection. you can make many connections as you need, but only one connection is active at a time.

Suppose first connection is active ifcfg-ens:192.168.85.5 remaining connections will be in an inactive state. The Moment you activate the second connection ifcfg-office:192.168.85.6 automatically the previous connection (ifcfg-ens160 : 192.168.85.5) will be de-active and your adapter start showing 192.168.85.6 IP address.

Same way if you activate 3rd connection automatically second connection will be de-active, and your adapter will show 3rd IP address.

 

 Assign the Connections:

To deal with connections we have a command from CENTOS/RHEL7 onwards called nmcli [ Network Manager Command-Line Interface]. It will define which particular adapter is using which connection as a result of what IP address is being used.

 

How to Create NIC Teaming or Bonding in CentOS / RHEL

run nmcli con show ens160 it will show features of ens160 connection.

 

 Configuring NIC Teaming or Bonding in CentOS / RHEL:

Name called mycon this connection is attached to ens160 also the type of connection is ethernet. IPaddress type is manual for IPv4 with Classless inter-domain routing (CIDR) Block and gateway with autoconnection is no.

How to Create NIC Teaming or Bonding in CentOS / RHEL
New connection is created with mycon

 

The new connection is created mycon and it is inactive state. we can find mycon configuration file as shown in below image.

IFCFG-MYCON
                                                                     mycon configuration file

 

Now will activate mycon connection, so the adapter shifts IPaddress to 192.168.85.6 by using nmcli con up mycon it will activate mycon.

NMCLI CON UP MYCON

nmcli command

                   

If you want to revert back to the previous IP address just activate it, by using nmcli con up ens160 , automatically mycon will goes into de-active mode and ens160 will starts working.

Basically, we will use a single adapter for a single IPaddress, incase if it fails there will be an impact. To avoid this will use high availability by using two adapters. you can below image. There are 2 adapter we will combine to form a virtual adapter. This virtual adapter called as BOND adapter till RHEL6 from RHEL7 on wards we can call it as TEAM adapter.

Comparison of NETWORK TEAMING and BONDING info.

Components of Teaming:

  • Teamd : It is a service must be running in order to work for teaming.
  • Teamdctl : It is a command use to check Statics of TEAM.
  • Runners: Method that defines what type of teaming we are using. It contains 3modes. Round-robin, Load balance and active-backup.

 

Enabling NIC Teaming

Step1:

I have 3 NIC adapter,in that ens160 is currently in use and rest of two are not configured. lets apply TEAMING concept for those 2 adapters(ens224 and ens256). Here teamA is the name of the TEAMING.

 

Creating a NIC team adapter or Bonding in CentOS / RHEL
                                                    Configured Team and Slaves

 

Step2:

Assign IPaddress to teamA and activate teamA connection.

 

Assign IPaddress to teamA and activate teamA connection.
                                                            Activated teamA adapter.

 

Step3:

lets ping teamA IPaddress 192.168.85.30 and also check status of TEAM by using this IPaddress will be expose to end users.

Create NIC Teaming or Bonding in CentOS / RHEL
                                                                            Active adapter is ens224.

 

Now deactivated ens224 adapter and check activebackup working functionality.

Now deactivated ens224 adapter
                                                               

 

it disconnected and within a moment it’s get working using another adapter. Now check which adapter it is using as shown below.

 

Active Port: ens256
                                                                                                  it started using ens256.

 

 

Step 4: we can disconnect ens256 and check again the functionality.

nmcli dev disconnects ens256 and starts ping with IP address as shown in the above steps.

 

NOTE: Observer that as soon as ens224 adapter failed, ens256 adapter takes place and starts working as usual.

 

Conclusion:

How to Create NIC Teaming or Bonding in CentOS / RHEL procedure plays a vital role in the load balancer.

Thanks for your time, leave a comment if you have any queries about How to Create NIC Teaming or Bonding in CentOS / RHEL.

Additional information about lost or forgotten root passwords in Linux machines.

 

Next PostHow to Manually Import Updates into WSUS Previous PostWSUS Connection Error Reset Server Node

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *