If you want to know what is Network Teaming, please check out this link.

In this post, I’m going to just list all the commands required to setup a team interface.

Let’s list the available network interfaces I have on my server.

$ nmcli dev status
DEVICE      TYPE      STATE                   CONNECTION 
enp1s0      ethernet  connected               enp1s0     
enp7s0      ethernet  connected               student    
virbr0      bridge    connected (externally)  virbr0     
enp8s0      ethernet  disconnected            --         
enp9s0      ethernet  disconnected            --         
lo          loopback  unmanaged               --         
virbr0-nic  tun       unmanaged               --    

From the above output, you probably can guess that I’m going to use enp8s0 and enp9s0 to create a team network interface.

Let’s decide what we want to achieve:

  1. Create a new team interface called team0
  2. Use the available network interfaces enp8s0 and enp9s0 as the slaves for teams0
  3. Set network teaming mode as: ActiveBackup (Monitor the link for changes and selects the active port to send the traffics.)
  4. Assign IP address of 172.24.0.101/24 as the IP of team0. The IP of the gateway is 172.24.0.1.

Alright, let’s get started.

First create a new connection called team0 and a team interface with the name team0.

# nmcli con add con-name team0 type team ifname team0
Connection 'team0' (c8240c3f-d9c7-4cd0-99bc-d3549bc5c5f1) successfully added.

Next, add both of available network interfaces to team0.

# nmcli con add type team-slave ifname enp8s0 master team0
Connection 'team-slave-enp8s0' (8630642f-8cca-42af-954b-3390a27795a9) successfully added.
# nmcli con add type team-slave ifname enp9s0 master team0
Connection 'team-slave-enp9s0' (8522519e-c40b-49a7-b2e1-35e545c015e1) successfully added.

Then, assign the IP, gateway, and set the team mode to ActiveBackup.

# nmcli con mod team0 ipv4.addresses 172.24.0.101/24 \
> ipv4.gateway 172.24.0.1 \
> ipv4.method manual \
> team.runner activebackup

Optionally, we can see that some scripts were created by NetworkManager after running above commands:

# ls -1 /etc/sysconfig/network-scripts/ | grep team
ifcfg-team0
ifcfg-team-slave-enp8s0
ifcfg-team-slave-enp9s0

Now, let’s bring the connection team0 up.

# nmcli con up team0
Connection successfully activated (master waiting for slaves) (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/14)

Let’s verify the network information of team0.

# ip a show team0  | grep inet
    inet 172.24.0.101/24 brd 172.24.0.255 scope global noprefixroute team0
    inet6 fe80::c6e0:fbd9:5eec:2e2d/64 scope link noprefixroute

We can use teamnl command to show connection information of a team and its slaves.

# teamnl team0 ports
 5: enp9s0: up 4294967295Mbit FD 
 4: enp8s0: up 4294967295Mbit FD 

To check the state of a team interface, use teamdctl command.

# teamdctl team0 state
setup:
  runner: activebackup
ports:
  enp8s0
    link watches:
      link summary: up
      instance[link_watch_0]:
        name: ethtool
        link: up
        down count: 0
  enp9s0
    link watches:
      link summary: up
      instance[link_watch_0]:
        name: ethtool
        link: up
        down count: 0
runner:
  active port: enp8s0

We can see that team0 interface uses network port enp8s0 to send and receive traffics.

Let’s do something a bit fun. First, I’m going to send ping to another IP on the same network as team0.

# ping -c 3 172.24.0.100
PING 172.24.0.100 (172.24.0.100) 56(84) bytes of data.
64 bytes from 172.24.0.100: icmp_seq=1 ttl=64 time=0.596 ms
64 bytes from 172.24.0.100: icmp_seq=2 ttl=64 time=0.289 ms
64 bytes from 172.24.0.100: icmp_seq=3 ttl=64 time=0.283 ms

--- 172.24.0.100 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2059ms
rtt min/avg/max/mdev = 0.283/0.389/0.596/0.147 ms

Now, let’s bring down the enp8s0 network device and try to ping 172.24.0.100 again.

# nmcli dev status
DEVICE      TYPE      STATE                   CONNECTION        
enp1s0      ethernet  connected               enp1s0            
enp7s0      ethernet  connected               student           
team0       team      connected               team0             
virbr0      bridge    connected (externally)  virbr0            
enp8s0      ethernet  connected               team-slave-enp8s0 
enp9s0      ethernet  connected               team-slave-enp9s0 
lo          loopback  unmanaged               --                
virbr0-nic  tun       unmanaged     

# nmcli dev disconnect enp8s0
Device 'enp8s0' successfully disconnected.
# nmcli dev status
DEVICE      TYPE      STATE                   CONNECTION        
enp1s0      ethernet  connected               enp1s0            
enp7s0      ethernet  connected               student           
team0       team      connected               team0             
virbr0      bridge    connected (externally)  virbr0            
enp9s0      ethernet  connected               team-slave-enp9s0 
enp8s0      ethernet  disconnected            --                
lo          loopback  unmanaged               --                
virbr0-nic  tun       unmanaged               --   

# ping -c 3 172.24.0.100
PING 172.24.0.100 (172.24.0.100) 56(84) bytes of data.
64 bytes from 172.24.0.100: icmp_seq=1 ttl=64 time=0.406 ms
64 bytes from 172.24.0.100: icmp_seq=2 ttl=64 time=0.297 ms
64 bytes from 172.24.0.100: icmp_seq=3 ttl=64 time=0.278 ms

--- 172.24.0.100 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2048ms
rtt min/avg/max/mdev = 0.278/0.327/0.406/0.056 ms

That’s awesome! The ping still works. This is expected, isn’t it? Remember, we set the team runner to be “activebackup”.

# teamdctl team0 state
setup:
  runner: activebackup
ports:
  enp9s0
    link watches:
      link summary: up
      instance[link_watch_0]:
        name: ethtool
        link: up
        down count: 0
runner:
  active port: enp9s0

If you’re new to network teaming, this blog post might not be useful to you. You can refer to the links at the bottom of this page to learn more about this topic.

As a bonus, while setting up this network teaming example, I made a minor mistake. I forgot to set ipv4.manual for the team0 connection. This resulted in team0 connection kept going down as it tried to fetch an IP from a DHCP server. (The devices used for this team0 were all on an isolate network without DHCP server running.) But you know what? I’m glad I made this silly mistake now. This will definitely make me be extra careful when I setup a real team network interface in production environment.

You can learn more about teaming network at the following resources: