Saturday, December 28, 2019

Network Teaming in RHEL7 and Cent OS 7

Network Teaming is the method of linking NICs together logically to allow for failover or Higher throughput.
Teaming is the new implementation that doesn't affect the older bonding driver in the Linux kernel, It offers alternate method.
RHEL 7 supports channel bonding for backward comparability. Network Teaming provides better performance and is extensible because of its modular design,

RHEL 7 implement network teaming with small kernel driver and a user space daemon, teamd.

The Kernel handles network packets efficiently and teamd handles logic and interface processing.Software called runner, implements load balancing and active-backup logic, such as roundrobin.

The following runner are available to teamd.
broadcast: a simple runner which transmits each packet from all ports
roundrobin: a simple runner which transmits each packets in roub-robin fashion from each of the ports
activebackup: This is failover runner which watches for link changes and selects an active port for data transfers.
loadbalance: This runner monitor traffic and uses a hash function to try to reach a perfect balance when selecting ports for packet transmission.
lacp: implements the 802.3ad link Aggregation control protocol. can use the same transmit port selection possibilities as loadbalance runner.

All network interaction is done through a team interface, composed of multiple network port interfaces.When controlling teamed port interface using Network Manager, and especially when fault finding, keep the following in mind:


  • Starting the network team interface does not automatically start the port interfaces.
  • Starting a port interface always starts the teamed interface.
  • Stopping the teamed interface also stops the port interfaces.
  • A teamed interface without ports can start static IP connections.
  • A team without ports waits for ports when starting DHCP connection.
  • A team with a DHCP connection waiting for ports completes when a port with a carrier is added.
  • A team with a DHCP connection waiting for ports continues waiting when a port without a carrier is added.
Configuring Network Teams
The nmcli command can be used to create and manage team and port interfaces. The following four steps are used to create and activate a network team interface:
  1. Create the team interface
  2. Determine the IPv4 and/or IPv6 attributes of the team interface.
  3. Assign the port interfaces
  4. Bring the team and port interfaces up/down.

Create the team interface
Use the nmcli command to create a connection for the network team interface. with the following syntax
nmcli con add type team con-name CNAME ifname INAME [ config JSON]
CNAME - Connection Name
INAME - Interface Name
JSON - Specifies the runner to be used


'{"runner":{"name": "METHOD"}}'
METHOD: one of the following broadcast, roundrobin, activebackup, loadbalance or lacp

Example
[root@server1 ~]# nmcli con add type team con-name team0 ifname team0 config '{"runner":{"name": "loadbalance"}}'




Determine the IPv4 and/or IPv6 attributes of the team interface.


Once the team interface is created, IPv4 and /or IPv6 attribute can be assigned to it. If DHCP is available, this step is optional, because the default attributes configure the interface to get it IP setting using DHCP.

The following example demonstrates how to assign a static IPv4 address ti the team0 interface:
[root@server1 ~]# nmcli con mod team0 ipv4.addresses 1.2.3.4/24
[root@server1 ~]# nmcli con mod team0 ipv4.method manual

Note: The ipv4.addresses have to be assinged before the ipv4.method can be set to manual

Assign the port interfaces
Use the nmcli command to create each of the port interfaces with the following syntax:
nmcli con add type team-slave con-name CNAME ifname INAME master TEAM
the connection name can be explicitly specified, or it will be team-slave-IFACE by fedault.

[root@server1 ~]# nmcli con add type team-slave ifname eth1  master team0
[root@server1 ~]# nmcli con add type team-slave ifname eth2  master team0 con-name team0-eth2

Bring the team and port interface up/down
nmcli command can also be used to manage the connections for the team and port interfaces wiht the following syntax:

nmcli dev dis INAME
nmcli con up CNAME

INAME -  Device name of the team or port interface to be managed
CNAME - Connection name of the interface, Where CNAME is the connection name of the team or port interface to be managed.

Example:
[root@server1 ~]# nmcli con up team0
[root@server1 ~]# nmcli dev dis eth2

When the team interface is up, the teamctl command be used to display the team's state.
[root@server1 ~]# teamdctl team0 state
setup:
  runner: activebackup
ports:
  ens38
    link watches:
      link summary: up
      instance[link_watch_0]:
        name: ethtool
        link: up
        down count: 0
  ens33
    link watches:
      link summary: up
      instance[link_watch_0]:
        name: ethtool
        link: up
        down count: 0
runner:
  active port: ens38

Summary
Creating Team interface
nmcli  connection add type team con-name team0 ifname team0 config '{"runner": {"name": "activebackup"}}'

Adding IPv4 attribute
nmcli connection mod team0 ipv4.addresses "192.168.219.10/24"
nmcli con mod team0 ipv4.method manual

Adding port Interface
nmcli connection add type team-slave con-name team0-port1 ifname ens38 master team0
nmcli connection add type team-slave con-name team0-port2 ifname ens33 master team0

Bringing the team and port interface up
nmcli connection up team0

Checking the status
teamdctl team0 state

[root@server1 ~]# nmcli connection show
NAME         UUID                                  TYPE            DEVICE
team0        8eb1132a-abe5-4ef8-ab48-f834ad8f0434  team            team0
team0-port1  511c3215-603a-4d23-9a94-b58a7455d143  802-3-ethernet  ens38
team0-port2  198ca207-c7f7-4802-acd1-404819aeab98  802-3-ethernet  ens33

[root@server1 ~]# teamdctl team0 config dump
{
    "device": "team0",
    "mcast_rejoin": {
        "count": 1
    },
    "notify_peers": {
        "count": 1
    },
    "ports": {
        "ens33": {
            "link_watch": {
                "name": "ethtool"
            }
        },
        "ens38": {
            "link_watch": {
                "name": "ethtool"
            }
        }
    },
    "runner": {
        "name": "activebackup"
    }
}



No comments: