NIC Teaming in Linux: Step-by-Step Guide

Photo of author
By Jay
— 9 min read
Photo of author
Written by
Photo of author
Verified by
Published On
— 9 min read

NIC Teaming in Linux

NIC Teaming in Linux is a powerful networking technique that improves bandwidth, fault tolerance, and load balancing by combining multiple network interfaces into a single logical connection. Unlike traditional NIC bonding, NIC teaming offers greater flexibility, real-time configurability, and better performance management using the teamd daemon.

In this step-by-step guide, we’ll walk you through the setup process for NIC teaming in Linux, covering different runner modes, configuration methods, and troubleshooting tips to help you optimize your network for high availability and efficiency. Let’s get started!

Teaming Terminologies


Before we begin to configuration NIC teaming in Linux lets understand the teaming terminologies

Teamd: Teamd is a daemon that manages network teaming interfaces. It provides a user space interface for teaming multiple network interfaces and presenting them as a single virtual interface to the Linux kernel.

Teamdctl: Teamdctl is a command-line tool used to manage the teamd daemon. It allows you to create, modify, and delete network teaming interfaces, as well as query and monitor their status.

Runner: Runner is a type of teaming mode supported by teamd. It is a load-balancing mode that distributes traffic across the team member interfaces based on the destination MAC address. This helps improve network throughput and reduce latency by utilizing all available network paths.

In this tutorials we will be configuring NIC teaming in Linux using the active-backup mode. This means one link will be active at a time and other will be standby as a backup

Without doing any further delay lets start the configuration


Steps to configure NIC Teaming in Linux

This configuration is applicable across various distributions, including RHEL 8, RHEL 9, CentOS, Rocky Linux, and AlmaLinux. By combining multiple network interfaces into a single logical interface, administrators can achieve improved fault tolerance and load balancing, ensuring a more reliable and efficient network setup.

Install the teamd Daemon in if its not already installed


Check if teamd is installed or not, it should be installed by default on the system

[root@TechArticles ~]# dnf list installed teamd
Installed Packages
teamd.x86_64                        1.31-2.el8                         @anaconda

If teamd not already installed, Install it by

[root@TechArticles ~]# dnf install teamd -y

Next step to Configure NIC teaming in Linux


We’ll utilise the useful nmcli tool, which can also be used to manage the NetworkManager service. I’m planning to team two NIC cards to establish a logical team interface: enp0s8 and enp0s9. Please Note: This may not be the situation in your circumstance.

Check the device status by running below command

[root@TechArticles ~]# nmcli device status
DEVICE  TYPE      STATE                   CONNECTION
enp0s3  ethernet  connected               enp0s3
enp0s8  ethernet  connected               ethernet-enp0s8
enp0s9  ethernet  connected               ethernet-enp0s9
virbr0  bridge    connected (externally)  virbr0
lo      loopback  unmanaged               --

To check the above two networks are available run the below command

[root@TechArticles ~]# nmcli connection show
NAME             UUID                                  TYPE      DEVICE
enp0s3           b972dea7-b72d-4e48-a838-bda20615e189  ethernet  enp0s3
ethernet-enp0s8  7d533e83-a610-4436-a66e-c1c31c795b03  ethernet  enp0s8
ethernet-enp0s9  4265df88-53fc-4585-87ca-e3a031cfa8b6  ethernet  enp0s9
virbr0           37e3e593-87fe-4f80-a8e0-a63cc6598da8  bridge    virbr0

We will delete the existing network interfaces in order to create a network teaming connection or interface that will serve as our logical link. Following that, we will establish slave interfaces from the removed interfaces and associate them with the teaming link.

To erase the links, use their individual UUIDs and run the following commands:

[root@TechArticles ~]# nmcli connection delete 7d533e83-a610-4436-a66e-c1c31c795b03
Connection 'ethernet-enp0s8' (7d533e83-a610-4436-a66e-c1c31c795b03) successfully deleted.
[root@TechArticles ~]# nmcli connection delete 4265df88-53fc-4585-87ca-e3a031cfa8b6
Connection 'ethernet-enp0s9' (4265df88-53fc-4585-87ca-e3a031cfa8b6) successfully deleted.

Now recheck the device status it should be disconnected

[root@TechArticles ~]# nmcli device status
DEVICE  TYPE      STATE                   CONNECTION
enp0s3  ethernet  connected               enp0s3
virbr0  bridge    connected (externally)  virbr0
enp0s8  ethernet  disconnected            --
enp0s9  ethernet  disconnected            --
lo      loopback  unmanaged               --

