Saturday, November 16, 2024
Google search engine
HomeGuest BlogsConfigure Network NIC Teaming on Debian 11 / Debian 10

Configure Network NIC Teaming on Debian 11 / Debian 10

Network NIC teaming can be defined as the combining of multiple network interfaces to make a single network team. This is the main solution to redundancy and high availability in workstations. With multiple network interfaces combined to create a larger pipe for traffic, a server is protected against service loss due to failures on a single link/interface and hence increased fault tolerance.

Aside from fault tolerance, Network NIC teaming is preferred because:

  • It is easy to configure.
  • Software apps are available for free download.
  • Offers fast browsing experience to the users due to increased internet speeds

Network NIC Teaming has several concepts that include:

  • Teamd – this is the teaming daemon that communicates with team devices via the Linux kernel using the libteam library.
  • Teamdctl – a utility that allows one control the teamd instances. You can check and change the port status, as well as switch between backup and active states.
  • Runners – they are units written in JSON format to implement of various NIC teaming concepts.

There are several runners(Team running modes) that include:

  • 802.3ad – This is the link aggregation mode. This method adheres to IEEE standards for link aggregation and provides both fault tolerance and increased bandwidth
  • Broadcast -data is trans out all slave interfaces hence the ‘broadcast‘ name of this particular bonding method
  • Loadbalance – it ios based on active Tx load balancing and BPF-based Tx port selectors. Traffic is transmitted across all NICs
  • Active-backup – only one network interface is active while the other interfaces in the team wait for a failure for them to be activated.
  • Round-robin – networks packets are rotated through each of the network interface cards that make up the bonded interface.

Configuring a Network NIC Teaming on Debian 11 / Debian 10 can be achieved through the steps below.

Step 1 – Install Teamd on Debian 11 / Debian 10.

To be able to configure the NIC Teaming, we need to install the Teaming daemon on Debian 11 / Debian 10.

sudo apt install teamd

Ensure Network Manager is installed.

sudo apt-get install network-manager

Start ane enable Network Manager

sudo systemctl start NetworkManager.service 
sudo systemctl enable NetworkManager.service

Step 2 – Configure Network NIC Teaming on Debian 11 / Debian 10

This guide demonstrates two methods you can use to configure Network NIC Teaming on Debian 11 / Debian 10:

  • Using the Network Manager NMCLI
  • Manually

Method 1 – Configure Network NIC Teaming Using NMCLI.

Using the Network Manager’s utility tool, we can easily configure Network NIC Teaming. Begin by identifying the network devices as below.

nmcli device status

Output:

Configure Network NIC Teaming on Debian

From the output, we will use enp1s0 and enp9s0 to create a network team. Get detailed information about the devices.

nmcli connection show

Sample output:

Configure Network NIC Teaming on Debian 1

Use the UUID provided to disconnect the two devices before proceeding.

sudo nmcli connection delete 40a3c011-f9c1-4dfc-b73b-3d80c8e291ac
sudo nmcli connection delete 4c1a8752-53c3-4f0c-933c-95e52b023835

Now verify if the devices are disconnected:

Configure Network NIC Teaming on Debian 2

With the above configuration made, we can proceed and create a network team(team1) with the runner(active-backup) to be used as below.

sudo nmcli connection add type team con-name team1 ifname team1 config '{"runner": {"name": "activebackup"}}'

Once created, view the team information using the command:

$ nmcli connection show team1
connection.id:                          team1
connection.uuid:                        71581079-6012-420b-84e2-1ddcb878d88b
connection.stable-id:                   --
connection.type:                        team
connection.interface-name:              team1
connection.autoconnect:                 yes
connection.autoconnect-priority:        0
connection.autoconnect-retries:         -1 (default)
connection.multi-connect:               0 (default)
connection.auth-retries:                -1
connection.timestamp:                   0
connection.read-only:                   no
connection.permissions:                 --
connection.zone:                        --
connection.master:                      --
connection.slave-type:                  --
connection.autoconnect-slaves:          -1 (default)
connection.secondaries:                 --

Proceed and configure the Team’s IP address, DNS, and auto-connection as below.

