viernes, 4 de marzo de 2022

Configure Network Teaming on Linux

# nmcli con show
NAME                  UUID                                  TYPE      DEVICE
ens3f1                ad4de530-d769-41da-8106-492aa6935249  ethernet  ens3f1
eno1np0               fdc36552-aa7f-4c55-b4d6-dabcf3c290b6  ethernet  --
eno2np1               de2f6e48-7eb7-405b-9723-5chabad0d3b5  ethernet  --
ens1f0np0             6cad5f98-2816-4cc9-bf93-98241e08b483  ethernet  --
ens1f1np1             47224338-e98a-4051-b249-eeab9ff73d4a  ethernet  --
ens3f0                702fa45f-fe83-43e3-8f2e-738d1e54d0b2  ethernet  --

Create the team interface (team0)
#nmcli con add type team con-name team0

Create the team slave and add in the group team0 as a master.
# nmcli con add type team-slave ifname ens1f0np0 master team0
# nmcli con add type team-slave ifname ens1f1np1 master team0

# nmcli con show (To validate the team slave)
team-slave-ens1f0np0  d4938d49-a828-4c11-810b-59ae893f06f8  ethernet  ens1f0np0
team-slave-ens1f1np1  8907f12b-1c16-4146-8f02-3724e9d89224  ethernet  ens1f1np1

Add IpAddress
# nmcli con mod team0 ipv4.addresses 192.168.1.100/22

Configure Gateway
# nmcli con mod team0 ipv4.gateway 192.168.1.1

Configure DNS
# nmcli con mod team0 ipv4.dns 8.8.8.8
# nmcli con mod team0 ipv4.dns 8.8.2.2

Configure Manual mode
# nmcli con mod team0 ipv4.method manual

Configure autoconnect at startup
# nmcli con mod team0 connection.autoconnect yes

Restart the team0 (network service)
# nmcli connection down team0 && nmcli connection up team0

Check the status of your new interface.
# teamdctl nm-team state
setup:
  runner: roundrobin
ports:
  ens1f0np0
    link watches:
      link summary: up
      instance[link_watch_0]:
        name: ethtool
        link: up
        down count: 1
  ens1f1np1
    link watches:
      link summary: up
      instance[link_watch_0]:
        name: ethtool
        link: up
        down count: 1

Available team modes
round-robin – data is transmitted over all ports in turn (default mode)
loadbalance – With active Tx load balancing and BPF-based Tx port selectors
lacp – implements the 802.3ad Link Aggregation Control Protocol
broadcast – data is transmitted over all ports
active-backup – one port or link is used while others are kept as a backup