Thursday, June 2, 2016

[Quick Tips: NIS Teaming]: RHEL7 how to configure NIC Teaming as Active Backup (Failover)

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
  2. Load balancing
  3. Fail-over
  4. Broadcast
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 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
[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.

No comments: