Network Team, Network Team
Network Group team: Aggregates multiple network cards for fault tolerance and throughput improvement.
1. Create a network group Interface
Nmcli connection add type team con-name TEAMname ifname INTname [config JSON]
TEAMname indicates the connection name, INname indicates the Interface Name,
Specifies the runner mode in JSON format: '{"runner": {"name": "METHOD "}}'
METHOD can be broadcast, roundrobin, activebackup, loadbalance, lacp
(1) create a 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 IP addresses 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 a port interface (SLAVE)
This is the configuration file for generating group members.
Note: This configuration file and the NIC 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 the name of the NIC to be added to the network group), and TEAMnmae specifies the Network Group.
If the connection name is not specified, the default value is team-slave-IFACE.
Create an interface group
Ens34 and ens38 NICs 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 a 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. view 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
20174_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 a network group
(1) disconnect
[Root @ centos7 ~] # Nmcli connection down team0
Connection 'team0' successfully deactivated (D-Bus active path:/org/freedesktop/NetworkManager/ActiveConnection/7)
View 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-bf61-413d-a2c7-289966bee1a7 802-3-ethernet --
Team0-ens38 758d0eba-1625-46b2-b539-1d853a45be6b 802-3-ethernet --
You can see that it has been disabled successfully.
(2) Delete TEAM 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) deleting a TEAM group
[Root @ centos7 ~] # Nmcli connection delete team0
Connection 'team0' (e70483a1-2688-4eb2-9466-8e732360291d) successfully deleted.
View
[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 content related to team0 is displayed, indicating that the deletion is successful.