This Blog is to share our knowledge and expertise on Linux System Administration and VMware Administration

Sunday, December 9, 2018

How to setup and configure Network Teaming on RHEL 7 server

Sunday, December 09, 2018 0
Here we are using nmcli to configure the network teaming. 

nmtui : Text user Interface
nmcli : Command line Interface
Teaming type : loadbalance
Interface         : team0, eth0, eth2

teamd package should be installed on server.

We can see the previous network configuration setup by using nmcli command.

root@nsk# nmcli con show
NAME  UUID                                                            TYPE      DEVICE
eth0     5fb06bd0-0bb0-7ffb-45f1-d6edd65f3e03     ethernet    eth0
eth1     8761e75a-0ba3-4f73-80e4-66df47023ed1  ethernet    eth1

Teaming configuration

Execute the below command on server to create team0 teaming interface.

root@nsk# nmcli con add type team con-name team0 ifname team0 config '{ "runner": {"name": "loadbalance"}}'
Connection 'team0' (e07596d2-59b6-406a-a742-07d5ff96901b) successfully added.

root@nsk# nmcli con show
NAME   UUID                                                              TYPE      DEVICE
eth0     5fb06bd0-0bb0-7ffb-45f1-d6edd65f3e03        ethernet    eth0
eth1     8761e75a-0ba3-4f73-80e4-66df47023ed1     ethernet    eth1
team0  e07596d2-59b6-406a-a742-07d5ff96901b     team         team0

Now, /etc/sysconfig/network-scripts/team0 contains below lines

root@nsk# cat ifcfg-team0
TEAM_CONFIG="{\"runner\": {\"name\": \"loadbalance\", \"tx_hash\": [\"eth\", \"ipv4\", \"ipv6\"]}}"
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=dhcp
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=team0
UUID=e07596d2-59b6-406a-a742-07d5ff96901b
DEVICE=team0
ONBOOT=yes
DEVICETYPE=Team

Now add IPv4 address on team0 interface.

root@nsk# nmcli con mod team0 ipv4.addresses 172.27.0.169/28
root@nsk# nmcli con mod team0 ipv4.gateway 172.27.0.161
root@nsk# nmcli con mod team0 ipv4.method manual

Add eth0 interface to the teaming interface.

root@nsk# nmcli con add type team-slave con-name team0-slave0 ifname eth0 master team0
Connection 'team0-slave0' (5fa33d1b-3f25-4fda-b10d-a184e4260cbe) successfully added.

Add eth2 interface to the teaming interface.

root@nsk# nmcli con add type team-slave con-name team0-slave1 ifname eth2 master team0
Connection 'team0-slave1' (bbdb784b-2a9c-4fe3-9a19-11d64a9748ff) successfully added.

root@nsk# ls -al | grep -i team0

ifcfg-team0  
ifcfg-team0-slave0  
ifcfg-team0-slave1

Now bring up the team0 interface.

root@nsk# nmcli connection up team0
Connection successfully activated (master waiting for slaves) (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/11)

root@nsk# teamdctl team0 state
setup:
  runner: loadbalance

root@nsk# /etc/init.d/network restart
Restarting network (via systemctl):                        [  OK  ]

root@nsk# ifconfig | egrep -i "eth0|eth2|team0"

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        ether b0:83:fe:d8:44:02  txqueuelen 1000  (Ethernet)
        RX packets 2930895882  bytes 2216873481505 (2.0 TiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 1694125755  bytes 312320131645 (290.8 GiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device interrupt 56

eth2: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        ether b0:83:fe:d8:44:02  txqueuelen 1000  (Ethernet)
        RX packets 2705861  bytes 301266106 (287.3 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 25  bytes 4159 (4.0 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device interrupt 59

team0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 172.27.0.169  netmask 255.255.255.240  broadcast 172.27.0.175
        inet6 fe80::bbe8:90aa:4108:e728  prefixlen 64  scopeid 0x20<link>
        ether b0:83:fe:d8:44:02  txqueuelen 1000  (Ethernet)
        RX packets 35  bytes 2586 (2.5 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 28  bytes 4451 (4.3 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

Check the configuration

root@nsk# nmcli con reload
root@nsk# nmcli con show
NAME                 UUID                                                             TYPE      DEVICE
eth1                    8761e75a-0ba3-4f73-80e4-66df47023ed1   ethernet    eth1
team0                 e07596d2-59b6-406a-a742-07d5ff96901b   team         team0
team0-slave0     5fa33d1b-3f25-4fda-b10d-a184e4260cbe     ethernet    eth0
team0-slave1     bbdb784b-2a9c-4fe3-9a19-11d64a9748ff     ethernet    eth2

Check the team0 ports status

root@nsk# teamnl team0 ports
 4: eth2: up 1000Mbit FD
 2: eth0: up 1000Mbit FD

We can use teamdctl command to check team0 configuration status.

root@nsk# teamdctl team0 state
setup:
  runner: loadbalance
ports:
  eth0
    link watches:
      link summary: up
      instance[link_watch_0]:
        name: ethtool
        link: up
        down count: 0
  eth2
    link watches:
      link summary: up
      instance[link_watch_0]:
        name: ethtool
        link: up
        down count: 0
root@nsk#

Note : If we need Activebackup setup, just replace the loadbalance with activebackup while creating team0 interface.