Network group team: It aggregates multiple network cards together to achieve fault tolerance and improve throughput
1 Create a network group interface
nmcli connection add type team con-name TEAMname ifname INTname [config JSON]
TEAMname specifies the connection name, INname specifies the interface name,
JSON specifies the runner mode, the format is: '{" runner":{"name":"METHOD"}}'
METHOD can be broadcast, roundrobin, activebackup, loadbalance, lacp
(1) Create network interface group team0
[root@centos7 ~]# nmcli connection add type team con-name team0 ifname team0 config '{"runner":{"name":"loadbalance"}}'
Connection 'team0' (e70483a1 -2688-4eb2-9466-8e732360291d) successfully added.
(2) Configure the IP address for network group team0
[root@centos7 ~]# nmcli connection modify team0 ipv4.method manual ipv4.addresses 200.200.200.200/24 gw4 200.200.200.1
2 Create port interface (SLAVE)
is to generate group TEAM group members configuration file.
Note: This configuration file and the network card configuration file are independent of each other.
nmcli connection add type team-slave con-name SLAVEname ifname INname master TEAMname
SLAVEname specifies the connection name, INTname specifies the network interface name (equivalent to specifying the name of the network card to join the network group), TEAMnmae specifies the network group it belongs to.
If the connection name is not specified, the default is team-slave-IFACE
Create an interface group
Two network cards, ens34 and ens38, are used here
[root@centos7 ~]# nmcli connection add con-name team0-ens34 type team-slave ifname ens34 master team0
Connection 'team0-ens34' (a481fb6d-bf61-413d-a2c7-289966bee1a7 ) successfully added.
[root@centos7 ~]# nmcli connection add con-name team0-ens38 type team-slave ifname ens38 master team0
Connection 'team0-ens38' (758d0eba-1625 -46b2-b539-1d853a45be6b) successfully added.
3 Enable network group
Enable network group: nmcli connection up team0
Enable group members: nmcli connection up SLAVEname
[root@centos7 ~]# nmcli connection up team0
Connection successfully activated (master waiting for slaves) (D-Bus active path: / org/freedesktop/NetworkManager/ActiveConnection/20)
[root@centos7 ~]# nmcli connection up team0-ens34
Connection successfully activated (D-Bus active path: /org/freedesktop/ NetworkManager/ActiveConnection/23)
[root@centos7 ~]# nmcli connection up team0-ens38
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/ 24)
4 Check the network group status
teamdctl TEAMname state
[root@centos7 ~]# teamdctl team0 state
setup:
runner: loadbalance
ports:
ens34
link watches:
link summary: up
instance[link_watch_0]:
name: ethtool
link: up
down count: 0
ens38
link watches:
link summary: up
instance[link_watch_0]:
name: ethtool
link: up
down count: 0
5 Network group configuration file
(1) MASTER configuration file
[root@centos7 ~]# cat /etc/sysconfig/network-scripts/ifcfg-team0
DEVICE=team0
TEAM_CONFIG="{\"runner\":{\" name\":\"loadbalance\"}}"
BOOTPROTO=none
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
NAME=team0
UUID=e70483a1-2688-4eb2-9466-8e732360291d
ONBOOT=yes
DEVICETYPE=Team
IPADDR=200.200.200.200
PREFIX=24
GATEWAY=200.200.200.1
(2) Group member (SLAVE) configuration file
[root@centos7 ~]# cat /etc/sysconfig/network-scripts/ifcfg-team0-ens34
NAME=team0-ens34
UUID=a481fb6d-bf61-413d-a2c7-289966bee1a7
DEVICE= ens34
ONBOOT=yes
TEAM_MASTER=team0
DEVICETYPE=TeamPort
6 Delete network group
(1) Disconnect
[root@centos7 ~]# nmcli connection down team0
Connection 'team0' successfully deactivated (D- Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/7)
Check the status
[root@centos7 ~]# teamdctl team0 state
Device "team0" does not exist
[root@centos7 ~]# nmcli connection show
NAME UUID TYPE DEVICE
ens33 be9d1f2f-20e0-4282-9cb5-0da4c8b0fc7c 802-3-ethernet ens33
virbr0 8b1532d4-d99b-4201-8163-44d733302230 bridge virbr0
team0 e70483a1-2688-4eb2-9466-8e732360291d team --
team0-ens34 a481fb6d-bf 61 -413d-a2c7-289966bee1a7 802-3-ethernet --
team0-ens38 758d0eba-1625-46b2-b539-1d853a45be6b 802-3-ethernet --
You can see that it has been closed successfully
(2) Delete TEAM group members
[root@centos7 ~]# nmcli connection delete team0-ens34
Connection 'team0-ens34' (a481fb6d-bf61-413d-a2c7-289966bee1a7) successfully deleted.
[root@centos7 ~]# nmcli connection delete team0-ens38
Connection 'team0-ens38' (758d0eba-1625-46b2-b539-1d853a45be6b) successfully deleted.
(3) Delete TEAM group
[root@centos7 ~]# nmcli connection delete team0
Connection 'team0' (e70483a1-2688-4eb2-9466-8e732360291d) successfully deleted.
Check it
[root@centos7 ~]# nmcli connection show
NAME UUID TYPE DEVICE
ens33 be9d1f2f-20e0-4282-9cb5 -0da4c8b0fc7c 802-3-ethernet ens33
virbr0 8b1532d4-d99b-4201-8163-44d733302230 bridge virbr0
No team0 related content can be seen, indicating that the deletion was successful
The above is the detailed content of Detailed explanation of the steps to implement network groups. For more information, please follow other related articles on the PHP Chinese website!