RHCE day 13 nmcli team network card binding

nmcli

NetworkManager command line tool
Session based network management

team

The so-called teaming technology is to bind multiple physical network cards on the same server into a virtual network card through software, that is, for the external network, this server has only one visible network card. For any application and the network of this server, this server has only one network link or only one accessible IP address.

The reason why we want to use the testing technology is not only to improve the network speed by using multiple network cards to work at the same time, but also to realize Load balancing and Fault tolerance between different network cards through testing

bonding

Network card binding can improve network redundancy, ensure network reliability and improve network speed. In order to improve network fault tolerance or throughput, general servers will adopt the strategy of binding multiple network cards.

Binding is used in RHEL5/RHEL6.

RHEL7 provides a new implementation technology, teaming, to realize the function of link aggregation. However, in RHEL7, teaming will not be used to replace bonding. They coexist. We can choose teaming or bonding

pattern

  1. broadcast mode
  2. activebackup active standby mode
  3. roundrobin rotation training mode
  4. loadbalance load balancing LACP

Case 1: configure master-slave network card

Add two network cards

View the newly added network card through ip a

nmcli device status

Activate network card:

[root@localhost ~]# nmcli device connect ens37
 Successful use 'ens37' Device activated 'b71348b5-6550-3d05-98e2-32b53291c9b4'. 

[root@localhost ~]# nmcli device connect ens38
 Successful use 'ens38' Device activated '870931c1-eff6-32d8-94dd-2e9ee2c70ebc'. 

View examples:

[root@localhost ~]# ll /usr/share/doc/teamd-1.27/example_configs/
Total consumption 64
-rw-r--r--. 1 root root 305 3 June 18, 2017 activebackup_arp_ping_1.conf
-rw-r--r--. 1 root root 465 3 June 18, 2017 activebackup_arp_ping_2.conf
-rw-r--r--. 1 root root 194 3 June 18, 2017 activebackup_ethtool_1.conf
-rw-r--r--. 1 root root 212 3 June 18, 2017 activebackup_ethtool_2.conf
-rw-r--r--. 1 root root 241 3 June 18, 2017 activebackup_ethtool_3.conf
-rw-r--r--. 1 root root 447 3 June 18, 2017 activebackup_multi_lw_1.conf
-rw-r--r--. 1 root root 285 3 June 18, 2017 activebackup_nsna_ping_1.conf
-rw-r--r--. 1 root root 318 3 June 18, 2017 activebackup_tipc.conf
-rw-r--r--. 1 root root  96 3 June 18, 2017 broadcast.conf
-rw-r--r--. 1 root root 209 3 June 18, 2017 lacp_1.conf
-rw-r--r--. 1 root root  98 3 June 18, 2017 loadbalance_1.conf
-rw-r--r--. 1 root root 140 3 June 18, 2017 loadbalance_2.conf
-rw-r--r--. 1 root root 183 3 June 18, 2017 loadbalance_3.conf
-rw-r--r--. 1 root root  93 3 June 18, 2017 random.conf
-rw-r--r--. 1 root root 244 3 June 18, 2017 roundrobin_2.conf
-rw-r--r--. 1 root root  97 3 June 18, 2017 roundrobin.conf

[root@localhost ~]# vim /usr/share/doc/teamd-1.27/example_configs/activebackup_arp_ping_1.conf

Add virtual device

[root@localhost ~]# nmcli connection add type team con-name team0 ifname team0 config '{"runner":       {"name": "activebackup"}}'

#The contents behind config are placed in '{here}', which is what has just been copied


View the virtual network card just created

Add a real slave network card to this virtual network card

[root@localhost ~]# nmcli connection add type team-slave con-name team0-port1 ifname ens37 master team0 
Connect“ team0-port1"(6f8f6a1f-c492-47b1-89fa-263a39fdb074) Successfully added.

[root@localhost ~]# nmcli connection add type team-slave con-name team0-port2 ifname ens38 master team0 
Connect“ team0-port2"(9f9216d0-c99e-42c7-994a-d59af6d955ca) Successfully added.

