teamdctl and teamnl
NIC teaming joins two or more network ports into one logical team0 device, so traffic keeps flowing when one port fails. teamdctl controls the teamd daemon, and teamnl talks directly to the kernel team driver for debugging.
62.1 Why is it used?
- Redundancy: if one NIC, cable or switch fails, the other port takes over.
- Load balancing: with lacp or loadbalance runners both ports carry traffic.
- Linux only: apt install libteam-utils or dnf install teamd; needs the team kernel module.
- Note: teaming is deprecated in RHEL 9; new setups use bonding.
62.2 How it works
- teamdctl: a client that talks to teamd over a Unix socket (default), D-Bus or ZeroMQ.
- teamd: userspace daemon that runs the runner and link_watch and decides which port is active.
- team driver: kernel part that owns the team0 netdev and forwards the actual packets; teamd controls it over netlink.
- teamnl: talks to the driver over netlink directly, only for debugging and monitoring.
- Step 1
1.teamdctl: state, config, port add/remove
- Step 2
2.teamd daemon: runner + link_watch (usock / D-Bus)
- Step 3
3.team driver (kernel): team0 netdev, forwards packets
- Step 4
4.teamnl: netlink straight to the driver, debug / monitor only
teamdctl -> teamd -> team driver <- teamnl
- Step 1
1.Server: team0 = eth1 (Switch A, active) + eth2 (Switch B, standby), IP 192.168.82.11
- Step 2
2.Client 192.168.82.20 traffic goes via Switch A to eth1
- Step 3
3.The eth1 cable is cut; teamd link_watch sees eth1 link down
- Step 4
4.The runner makes eth2 the active port in the same second
- Step 5
5.The next request goes via Switch B to eth2; the client stays connected
The user feels only a tiny blip: that is redundancy
62.3 Runners: the team's policy
| Runner | Behaviour | Note |
|---|---|---|
| activebackup | One port active, the rest standby | No switch config needed |
| lacp | 802.3ad LAG with the switch | Needs a port-channel on the switch |
| loadbalance | A hash spreads flows across ports | Uses both ports |
| roundrobin | Each packet to the next port | Can reorder packets |
| broadcast / random | Every port / random port | Rarely used |
62.4 teamdctl options
- Syntax: teamdctl [options] teamdevname command [args].
- -v verbose, -o one-line output (handy in scripts).
- -U Unix socket (default), -D force D-Bus, -Z force ZeroMQ.
- On this build -Z printed that ZeroMQ is not compiled in: not every distro has every interface.
teamdctl -hteamdctl -Z tcp://127.0.0.1:5555 team0 state$ teamdctl -hteamdctl [options] teamdevname command [command args] -h --help Show this help -v --verbose Increase output verbosity -o --oneline Force output to one line if possible -D --force-dbus Force to use D-Bus interface -Z --force-zmq=ADDRESS Force to use ZeroMQ interface [-Z[Address]] -U --force-usock Force to use UNIX domain socket interface $ teamdctl -Z tcp://127.0.0.1:5555 team0 stateZeroMQ support is not compiled-in62.5 Real run: team0 could not be created
- teamd -g gives debug output, -t names the team device, -c passes the JSON config.
- It failed with Not supported: the Docker Desktop WSL kernel has no team driver (CONFIG_NET_TEAM not set).
- The bonding module (CONFIG_BONDING=m) is available, so failover is shown later with bonding.
- The state view output below is the documented example.
teamd -g -t team0 \ -c '{"runner":{"name":"activebackup"}}'zcat /proc/config.gz \ | grep -E 'NET_TEAM|CONFIG_BONDING='$ teamd -g -t team0 -c '{"runner":{"name":"activebackup"}}'Using team device "team0".Using PID file "/var/run/teamd/team0.pid"Failed to create team device.teamd_init() failed.Failed: Not supported $ zcat /proc/config.gz | grep -E 'NET_TEAM|CONFIG_BONDING='CONFIG_BONDING=m# CONFIG_NET_TEAM is not set62.6 teamd JSON config
- teamd keeps its config in JSON; bond2team converts a bonding config into a team config.
- runner.name = activebackup; link_watch = ethtool (checks the NIC carrier).
- eth1 prio -10 is higher than eth2 prio -100, so eth1 is active when both are up.
- teamdctl team0 config dump prints exactly this format.
bond2team --master team0 --json --stdout \ --bonding_opts \'mode=active-backup miimon=100 primary=eth1' \ --port eth1 --port eth2 "device" : "team0", "runner" : { "name" : "activebackup" "link_watch" : { "name" : "ethtool" "ports" : { "eth1" : { "prio" : -10, "eth2" : { "prio" : -100,62.7 state view and manual failover
- state view: setup (runner), ports (link summary) and the active port.
- Both ports up means the standby is ready for failover.
- state item set runner.active_port eth2: manual failover for maintenance without pulling a cable.
teamdctl team0 state viewteamdctl team0 state item set \ runner.active_port eth2$ sudo teamdctl team0 state viewsetup: runner: activebackupports: eth1 link summary: up eth2 link summary: uprunner: active port: eth162.8 teamdctl commands: config, state, ports
- config dump noports / actual: config without ports, or with the current ports (save it as a backup).
- state item get PATH reads one value; quote names with dots ('ports."eth1.1"...').
- Bring a port down before port add: ip link set eth1 down.
- port present eth1 exits 0 for a member: port present eth1 && echo member.
teamdctl team0 <command>:config dump JSON configconfig dump noports without ports sectionconfig dump actual with current portsstate | state dump JSON state documentstate view runner, ports, activestate item get PATH read one value runner.active_port which port is activestate item set PATH V set a value setup.debug_level 2 more debug logs runner.active_port activebackup failoverport add eth1 add port to teamport remove eth1 remove from teamport present eth1 member? exit 0 / 1port config update eth1 '{"prio": 100}'port config dump eth1 port's JSON config62.9 teamnl
- Options: -h help, -p port name (per-port option), -a array index.
- teamnl team0 ports gave Netdevice not found: team0 was never created in the kernel, which proves teamnl talks straight to the driver without teamd.
- ports shows each port's link, speed and duplex from the kernel's view.
- Do not run setoption on a team managed by teamd: teamd owns those options.
- monitor changed / monitor all: useful in a cable-unplug test.
teamnl -hteamnl team0 ports$ teamnl -hteamnl [options] teamdevname command [command args] -h --help Show this help -p --port_name team slave port name -a --array_index team option array indexCommands: ports options getoption OPT_NAME setoption OPT_NAME OPT_VALUE monitor OPT_STYLE $ teamnl team0 portsNetdevice "team0" not found.Command failed: No such deviceteamnl team0 <command>:ports ifindex, name, link, speed, duplexoptions all team optionsgetoption mode one option's valuesetoption mcast_rejoin_count 3 (debug only)monitor changed changed items onlymonitor all everything on change-p eth1 getoption enabled per-port option-a 0 getoption bpf_hash_func array index62.10 Real lab: bonding active-backup failover
- bond0 in the srv namespace, mode active-backup, eth1 and eth2 connected to a bridge.
- Before: Currently Active Slave eth1, both MII Status up, ping 0% loss.
- Bringing down switch port s1 = cutting the eth1 cable.
- Within a second the active slave became eth2 and ping still had 0% loss.
- With teamd the same change shows in state view as active port eth2.
ip netns exec pc ping -c 3 192.168.82.11ip netns exec srv grep -E 'Mode|Active|Slave I|MII S' /proc/net/bonding/bond0ip -n sw link set s1 down # like cutting the eth1 cableip netns exec srv grep -E 'Mode|Active|Slave I|MII S' /proc/net/bonding/bond0ip netns exec pc ping -c 3 192.168.82.11$ ip netns exec srv grep -E 'Mode|Active|Slave I|MII S' /proc/net/bonding/bond0Bonding Mode: fault-tolerance (active-backup)Currently Active Slave: eth1MII Status: upSlave Interface: eth1MII Status: upSlave Interface: eth2MII Status: up $ ip -n sw link set s1 down$ ip netns exec srv grep -E 'Mode|Active|Slave I|MII S' /proc/net/bonding/bond0Currently Active Slave: eth2Slave Interface: eth1MII Status: downSlave Interface: eth2MII Status: up $ ip netns exec pc ping -c 3 192.168.82.1164 bytes from 192.168.82.11: icmp_seq=1 ttl=64 time=0.089 ms64 bytes from 192.168.82.11: icmp_seq=2 ttl=64 time=0.081 ms64 bytes from 192.168.82.11: icmp_seq=3 ttl=64 time=0.086 ms3 packets transmitted, 3 received, 0% packet loss62.11 Comparison: teaming vs bonding
| Point | Teaming (teamd) | Bonding |
|---|---|---|
| Where logic runs | Small kernel driver + userspace teamd | Entirely in the kernel |
| Config | JSON (teamdctl config dump) | Module options / ip link / nmcli |
| Control | teamdctl, D-Bus, teamnl | /proc/net/bonding, sysfs, ip |
| Modes | activebackup, lacp, loadbalance, roundrobin... | active-backup, 802.3ad, balance-*... |
| Status today | Deprecated in RHEL 9 | Recommended for new setups |
62.12 Common mistakes
- Thinking 2 NICs double the speed: in activebackup only one port carries traffic.
- Even with lacp/loadbalance a single TCP flow stays on one port, because the hash pins each flow.
- Running port add while the port is up: bring it down first.
- Using setoption with teamnl on a teamd-managed team.
- Building new setups on teaming instead of bonding on RHEL 9.
62.13 Interview tips
- Teaming vs bonding: bonding is all kernel; teaming = small kernel driver + teamd daemon with JSON config.
- Manual failover: teamdctl team0 state item set runner.active_port eth2, then confirm in state view.
- teamdctl talks to teamd; teamnl talks to the kernel driver (debug only).
- activebackup = redundancy, not more bandwidth; lacp needs switch support.
- Teaming is deprecated in RHEL 9: prefer bonding.