How to Manage (troubleshoot) Network Teaming in CentOS/RHEL 7

In the last post, we have seen how to configure the network teaming in CentOS/RHEL 7. In this post, we will see the basics about troubleshooting and changing the configuration of a team interface.

Network Teaming Configuration Files

NetworkManager creates configuration files for network teaming in the /etc/sysconfig/network-scripts the same way it does for other interfaces. A configuration file is created for each of the interfaces: for the team, and each of the ports.

The configuration file for the team interface defines the IP settings for the interface. The DEVICETYPE variable informs the initialization scripts this is a network team interface. Parameters for teamd configuration are defined in the TEAM_CONFIG variable. Note that the contents of TEAM_CONFIG uses JSON syntax.

# /etc/sysconfig/network-scripts/ifcfg-team0
DEVICE=team0
DEVICETYPE=Team
TEAM_CONFIG="{\"runner\": {\"name\": \"broadcast\"}}"
BOOTPROTO=none
IPADDR0=172.25.5.100
PREFIX0=24
NAME=team0
ONBOOT=yes

The following is an example configuration file for a team port interface.

# /etc/sysconfig/network-scripts/ifcfg-team0-eth1
DEVICE=eth1
DEVICETYPE=TeamPort
TEAM_MASTER=team0
NAME=team0-eth1
ONBOOT=yes

The DEVICETYPE variable informs the initialization scripts this is a team port interface. The TEAM_MASTER variable defines which team device it is a port for.

Setting and Adjusting Team Configuration

Initial network team configuration is set when the team interface is created. The default runner is roundrobin, but a different runner can be chosen by specifying a JSON string when the team is created with the team.config subcommand. Default values for runner parameters are used when they are not specified.

A different runner can be assigned to an existing team, or runner parameters can be adjusted using the nmcli con mod command. The configuration changes can be specified as a JSON string (in the case of simple changes) or the name of a file with a more complex JSON configuration can be given.

# nmcli con mod IFACE team.config JSON-configuration-file-or-string

The following example shows how to assign different priorities to port interfaces in an activebackup team:

# cat /tmp/team.conf
{
      "device": "team0",
      "mcast_rejoin": {
        "count": 1
    },
    "notify_peers": {
        "count": 1
    },
    "ports": {
        "eth1": {
     "prio": -10,
     "sticky": true,
            "link_watch": {
                "name": "ethtool"
            }
        },
        "eth2": {
     "prio": 100,
            "link_watch": {
                "name": "ethtool"
            }
        }
    },    "runner": {
        "name": "activebackup"
    }
 }
# nmcli con mod team0 team.config /tmp/team.conf

The link_watch settings in the configuration file determines how the link state of the port interfaces are monitored. The default looks like the following, and uses functionality similar to the ethtool command to check the link of each interface:

"link_watch": {
    "name": "ethtool"
 }

Another way to check link state is to periodically use an ARP ping packet to check for remote connectivity. Local and remote IP addresses and timeouts would have to be specified. A configuration that would accomplish that would look similar to the following:

"link_watch":{
    "name": "arp_ping",
    "interval": 100,
    "missed_max": 30,
    "source_host": "192.168.23.2",
    "target_host": "192.168.23.1"
},

Troubleshooting Network teams

The teamnl and teamdctl commands are very useful for troubleshooting network teams. These commands only work on network teams that are up. The following examples show some typical uses for these commands.

Display the team ports of the team0 interface:

# teamnl team0 ports
4: eth2: up 0Mbit HD
3: eth1: up 0Mbit HD

Display the currently active port of team0:

# teamnl team0 getoption activeport
3

Set the option for the active port of team0:

# teamnl team0 setoption activeport 3

Use teamdctl to display the current state of the team0 interface:

# teamdctl team0 state
 setup:
  runner: activebackup
 ports:
  eth2
    link watches:
      link summary: up
      instance[link_watch_0]:
       name: ethtool
        link: up
  eth1
    link watches:
      link summary: up
      instance[link_watch_0]:
        name: ethtool
       link: up
 runner:
  active port: eth1

Use teamdctl to display the current JSON configuration for team0:

# teamdctl team0 config dump
 {
    "device": "team0",
    "mcast_rejoin": {
        "count": 1
    },
    "notify_peers": {
       "count": 1
},    "ports": {
        "eth1": {
            "link_watch": {
                "name": "ethtool"
            },
            "prio": -10,
            "sticky": true
        },
        "eth2": {
            "link_watch": {
                "name": "ethtool"
            },
            "prio": 100
        }
    },    "runner": {
        "name": "activebackup"
    }
 }