RHEL7 how to configure NIC Teaming as Active Backup (Failover)

The Linux NIC teaming driver provides a method for aggregating multiple network interfaces into a single “Team” interface. The behavior of the team interfaces depends upon the runner configuration. Generally teaming supports below methods.

NIC Teaming will support

  1. Round robin NIC Teaming 
  2. Load balancing NIC Teaming
  3. Fail-over NIC Teaming 
  4. Broadcast NIC Teaming

Naming convention of Red Hat Enterprise Linux as, On board LAN card naming em0, em1…..etc.  Additional LAN card naming if it is a 4 port NIC card p1p1, p1p2, p1p3 and p1p4 (p1 = Slot1 p1-4=Port)

The key reasons why you might want to use teaming rather than bonding are

  • Teaming has a small kernel module which implements fast handling of packets flowing through your teamed interfaces
  • support for IPv6 (NS/NA) link monitoring
  • Capable of working with D-Bus and Unix Domain Sockets (the default)
  • It provides an extensible and scale-able solution for your teaming requirements
  • load balancing for LACP support
  • It makes use of NetworkManager and its associates tools (the modern way) to manage your network connections

This article will provide a guide to configure NIC teaming in RHEL7.

NIC Teaming as Active Backup will provide you redundancy in case of any one of NIC is failed still end user can access services from server. We also call it has Fail-Over mechanism.

RHEL7 how to configure NIC Teaming as Active Backup (Failover)

Required two NIC cards to configure NIC teaming.

Devices status as mentioned below

[root@Techtutorial ~]# nmcli connection show
NAME  UUID  TYPE  DEVICE 
[root@Techtutorial ~]# nmcli device status 
DEVICE  TYPE      STATE         CONNECTION 
ens33   ethernet  disconnected  --         
ens36   ethernet  disconnected  --6

Creating teaming virtual interface

First we will create an master virtual teaming interface the we have to add other NIC cards as a slaves to teaming master. nmcli is the utility we have to use.

[root@Techtutorial ~]# nmcli connection add type team con-name team0 ifname team0 config '{"runner": {"name": "activebackup"}}'
Connection 'team0' (28a9e70b-8a8f-4354-a4ec-5cfac6577589) successfully added.
[root@Techtutorial ~]# nmcli connection show 
NAME   UUID                                  TYPE  DEVICE 
team0  28a9e70b-8a8f-4354-a4ec-5cfac6577589  team  team0

Provide IP address to team0 virtual interface

Now we have to configure an IP address, Gateway and DNS to team0 interface to communicate and add slave interface to team0

[root@Techtutorial ~]# nmcli connection modify team0 ipv4.addresses 192.168.4.50/24 ipv4.gateway 192.168.4.2 ipv4.dns 8.8.8.8 connection.autoconnect yes ipv4.method manual

Add slave interfaces to Master team interface

[root@Techtutorial ~]# nmcli connection add type team-slave con-name team0-port1 ifname ens33 master team0 
Connection 'team0-port1' (8ca9c28b-bbbc-458f-94fa-56b2f607864f) successfully added.
[root@Techtutorial ~]# nmcli connection add type team-slave con-name team0-port2 ifname ens36 master team0 
Connection 'team0-port2' (6e57d69e-44d3-4d12-8e6d-dc6e70189800) successfully added

team0 master interface is created and added slave interfaces to master.

Verifying Master and Slave interfaces

[root@Techtutorial ~]# nmcli connection show 
NAME         UUID                                  TYPE            DEVICE 
team0-port2  6e57d69e-44d3-4d12-8e6d-dc6e70189800  802-3-ethernet  ens36  
team0-port1  8ca9c28b-bbbc-458f-94fa-56b2f607864f  802-3-ethernet  ens33  
team0        28a9e70b-8a8f-4354-a4ec-5cfac6577589  team            team0  
[root@Techtutorial ~]# nmcli device status
DEVICE  TYPE      STATE         CONNECTION  
ens33   ethernet  connected     team0-port1 
ens36   ethernet  connected     team0-port2 
team0   team      connected     team0

Activate teaming interface

[root@Techtutorial ~]# nmcli connection down team0
Connection 'team0' successfully deactivated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/0)

[root@Techtutorial ~]# nmcli connection up team0
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/4)

Check functionality of Active-Backup Teaming

We can check active and backup teaming functionality using below command. NIC Teaming

[root@Techtutorial ~]# teamdctl team0 state
setup:
  runner: activebackup
ports:
  ens33
    link watches:
      link summary: up
      instance[link_watch_0]:
        name: ethtool
        link: up
  ens36
    link watches:
      link summary: up
      instance[link_watch_0]:
        name: ethtool
        link: up
runner:
  active port: ens33

as shown above active port is ens33. Now bring down the ens33 and see

[root@Techtutorial ~]# nmcli device disconnect ens33
Device 'ens33' successfully disconnected.
[root@Techtutorial ~]# teamdctl team0 state
setup:
  runner: activebackup
ports:
  ens36
    link watches:
      link summary: up
      instance[link_watch_0]:
        name: ethtool
        link: up
runner:
  active port: ens36

as soon as we disconnect / bring down one NIC card other backup NIC will activate automatically with in Milli seconds.

That’s it..!! NIC Teaming with active backup runner configured and working.

Please provide your review on the same.

Related Articles

tmpwatch Command Linux

Recover Deleted Files RHEL 6

Linux Interview Questions and Answers

Thanks for your wonderful Support and Encouragement

Ravi Kumar Ankam

My Name is ARK. Expert in grasping any new technology, Interested in Sharing the knowledge. Learn more & Earn More

2 Responses

  1. Hello. I noticed a serious problem that needs your attention: How to configure automatic recovery of a failed port in RHEL7.0 teaming ? I successfully configured teaming by following the above procedure, in a RHEL 7.0 server. The failover from port1 to port2 (from main to backup) was also successful by just applying the commands mentioned in your procedure, but when I tried to failover again from port2 to port1 (from backup to main), it was not possible. I found port1 still in a failed state and I had to recover it up manually. This is a big problem because if the backup also fails, the network will remain in a failed state and never recovers. So is there a solution to this problem: a command to (try to) immediately recover (stimulate) a failed port after a failover, so that it becomes soon ready to switch back to main (active) again if/when necessary. This means the config must always try keeping both ports UP so that failover never fails. Thanks.

  2. blank Julie says:

    BIG thank you for these perfect tutorial !!!

Leave a Reply

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