User Tools

Site Tools


interface_teaming

Interface Teaming

Apr 2021


Overview


Interface teaming is the grouping of interfaces, that share a single IP Address, the OS controls which interface responds to the physical address.

There are two technologies around, Bonding and Teaming. Bonding seems to mainly be more about aggregating links, so if you have 2 x 1GB interfaces, you can in theory bond them to create a 2GB link, this does provide redundancy if one of the links goes down.

It seems that Teaming is becoming the more widely used technology for pure redundancy though, and teaming is just that, taking a couple of interfaces and making them a 'team' where either can respond (in the case that one fails).


Requirements


In this example, we are going to team two interfaces, eth0 and eth1. eth0 is already configured with a static IP Address configuration, so some editing will be required.

In short, to test teaming you will need two interfaces on your server, you can re-purpose the interface(s) being used for management, or use two free ones on another subnet.

You can either plug both interfaces in to the same vlan on a switch, or use two switches that have a link between them.


File Structure


In this example I am using CentOS, this this procedure may differ for other Linux Distros. Firstly navigate to the following directory.

  /etc/sysconfig/network-scripts/



If you list the files in this directory (ls) you will see the following:

-rw-r--r--. 1 root root   259 Apr  8 21:32 ifcfg-eth0
-rw-r--r--. 1 root root   177 Apr  8 21:31 ifcfg-eth1
-rw-r--r--. 1 root root   254 Aug 24  2018 ifcfg-lo


(I have only listed the ifcfg files, not all of the files in this directory) So this server only has two physical interfaces, eth0 and eth1.

In the ifcfg-eth0 we see the following configuration:

NAME="eth0"
DEVICE="eth0"
ONBOOT=yes
NETBOOT=yes
BOOTPROTO=static
TYPE=Ethernet
# HWADDR key is mandatory to use custom interface name: do not delete it
HWADDR=0c:c4:7a:d9:0b:0c
IPADDR=192.168.1.150
PREFIX=24
GATEWAY=192.168.1.1
DNS1=192.168.1.4
DNS2=8.8.8.8



In the eth1 file we see the following configuration:

NAME="eth1"
DEVICE="eth1"
ONBOOT=yes
NETBOOT=yes
BOOTPROTO=dhcp
TYPE=Ethernet
# HWADDR key is mandatory to use custom interface name: do not delete it
HWADDR=0c:c4:7a:d9:0b:0d


We are going to have to modify the ifcfg-eth0 and ifcfg-eth1 files, but before this we need to create a 'team' file. This file can have almost anyname you like, but mostly we see team files that have names like team0 or mngt etc.


Create Team File


The team file is going to have all the information regarding the network settings, so most of the settings that are currently in the ifcfg-eth0 in this example.

To create the team file, use the following: (use your own IP / MAC details of course)

vi /etc/sysconfig/network-scripts/ifcfg-mngt
DEVICE=mngt
DEVICETYPE=Team
ONBOOT=yes
BOOTPROTO=static
NM_CONTROLLED=yes
IPADDR=192.168.1.150
PREFIX=24
GATEWAY=192.168.1.1
DNS1=192.168.1.4
DNS2=8.8.8.8
TEAM_CONFIG='{"runner": {"name": "activebackup"}, "link_watch": {"name": "ethtool"}}'


Save this file to complete the team file creation.


Edit Interface Files


Now you can either create new interface files, or edit the existing ones. In this example I already have ifcfg-eth0 and ifcfg-eth1, so I will edit these. The reason is that they contain the correct MAC Address for the interface, and I wish to preserve this.

Edit the eth0 (or whatever your first interface file is):

vi /etc/sysconfig/network-scripts/ifcfg-eth0

NAME="eth0"
DEVICE="eth0"
ONBOOT=yes
# HWADDR key is mandatory to use custom interface name: do not delete it
HWADDR=0c:c4:7a:d9:0b:0c
NM_CONTROLLED=yes
TEAM_MASTER=mngt
TEAM_PORT_CONFIG='{"prio": 100}'



Now edit your second interface file:

vi /etc/sysconfig/network-scripts/ifcfg-eth0

NAME="eth1"
DEVICE="eth1"
ONBOOT=yes
# HWADDR key is mandatory to use custom interface name: do not delete it
HWADDR=0c:c4:7a:d9:0b:0d
NM_CONTROLLED=yes
TEAM_MASTER=mngt
TEAM_PORT_CONFIG='{"prio": 100}'


Now reboot the server.


Testing


Firstly we need to know if all the interfaces came up correctly, to test this use the following:

  ip link show |grep "state UP"



In the case of the test server this shows the following output:

2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq master mngt state UP mode DEFAULT group default qlen 1000
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq master mngt state UP mode DEFAULT group default qlen 1000
4: mngt: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT group default qlen 1000


We can see that the team interface (logical) is present and that the two physical interfaces eth0 and eth1 are present.

To see the status of the interfaces we can use the follwoing command:

  teamdctl mngt state (where mngt is the name of the team)



This shows the following output:

setup:
  runner: activebackup
ports:
  eth0
    link watches:
      link summary: up
      instance[link_watch_0]:
        name: ethtool
        link: up
        down count: 0
  eth1
    link watches:
      link summary: up
      instance[link_watch_0]:
        name: ethtool
        link: up
        down count: 0
runner:
  active port: eth0


It can be see that the two interfaces (eth0 and eth1) have a link: up. At the bottom the runner is listed as having eth0 as the active port.

To test the team simply ping an IP or Name, and unplug the interfaces one at a time, as long as one interface is connected your pings will continue.

Note: some switches take some time to detect that an interface has been plugged in, this might cause an outage in your pings, the switch may need to be reconfigured to mitigate this.

Lastly check the IP Addressing is as expected. Use the following command:

  ip -br -c a


This will give a similar output to below:

lo               UNKNOWN        127.0.0.1/8 ::1/128
eth0             UP
eth1             UP
mngt             UP             192.168.1.150/24 fe80::ec4:7aff:fed9:b0c/64


Above we can see that the team mngt has the IP details, and that eth0 and eth1 are simply listed as being UP.

interface_teaming.txt · Last modified: 2023/03/09 22:35 by 127.0.0.1