Next Add the team0 connection by command # nmcli connection add type team con-name team0 ifname team0 config '{"runner": {"name": "activebackup"}}'

[root@TechArticles ~]# nmcli connection add type team con-name team0 ifname team0 config '{"runner": {"name": "activebackup"}}'

Connection 'team0' (85b00462-deb8-4f26-ada8-233c9b999732) successfully added.
[root@TechArticles ~]#

Now you can check details assigned to the team0 interface run the # nmcli connection show team0 command:

[root@TechArticles ~]# nmcli connection show team0
connection.id:                          team0
connection.uuid:                        85b00462-deb8-4f26-ada8-233c9b999732
connection.stable-id:                   --
connection.type:                        team
connection.interface-name:              team0
connection.autoconnect:                 yes
connection.autoconnect-priority:        0
connection.autoconnect-retries:         -1 (default)
connection.multi-connect:               0 (default)
connection.auth-retries:                -1
{..}

You can check the interface team0 status by running nmcli connection show command. Till now interface is created but we did not added our actuals interfaces enp0s8 and enp0s9.

[root@TechArticles ~]# nmcli connection show
NAME    UUID                                  TYPE      DEVICE
team0   85b00462-deb8-4f26-ada8-233c9b999732  team      team0
enp0s3  b972dea7-b72d-4e48-a838-bda20615e189  ethernet  enp0s3
virbr0  37e3e593-87fe-4f80-a8e0-a63cc6598da8  bridge    virbr0

Add the two NIC cards one by one to the above created connection by

# nmcli con add type team-slave con-name team0-slave0 ifname enp0s8 master team0
# nmcli con add type team-slave con-name team0-slave1 ifname enp0s9 master team0

Example:

[root@TechArticles ~]# nmcli con add type team-slave con-name team0-slave0 ifname enp0s8 master team0
Connection 'team0-slave0' (1925da41-85d8-4e34-84d2-9ef6564a3d70) successfully added.
[root@TechArticles ~]# nmcli con add type team-slave con-name team0-slave1 ifname enp0s9 master team0
Connection 'team0-slave1' (00f29fa7-d1c2-4bf8-a900-8400738aa131) successfully added.

Let’s configure the IP Address of interface team0 Please reach out to your network team for correct IP, SM and DNS for demonstration purpose I am using IP : 192.168.111.100, SM : 255.255.255.0, DG: 192.168.111.52 and DNS: 8.8.8.8, Please make sure you do not get any error while running below commands

# nmcli con mod team0 ipv4.addresses 192.168.111.100/24
# nmcli con mod team0 ipv4.gateway 192.168.111.52
# nmcli con mod team0 ipv4.dns 8.8.8.8
# nmcli con mod team0 ipv4.method manual
# nmcli con mod team0 connection.autoconnect yes

New check the status of connection by nmcli connection show command

[root@TechArticles ~]# nmcli connection show
NAME          UUID                                  TYPE      DEVICE
enp0s3        b972dea7-b72d-4e48-a838-bda20615e189  ethernet  enp0s3
team0         85b00462-deb8-4f26-ada8-233c9b999732  team      team0
virbr0        37e3e593-87fe-4f80-a8e0-a63cc6598da8  bridge    virbr0
team0-slave0  1925da41-85d8-4e34-84d2-9ef6564a3d70  ethernet  enp0s8
team0-slave1  00f29fa7-d1c2-4bf8-a900-8400738aa131  ethernet  enp0s9

Now try deactivating and reactivating the team link. This turns on the connection between the slave and team links.

# nmcli connection down team0
# nmcli connection up team0

Now, Verifiy the connection link by running ip addr show dev team0 command.

[root@TechArticles ~]# ip addr show dev team0
7: team0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 08:00:27:c2:15:90 brd ff:ff:ff:ff:ff:ff
    inet 192.168.111.100/24 brd 192.168.111.255 scope global noprefixroute team0
       valid_lft forever preferred_lft forever
    inet6 fe80::a547:95d4:83b7:5af0/64 scope link noprefixroute
       valid_lft forever preferred_lft forever

As above output the link is operational and has the right IP addresses that we specified earlier.

To see the team0 connection up details by

# teamdctl team0 state

To check the connection communication by

# ping -I team0 <IP address>

To verify down the one NIC card in team0 by

# nmcli connection down enp0s8

To check the team0 NIC card up or down details

# teamdctl team0 state

Example: Check the highlighted interfaces are connected and up currently and running type is ActiveBackup and the current accitive port

[root@TechArticles ~]# teamdctl team0 state
setup:
  runner: activebackup
