Network group related experiments

Keywords: Linux network

Network group is a new technology on centos7. Its function is similar to binding. It is a method of aggregating multiple network cards to achieve redundancy and improve throughput. Different from the binding technology in the old version, network group provides better performance and scalability. It is implemented by kernel drive and team D daemons.
Network groups can work in many ways (runner)
broadcast
roundrobin
activebackup
loadbalance
lacp (implements the 802.3ad Link Aggregation Control Protocol)

Experimental environment:
One CentOS7 host, two network cards.

Create a NetGroup

1. Create a network

[root@centos7 ~]# nmcli connection add con-name team0 ifname team0 type team ipv4.method manual ipv4.addresses 192.168.172.100 config '{"runner":{"name":"loadbalance"}}'
Connection 'team0' (24db0099-b9fa-4aae-ace0-9421e3c69278) successfully added.

2. Add physical network card
Add ens33 and ens37 to the NetGroup respectively

[root@centos7 ~]# nmcli connection add con-name team0-ens33 ifname ens33 type team-slave master team0
Connection 'team0-ens33' (0d00650a-e379-4c70-9f62-ba268af1a208) successfully added.
[root@centos7 ~]# nmcli connection add con-name team0-ens37 ifname ens37 type team-slave master team0
Connection 'team0-ens37' (2916ab1f-2e3c-477b-aaaf-52dfaecaaeb7) successfully added.

3. Associate the physical network card with the network group

#Because you just added the physical network card to the network group, team0-ens33 and team0-ens37 are not enabled at this time
[root@centos7 ~]# nmcli connection
NAME                UUID                                  TYPE      DEVICE 
ens33               fca2f13f-7310-4595-bbb1-e6d0e3662aff  ethernet  ens33  
team0               24db0099-b9fa-4aae-ace0-9421e3c69278  team      team0  
virbr0              803d85ba-4e80-470f-bcf5-1b22b5653026  bridge    virbr0 
Wired connection 1  3f019cd5-7685-3368-960c-101e35cd6ce7  ethernet  ens37  
team0-ens33         0d00650a-e379-4c70-9f62-ba268af1a208  ethernet  --     
team0-ens37         2916ab1f-2e3c-477b-aaaf-52dfaecaaeb7  ethernet  --   
#Associate physical network cards within a network group
[root@centos7 ~]# nmcli connection up team0-ens33
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/7)
[root@centos7 ~]# nmcli connection up team0-ens37
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/8)
#At this time, team-ens33 and team-ens37 are enabled, and the network group is created successfully
[root@centos7 ~]# nmcli connection 
NAME                UUID                                  TYPE      DEVICE 
team0               24db0099-b9fa-4aae-ace0-9421e3c69278  team      team0  
team0-ens33         0d00650a-e379-4c70-9f62-ba268af1a208  ethernet  ens33  
team0-ens37         2916ab1f-2e3c-477b-aaaf-52dfaecaaeb7  ethernet  ens37  
virbr0              803d85ba-4e80-470f-bcf5-1b22b5653026  bridge    virbr0 
ens33               fca2f13f-7310-4595-bbb1-e6d0e3662aff  ethernet  --     
Wired connection 1  3f019cd5-7685-3368-960c-101e35cd6ce7  ethernet  --   

4. View network group status

[root@centos7 ~]# teamdctl team0 state
setup:
  runner: loadbalance
ports:
  ens33
    link watches:
      link summary: up
      instance[link_watch_0]:
        name: ethtool
        link: up
        down count: 0
  ens37
    link watches:
      link summary: up
      instance[link_watch_0]:
        name: ethtool
        link: up
        down count: 0

Deleting a NetGroup

1. Delete related configuration files
Since the nmcli command automatically generates the configuration file of the network card when it is executed, you need to delete the corresponding configuration file when deleting the network group

[root@centos7 ~]# rm -vf /etc/sysconfig/network-scripts/ifcfg-team0*
removed '/etc/sysconfig/network-scripts/ifcfg-team0'
removed '/etc/sysconfig/network-scripts/ifcfg-team0-ens33'
removed '/etc/sysconfig/network-scripts/ifcfg-team0-ens37'

2. Disassociate related network cards

#Disassociate the ens33 and ens37 in the NetGroup
[root@centos7 ~]# nmcli connection down team0-ens33
Connection 'team0-ens33' successfully deactivated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/7)
[root@centos7 ~]# nmcli connection down team0-ens37
Connection 'team0-ens37' successfully deactivated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/8)
#Remove links ens33 and ens37
[root@centos7 ~]# nmcli connection delete team0-ens33
Connection 'team0-ens33' (0d00650a-e379-4c70-9f62-ba268af1a208) successfully deleted.
[root@centos7 ~]# nmcli connection delete team0-ens37
Connection 'team0-ens37' (2916ab1f-2e3c-477b-aaaf-52dfaecaaeb7) successfully deleted.

3. Delete network group

#Disable netgroups first
[root@centos7 ~]# nmcli connection down team0 
Connection 'team0' successfully deactivated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/6)
#Delete network group
[root@centos7 ~]# nmcli connection delete team0 
Connection 'team0' (24db0099-b9fa-4aae-ace0-9421e3c69278) successfully deleted.

The network group has been removed from the host

[root@centos7 ~]# nmcli connection 
NAME                UUID                                  TYPE      DEVICE 
ens33               fca2f13f-7310-4595-bbb1-e6d0e3662aff  ethernet  ens33  
virbr0              803d85ba-4e80-470f-bcf5-1b22b5653026  bridge    virbr0 
Wired connection 1  3f019cd5-7685-3368-960c-101e35cd6ce7  ethernet  ens37  

Posted by mrjameer on Tue, 03 Dec 2019 21:17:30 -0800