Learn how to – Configure Network Teaming on CentOS / RHEL 8/7.
Question: How to configure Network Teaming on CentOS / RHEL 8? or How to configure Network bonding on CentOS / RHEL 8/7?. In this blog post, we will discuss how to configure Network Teaming on RHEL / CentOS 8/7. Network teaming can also be called NIC teaming, channel bonding or link aggregation.
Teaming involves combining or aggregating of network links to provide a logical link with higher throughput or to provide redundancy. This concept of
Teaming Concepts & terminologies
- teamd – An application daemon which uses the libteam library to implement load-balancing and round-robin logic. It listens and communicates via Unix Domain Sockets.
- teamdctl – A utility used to control a running instance of teamd using D-bus. It can be used during run time to read the configuration, the state of link-watchers, check and change the state of ports, add and remove ports, and to change ports between active and backup states.
- runners – Separate units of code which implements functions that are unique to the different load sharing and backup methods, such as round-robin. The user specifies the runner in the JSON format configuration file and the code is then compiled into an instance of teamd when the instance is created
Available runners (Team running modes)
- broadcast – data is transmitted over all ports
- active-backup – one port or link is used while others are kept as a backup
- round-robin – data is transmitted over all ports in turn
- loadbalance – With active Tx load balancing and BPF-based Tx port selectors
lacp – implements the 802.3ad Link Aggregation Control Protocol
Network teaming link watchers
ethtool – used to watch for link state changes. This is the default if no other link-watcher is specified in the configuration file.- arp_ping – used to monitor the presence of a far-end hardware address using ARP packets.
- nsna_ping – Used to monitor the presence of a neighbor’s interface
Configure network teaming daemon on RHEL / CentOS 8
To install teamd, issue the following command in your
sudo dnf -y install teamd
Version of teamd installed can be obtained with:
$ rpm -qi teamd
Name : teamd
Version : 1.31
Release : 2.el8
Architecture: x86_64
Install Date: Tue Jun 28 02:03:09 2022
Group : System Environment/Daemons
Size : 282950
License : LGPLv2+
Signature : RSA/SHA256, Mon Apr 12 06:14:13 2021, Key ID 15af5dac6d745a60
Source RPM : libteam-1.31-2.el8.src.rpm
Build Date : Mon Mar 15 01:12:27 2021
Build Host : ord1-prod-x86build003.svc.aws.rockylinux.org
Relocations : (not relocatable)
Packager : infrastructure@rockylinux.org
Vendor : Rocky
URL : http://www.libteam.org
Configure network teaming with nmcli
First of all, identify the network interfaces that will be used as slaves.
# ip link show
1: lo: mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: enp1s0: mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
link/ether 52:54:00:8f:8c:86 brd ff:ff:ff:ff:ff:ff
3: enp7s0: mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
link/ether 52:54:00:74:99:a9 brd ff:ff:ff:ff:ff:ff
4: enp8s0: mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
link/ether 52:54:00:2b:db:9c brd ff:ff:ff:ff:ff:ff
Since I have NetworkManager running in my RHEL / CentOS 8 server machine, I’ll use nmcli network management tool.
# nmcli connection show
NAME UUID TYPE DEVICE
enp1s0 498869bb-0d88-4a4c-a83a-c491d1040b0b ethernet enp1s0
Wired connection 1 48b9eacf-eb8b-348b-a44d-1d74ba22a6d6 ethernet enp7s0
Wired connection 2 10d1def1-39dc-3468-b9cd-263e72424383 ethernet enp8s0
For my setup, i’ll use the two network devices – enp7s0
and enp8s0
. Delete the connections with nmcli before you start the configuration.
The two devices should now be in disconnected state.
$ nmcli device status
DEVICE TYPE STATE CONNECTION
enp1s0 ethernet connected enp1s0
enp7s0 ethernet disconnected --
enp8s0 ethernet disconnected --
lo loopback unmanaged --
To create a new team interface, with name team0:
sudo nmcli connection add type team con-name team0 ifname team0
config '{ "runner": {"name": "loadbalance"}, "link_watch": {"name": "ethtool"}}'
You can replace loadbalance with:
- activebackup
- broadcast
- lacp
- random
- roundrobin
NetworkManager will write /etc/sysconfig/network-scripts/ifcfg-team-team0
$ nmcli con show team0
Use command below to view Team interfaces just configured.
$ nmcli con show
Sample output:
Assign team interface an IP address, DNS and auto-connection.
nmcli con mod team0 ipv4.addresses 192.168.121.10/24
nmcli con mod team0 ipv4.gateway 192.168.121.1
nmcli con mod team0 ipv4.dns 8.8.8.8
nmcli con mod team0 ipv4.method manual
nmcli con mod team0 connection.autoconnect yes
Add Network Slave to the team.
nmcli con add type team-slave con-name team0-slave0 ifname enp7s0 master team0
nmcli con add type team-slave con-name team0-slave1 ifname enp8s0 master team0
Sample output.
Connection 'team0-slave0' (daa6fc23-cdef-40b1-9b9d-5157d6ff3910) successfully added.
Connection 'team0-slave1' (a20cf7ee-fb08-4270-a6e7-b6e20cb490dc) successfully added.
Confirm connection details.
Restart the connection.
nmcli connection down team0 && nmcli connection up team0
You should see assigned IP information.
$ ip addr show dev team0
8: team0: mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether 52:54:00:74:99:a9 brd ff:ff:ff:ff:ff:ff
inet 192.168.121.10/24 brd 192.168.121.255 scope global noprefixroute team0
valid_lft forever preferred_lft forever
inet6 fe80::4c51:96b:c24e:ede9/64 scope link noprefixroute
valid_lft forever preferred_lft forever
$ ping -c 1 192.168.121.1
PING 192.168.121.1 (192.168.121.1) 56(84) bytes of data.
64 bytes from 192.168.121.1: icmp_seq=1 ttl=64 time=0.134 ms
--- 192.168.121.1 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.134/0.134/0.134/0.000 ms
The team status can also be checked with teamdctl
.
$ teamdctl team0 state
setup:
runner: loadbalance
ports:
enp7s0
link watches:
link summary: up
instance[link_watch_0]:
name: ethtool
link: up
down count: 0
enp8s0
link watches:
link summary: up
instance[link_watch_0]:
name: ethtool
link: up
down count: 0
How to Delete Team with nmcli
Show connection details.
$ nmcli connection show
NAME UUID TYPE DEVICE
enp1s0 498869bb-0d88-4a4c-a83a-c491d1040b0b ethernet enp1s0
team0 f763a709-3956-497f-b92c-5c06f848bee7 team team0
team0-slave0 daa6fc23-cdef-40b1-9b9d-5157d6ff3910 ethernet enp7s0
team0-slave1 a20cf7ee-fb08-4270-a6e7-b6e20cb490dc ethernet enp8s0
Bring down team connection.
nmcli connection down team0
Delete slaves.
$ nmcli connection delete team0-slave0 team0-slave1
Connection 'team0-slave0' (daa6fc23-cdef-40b1-9b9d-5157d6ff3910) successfully deleted.
Connection 'team0-slave1' (a20cf7ee-fb08-4270-a6e7-b6e20cb490dc) successfully deleted.
Delete team created.
$ nmcli connection delete team0
Connection 'team0' (f763a709-3956-497f-b92c-5c06f848bee7) successfully deleted.
Confirm deletion.
$ nmcli connection show
NAME UUID TYPE DEVICE
enp1s0 498869bb-0d88-4a4c-a83a-c491d1040b0b ethernet enp1s0
Creating a Network Team Using ifcfg Files
To create a networking team using ifcfg files, create a file in the /etc/sysconfig/network-scripts/ directory as follows:
$ cat /etc/sysconfig/network-scripts/ifcfg-team0
DEVICE=team0
NAME=team0
DEVICETYPE=Team
ONBOOT=yes
BOOTPROTO=none
IPADDR=192.168.121.10
PREFIX=24
GATEWAY=192.168.121.1
TEAM_CONFIG='{"runner": {"name": "activebackup"}, "link_watch": {"name": "ethtool"}}'
To create a port to be a member of team0, create one or more files in the /etc/sysconfig/network-scripts/ directory as follows:
$ cat /etc/sysconfig/network-scripts/ifcfg-team0-slave0
NAME=team0-slave0
DEVICE=enp7s0
ONBOOT=yes
TEAM_MASTER=team0
DEVICETYPE=TeamPort
$ cat /etc/sysconfig/network-scripts/ifcfg-team0-slave1
NAME=team0-slave1
DEVICE=enp8s0
ONBOOT=yes
TEAM_MASTER=team0
DEVICETYPE=TeamPort
Start team interface.
sudo ip link set enp7s0 down
sudo ip link set enp8s0 down
sudo ifup team0
List team ports.
$ teamnl team0 ports
4: enp8s0: up 4294967295Mbit FD
3: enp7s0: up 4294967295Mbit FD
Key notes on managing Team interfaces
- Starting the master interface does not automatically start the port interfaces.
- Starting a port interface always starts the master interface.
- Stopping the master interface also stops the port interfaces.
- A master without ports can start static
IP
connections. - A master without ports waits for ports when starting
DHCP
connections. - A master with a
DHCP
connection waiting for ports completes when a port with a carrier is added. - A master with a
DHCP
connection waiting for ports continues waiting when a port without a carrier is added.
You can also check:
- How to Create a Linux Network Bridge on RHEL / CentOS 8
- Adding a Secondary IP Address to RHEL / CentOS 8 Network Interface
- Install and Configure OpenVPN Server on RHEL / CentOS 8
Leave a Reply
You must be logged in to post a comment.