In earlier versions of RHEL, network bonding was the default method for creating aggregated network interfaces. In RHEL 7, network teaming has been added as a solution. The main difference between these two is that network bonding happened completely in user space, whereas, in network teaming, the teamd daemon is added to allow interaction in user space as well. Even if both methods are still valid, network teaming is the preferred method.
On earlier versions of Red Hat Enterprise Linux, network bonding was used to accomplish the same goals. Network teaming is new in Red Hat Enterprise Linux 7. The solution consists of a small kernel driver and a daemon that is available in userspace: teamd.
# rpm -qa | grep teamd teamd-1.27-4.el7.x86_64
The kernel takes care of handling network packets, while the teamd driver handles logic and interface processing. To determine how exactly this is happening, different runners are used. Runners in teaming are equivalent to the bonding modes. They are used to define the logic of traffic handling between the interfaces that are involved in the configuration. The table below gives a summary of available runners.
Runner | Remark |
---|---|
roundrobin | This is the default that we are using, it simply sends packets to all interfaces in the team in a round robin manner, that is one at a time followed by the next interface. |
broadcast | All traffic is sent over all ports. |
activebackup | One interface is in use while the other is set aside as a backup, the link is monitored for changes and will use the failover link if needed. |
loadbalance | Traffic is balanced over all interfaces based on Tx traffic, equal load should be shared over available interfaces. |
lacp | Implements 802.3ad LACP protocol. |
1. Configure Network Team Using JSON-format definitions [Not Persistent]
1. Create a JSON-format definition file for the team and its component ports,in this example, /root/team_config/team0.conf
.
# cat /root/team_config/team0.conf #team0.conf { "device": "team0", "runner": {"name": "activebackup"}, "link_watch": {"name": "ethtool"}, "ports": { "enp0s8": { "prio": -10, "sticky": true }, "enp0s9": { "prio": 100 } } }
2. Use the ip command to bring down the component ports:
# ip link set enp0s8 down # ip link set enp0s9 down
Note: Active interfaces cannot be added to a team.
3. Start an instance of the teamd daemon and have it create the teamed interface by reading the configuration file (in this example, /root/team_config/team0.conf):
# teamd -g -f /root/team_config/team0.conf -d Using team device "team0". Using PID file "/var/run/teamd/team0.pid" Using config file "/root/team_config/team0.conf"
Note: The -g
option displays debugging messages and can be omitted.
4. Use the ip command to set the IPaddr and network mask prefix length of the teamed interface:
# ip addr add 192.168.22.10/24 dev team0
5. Verify the configuration wit “ip addr” and “teamdctl” commands.
# ip addr team0: <broadcast,multicast,up,lower_up style="box-sizing: inherit;"> mtu 1500 qdisc noqueue state UP qlen 1000 link/ether 08:00:27:5a:d8:50 brd ff:ff:ff:ff:ff:ff inet 192.168.22.10/24 scope global team0 valid_lft forever preferred_lft forever inet6 fe80::a00:27ff:fe5a:d850/64 scope link valid_lft forever preferred_lft forever</broadcast,multicast,up,lower_up>
# teamdctl team0 state setup: runner: activebackup ports: enp0s8 link watches: link summary: up instance[link_watch_0]: name: ethtool link: up down count: 0 enp0s9 link watches: link summary: up instance[link_watch_0]: name: ethtool link: up down count: 0 runner: active port: enp0s9
2. Configure Network Team Using ifcfg Files [Persistent]
/etc/sysconfig/network-scripts
directory and create “ifcfg-team0” file as shown below:
# cat /etc/sysconfig/network-scripts/ifcfg-team0 DEVICE=team0 DEVICETYPE=Team ONBOOT=yes BOOTPROTO=dhcp NM_CONTROLLED=no #IPADDR=192.168.11.1 PREFIX=24 TEAM_CONFIG='{"runner": {"name": "activebackup"}, "link_watch": {"name": "ethtool"}}'
Note:
The teaming interface team0 can also have static ip with BOOTPROTO=none
2. Edit the files for respective interface (here I have added two interface enp0s8 & enp0s9):
# cat /etc/sysconfig/network-scripts/ifcfg-enp0s8 DEVICE=enp0s8 #HWADDR=D4:85:64:01:46:9E DEVICETYPE=TeamPort ONBOOT=yes NM_CONTROLLED=no TEAM_MASTER=team0 TEAM_PORT_CONFIG='{"prio": 100}'
# cat /etc/sysconfig/network-scripts/ifcfg-enp0s9 DEVICE=enp0s9 #HWADDR=D4:85:64:01:46:9E DEVICETYPE=TeamPort ONBOOT=yes TEAM_MASTER=team0 NM_CONTROLLED=no TEAM_PORT_CONFIG='{"prio": 100}'
3. Make sure both the interface are down:
# ip link set enp0s8 down # ip link set enp0s9 down
Note: Active interfaces cannot be added to a team.
4. Now you can bring up your interface
# ifup team0
5. Verify the teaming configuration with “ip addr”, “nmcli device status” and “teamdctl” commands.
# ip addr team0: <broadcast,multicast,up,lower_up style="box-sizing: inherit;"> mtu 1500 qdisc noqueue state UP qlen 1000 link/ether 08:00:27:2e:4c:65 brd ff:ff:ff:ff:ff:ff inet 192.168.57.101/24 brd 192.168.57.255 scope global dynamic team0 valid_lft 1178sec preferred_lft 1178sec inet6 fe80::a00:27ff:fe2e:4c65/64 scope link tentative dadfailed valid_lft forever preferred_lft forever</broadcast,multicast,up,lower_up>
# nmcli device status DEVICE TYPE STATE CONNECTION enp0s8 ethernet unmanaged -- enp0s9 ethernet unmanaged -- team0 team unmanaged --
# teamdctl team0 state setup: runner: activebackup ports: enp0s8 link watches: link summary: up instance[link_watch_0]: name: ethtool link: up down count: 0 enp0s9 link watches: link summary: up instance[link_watch_0]: name: ethtool link: up down count: 0 runner: active port: enp0s8
Removing a Team
To terminate, or kill, an instance of the team daemon use the below command:
# teamd -t team0 -k