#But it is not enabled
[root@localhost ~]# nmcli connection show
NAME         UUID                                  TYPE      DEVICE 
ens33        35293eda-8993-4a6b-9dc4-b6272fd1e99b  ethernet  ens33  
virbr0       557822b2-a6f0-438b-ada7-f36bca5a9532  bridge    virbr0 
Wired connection 1   b71348b5-6550-3d05-98e2-32b53291c9b4  ethernet  ens37  
Wired connection 2 870931 c1-eff6-32d8-94dd-2e9ee2c70ebc  ethernet  ens38  
team0        37afc0a3-f865-43be-afb4-ed811fca14e3  team      team0  
team0-port1  6f8f6a1f-c492-47b1-89fa-263a39fdb074  ethernet  --     
team0-port2  9f9216d0-c99e-42c7-994a-d59af6d955ca  ethernet  --     

Connect the two from the network card

[root@localhost ~]# nmcli connection up team0-port1 
The connection was successfully activated( D-Bus Active path:/org/freedesktop/NetworkManager/ActiveConnection/11)

[root@localhost ~]# nmcli connection up team0-port2
 The connection was successfully activated( D-Bus Active path:/org/freedesktop/NetworkManager/ActiveConnection/12)

[root@localhost ~]# nmcli connection show
NAME         UUID                                  TYPE      DEVICE 
ens33        35293eda-8993-4a6b-9dc4-b6272fd1e99b  ethernet  ens33  
team0        37afc0a3-f865-43be-afb4-ed811fca14e3  team      team0  
team0-port1  6f8f6a1f-c492-47b1-89fa-263a39fdb074  ethernet  ens37  
team0-port2  9f9216d0-c99e-42c7-994a-d59af6d955ca  ethernet  ens38  
virbr0       557822b2-a6f0-438b-ada7-f36bca5a9532  bridge    virbr0 
Wired connection 1   b71348b5-6550-3d05-98e2-32b53291c9b4  ethernet  --     
Wired connection 2 870931 c1-eff6-32d8-94dd-2e9ee2c70ebc  ethernet  --   


View virtual devices

[root@localhost ~]# teamdctl team0 stat
setup:
  runner: activebackup		#mode
ports:
  ens37
    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
runner:
  active port: ens37		#37 is now active



Case 2: configuring a bridge network card

Create a virtual bridge network card

[root@localhost ~]# nmcli connection add type bridge con-name br1 ifname br1
 Connect“ br1"(e62b483c-c4ec-4788-a86b-a44f6ddcc142) Successfully added.

Add a real slave network card for this virtual bridge network card

[root@localhost ~]# nmcli connection add type ethernet con-name br1-slave1 ifname ens33 master br1 
Connect“ br1-slave1"(dec70999-78f0-4fe6-8823-e0cc433fb55c) Successfully added.


#It is not enabled by default after adding
[root@localhost ~]# nmcli connection show 
NAME         UUID                                  TYPE      DEVICE 
ens33        35293eda-8993-4a6b-9dc4-b6272fd1e99b  ethernet  ens33  
team0        37afc0a3-f865-43be-afb4-ed811fca14e3  team      team0  
team0-port1  6f8f6a1f-c492-47b1-89fa-263a39fdb074  ethernet  ens37  
team0-port2  9f9216d0-c99e-42c7-994a-d59af6d955ca  ethernet  ens38  
virbr0       557822b2-a6f0-438b-ada7-f36bca5a9532  bridge    virbr0 
br1          e62b483c-c4ec-4788-a86b-a44f6ddcc142  bridge    br1    
br1-slave1   dec70999-78f0-4fe6-8823-e0cc433fb55c  ethernet  --     
Wired connection 1   b71348b5-6550-3d05-98e2-32b53291c9b4  ethernet  --     
Wired connection 2 870931 c1-eff6-32d8-94dd-2e9ee2c70ebc  ethernet  --  

Start the real slave network card just added

[root@localhost ~]# nmcli connection up br1-slave1 
The connection was successfully activated( D-Bus Active path:/org/freedesktop/NetworkManager/ActiveConnection/14)

[root@localhost ~]# nmcli connection show 


View ip

Tags: Linux Operation & Maintenance Database

Posted on Sun, 05 Sep 2021 15:02:57 -0400 by Corpheous