sudo nmcli con mod team1 ipv4.addresses 192.168.205.50/24
sudo nmcli con mod team1 ipv4.gateway 192.168.205.1
sudo nmcli con mod team1 ipv4.dns 8.8.8.8
sudo nmcli con mod team1 +ipv4.dns 8.8.4.4
sudo nmcli con mod team1 ipv4.method manual
sudo nmcli con mod team1 connection.autoconnect yes

Then add the two devices enp1s0 and enp9s0 as slaves to the team created above.

sudo nmcli con add type team-slave con-name team1-slave0 ifname enp1s0 master team1
sudo nmcli con add type team-slave con-name team1-slave1 ifname enp9s0 master team1

Verify if the slaves have been added.

$ nmcli connection show
NAME                UUID                                  TYPE      DEVICE  
Wired connection 1  560ba0ac-36ac-477d-877a-84cfe96a7a42  ethernet  enp10s0 
team1               71581079-6012-420b-84e2-1ddcb878d88b  team      team1   
team1-slave0        773fcccd-5f0c-4684-9b49-10d8aadce24e  ethernet  enp1s0  
team1-slave1        02dd3e54-b37b-43fe-b0bb-790a19cd19f7  ethernet  enp9s0

Finally, apply the changes by restarting the team.

sudo nmcli connection down team1 && sudo nmcli connection up team1

View the status of the team.

ip addr show  dev  team1

Output:

Configure Network NIC Teaming on Debian 3 2

Furthermore, using the teamdctlutility, you can view the state of the team.

sudo teamdctl team1 state

Output:

Configure Network NIC Teaming on Debian 4

From the above output, we can determine the runner being used(active-backup), the slaves on the team, and the active port(enp1s0) in the runner.

Test the Team functionality.

We can now test if the active-backup policy is working as intended. To do so, disconnect the active interface as below.

sudo nmcli device disconnect enp1s0

Now check to see the active slave.

sudo teamdctl team1 state

Output:

Configure Network NIC Teaming on Debian 5

This output prooves the team’s functionality, the active node has switched to another interface available

Delete a Team.

To delete a Network team, begin by disconnecting the team.

sudo nmcli connection down team1

Now delete the attached slaves.

sudo nmcli connection delete team1-slave0 team1-slave1

Proceed and delete the team.

sudo nmcli connection delete team1

Verify if the team has been deleted.

$ nmcli connection show 
NAME                UUID                                  TYPE      DEVICE  
Wired connection 1  560ba0ac-36ac-477d-877a-84cfe96a7a42  ethernet  enp10s0 

Method 2 – Configure Network NIC Teaming Manually.

There is yet a simplified method one can use to create a network bond by editing the network-scripts at /etc/network/interfaces

First, ensure the bonding module is installed on Debian 11 / Debian 10.

sudo apt-get install ifenslave

Reload the modules.

sudo modprobe bonding

Load the configurations into the kernel for the system to pick these configurations automatically on boot.

echo 'bonding' | sudo tee -a sudo /etc/modules 

Now edit /etc/network/interfaces as below.

sudo vim /etc/network/interfaces

In the file, add your Bond name and the slave interfaces appropriately.

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

# Teaming physical interfaces
auto enp1s0
iface enp1s0 inet manual

auto enp9s0
iface enp9s0 inet manual

##The Bond Configuration##
auto bond0
iface bond0 inet static
address 192.168.205.150
netmask 255.255.255.0
gateway 192.168.205.1
bond-mode 1
bond-primary enp9s0
bond-slaves enp9s0 enp1s0
bond-miimon 100
bond-downdelay 400
bond-updelay 800

Save the file above and activate the Network Bond.

sudo ifdown enp1s0 enp9s0
sudo ifup bond0

With the network bond up, Check its status;

sudo ifconfig

Sample Output:

Configure Network NIC Teaming on Debian 6

You can also obtain detailed Bond information as below.

sudo cat /proc/net/bonding/bond0

Sample Output:

Configure Network NIC Teaming on Debian 7

That is it, we have successfully, configured Network NIC Teaming on Debian 11 / Debian 10. I hope this was significant to you.

See more:

RELATED ARTICLES

Most Popular

Recent Comments