ports:
  enp0s8
    link watches:
      link summary: up
      instance[link_watch_0]:
        name: ethtool
        link: up
        down count: 1
  enp0s9
    link watches:
      link summary: up
      instance[link_watch_0]:
        name: ethtool
        link: up
        down count: 0
runner:
  active port: enp0s8

Lets Validate the teaming, Will down the enp0s8 port and check if the 2nd port is comming as active or not

[root@TechArticles ~]# nmcli device disconnect enp0s8
Device 'enp0s8' successfully disconnected.
[root@TechArticles ~]# teamdctl team0 state
setup:
  runner: activebackup
ports:
  enp0s9
    link watches:
      link summary: up
      instance[link_watch_0]:
        name: ethtool
        link: up
        down count: 0
runner:
  active port: enp0s9

Now you can see I have down the active port enp0s8, and the port enp0s9 is instantly active

Deleting the NIC Teaming in Linux


If you want to delete the already configured teaming, follow the below steps to do so

# nmcli connection down team0

Now delete the slave interfaces

nmcli connection delete team0-slave0 team0-slave1

In the last, delete the team0 interface

# nmcli connection delete team0

Example:

[root@TechArticles ~]# nmcli connection down team0
Connection 'team0' successfully deactivated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/12)
[root@TechArticles ~]# nmcli connection delete team0-slave0 team0-slave1
Connection 'team0-slave0' (1925da41-85d8-4e34-84d2-9ef6564a3d70) successfully deleted.
Connection 'team0-slave1' (00f29fa7-d1c2-4bf8-a900-8400738aa131) successfully deleted.
[root@TechArticles ~]# nmcli connection delete team0
Connection 'team0' (85b00462-deb8-4f26-ada8-233c9b999732) successfully deleted.

Benefits of NIC Teaming in Linux?


NIC Teaming in Linux offers several advantages, making it a preferred choice for network optimization and reliability. Here are the key benefits:

1. Improved Network Redundancy (Failover Support)

  • If one network interface fails, traffic is automatically rerouted through the remaining active interfaces.
  • Prevents downtime and ensures continuous network connectivity.

2. Increased Bandwidth (Load Balancing)

  • Distributes network traffic across multiple interfaces, reducing congestion and improving throughput.
  • Supports various runner modes like round-robin, load balance, and LACP to optimize data transfer.

3. Dynamic Reconfiguration Without Downtime

  • Unlike NIC bonding, teaming allows real-time changes without restarting network interfaces.
  • The teamd daemon enables on-the-fly modifications for better flexibility.

4. Multiple Runner Modes for Custom Configurations

  • Supports different modes like active-backup, round-robin, and LACP, allowing customization based on network requirements.
  • Provides better control over how traffic is distributed and managed.

5. Enhanced Performance for High-Traffic Environments

  • Ideal for data centers, enterprise servers, and virtualized environments where high-speed, uninterrupted connectivity is crucial.
  • Reduces bottlenecks by efficiently distributing network traffic.

6. Better Compatibility with Modern Linux Systems

  • NIC Teaming is natively supported in RHEL 7+, Fedora, and other modern Linux distributions.
  • Offers better integration with systemd and advanced network management tools.

7. Efficient Use of Network Resources

  • Maximizes network efficiency by using multiple NICs more effectively.
  • Prevents idle network interfaces by dynamically allocating traffic.

NIC Teaming in Linux is a more flexible and modern alternative to NIC Bonding, offering real-time configurability, better load balancing, and improved failover support. It is a must-have for businesses and enterprises that require high availability, fault tolerance, and optimized network performance.

Conclusion: Enhance Network Resilience with NIC Teaming in Linux

Setting up NIC teaming in Linux provides a more efficient and dynamic way to manage multiple network interfaces, ensuring better performance, redundancy, and failover protection. With features like real-time configurability and multiple runner modes, teaming is a great choice for modern Linux environments that require network scalability.

By following this guide, you’ve successfully configured NIC teaming to enhance network reliability and performance. Now, you’re ready to take full advantage of this robust networking solution for better traffic management and fault tolerance in your Linux infrastructure.

Was this article of use to you? Post your insightful thoughts or recommendations in the comments section if you don’t find this article to be helpful or if you see any outdated information, a problem, or a typo to help this article better.

Related Posts


About Author

Photo of author

Jay

I specialize in web development, hosting solutions, and technical support, offering a unique blend of expertise in crafting websites, troubleshooting complex server issues, and optimizing web performance. With a passion for empowering businesses and individuals online, I provide in-depth reviews, tech tutorials, and practical guides to simplify the digital landscape. My goal is to deliver clear, reliable, and insightful content that helps readers make informed decisions and enhance their online presence.

Leave a Comment