Linux Network Management (7) Implementation of Team group in Centos7
in theLinuxin whichCentos7before, it was all usedBondmechanism to implement multiple network bindings for the sameIPaddress, to provide access to the network, and to load-balance or reincarnation management processing data according to different modes. and by theContos7after that, it provides a powerful tool fornmclitool commands, which use this tool, will regenerate specific configuration files for use by the network interface according to the configuration of the command parameters, which is convenient and flexible. In theLinuxno longer usedBondmechanism, instead of using network groupsTeammechanism to putTeamGroup as a device. The following is a case study said.
main Standby mode team Group case:
Environment View:
This is where the Linux system operates in VM virtual machines.
#这里使用了3.10 of the Linux kernel
[Email protected] ~]# uname-r3.10.0-327.el7.x86_64
#使用CentOS 7.2 Release
[Email protected] ~]# cat/etc/redhat-release CentOS Linux release 7.2.1511 (Core)
To view the network card:
[Email protected] ~]# ip-o link show up | Awk-f ': ' {print $} ' loeth0eth1[[email protected] ~]# IP link show up
650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M01/87/1E/wKioL1fVC4LCMqpcAAAnMnXAKPk194.png "title=" View the link device. png "alt=" wkiol1fvc4lcmqpcaaanmnxakpk194.png " />
Note: This removes the LO local network loopback device, which has two enabled network cards:eth0,eth1.
To Create a Team network group:
#创建一个team设备, the name is TEAM0, and the main standby mode is used:
[[email protected] ~]# nmcli connection Add con-name team0 type team ifname team0 config ' {"Runer": {"name": "Activebackup"} } ' Connection ' Team0 ' (B9F8FDCC-8682-4B2E-BDC1-3EDA2AEF70D3) successfully added.
#设置 IP, Gateway, and other information for the team0 Group :
1, set to the IP Address acquisition mode, you can enter a non-existent command, to obtain help information
[Email protected] ~]# NMCLI connection Modify Team0 ipv4.addresses 10.1.250.111/16 ipv4.gateway 10.1.0.1 ipv4.method Help error:failed to modify Ipv4.method: "Help" not among [auto, link-local, Manual, GKFX, disabled].
2. through the above we found 5 , where manual is a static IP address, so set method to be Manual
[Email protected] ~]# NMCLI connection Modify Team0 ipv4.addresses 10.1.250.111/16 ipv4.gateway 10.1.0.1 Ipv4.method Manu Al
3. See if the team0 device connection has been created
[[email protected] ~]# NMCLI connection show NAME UUID TYPE DEVICE System eth0 5fb06bd0-0bb0-7ffb-45f1-d6edd65f3e03 802-3-ethernet eth0 team0 B9F8FDCC-8682-4B2E-BDC1-3EDA2AEF70D3 Team team0 System eth1 9C92FAD9-6ECB-3E6C-EB4D-8A47C6F50C04 802-3-ethernet eth1
Description: TEAM0 is the device that was just created,theteam is represented as a network group device, and the other configuration that represents the two net cards is identified by the nmcli tool.
4 . Check the IP acquisition mode of team0 :
[Email protected] ~]# nmcli connection Show Team0 | Grep-a 4 ' ^ipv4\.method ' Ipv4.method: manual #这里表示使用静态IP获取ipv4. DNS: #创建时并未指定DNSipv4. Dns-search: Ipv4.addresses: 10.1.250.111/16 #刚才设置的IP address ipv4.gateway: 10.1.0.1 #指定的网关
5. See if the configuration file is automatically generated
[Email protected] network-scripts]# ls-l/etc/sysconfig/network-scripts/ifcfg-team0-rw-r--r--. 1 root root 349 Sep 7 00:50/etc/sysconfig/network-scripts/ifcfg-team0
parsing: This profile records some information about the TEAM0 device in the same format as the previous Ethernet network card configuration information.
joins the specified Ethernet network card device to Team0 to form a network group
#将eth0 device joins the team0 Network Group and sets the device name from team0-eth0
[[email protected] network-scripts]# nmcli connection add con-name team0-eth0 type Team-slave autoconnect no ifname eth0 m Aster team0 Connection ' team0-eth0 ' (5e3d9d5c-934c-448f-8fc6-ab3b4371e812) successfully added.
#将eth1设备加入team0网路组, and set the device name to Team0-eth1
[[email protected] network-scripts]# nmcli connection add con-name team0-eth1 type Team-slave autoconnect no ifname eth1 m Aster team0 Connection ' team0-eth1 ' (bbb9bfe0-55df-4fe4-9d13-27535a4bb206) successfully added.
#查看网络组子网卡配置文件是否自动生成
[Email protected] network-scripts]# ls-l/etc/sysconfig/network-scripts/ifcfg-team0*-rw-r--r--. 1 root root 349 Sep 7 00:50/etc/sysconfig/network-scripts/ifcfg-team0-rw-r--r--. 1 root root 118 Sep 7 01:03/etc /sysconfig/network-scripts/ifcfg-team0-eth0-rw-r--r--. 1 root root 118 Sep 7 01:04/etc/sysconfig/network-scripts/ifcfg-team0-eth1
#再次查看设备连接列表
[Email protected] network-scripts]# nmcli connection showname UUID TYPE DEVICE team0-eth1 bbb9bfe0-55df-4fe4-9d13-27535a4bb206 802-3-ethernet -- System eth0 5fb06bd0-0bb0-7ffb-45f1-d6edd65f3e03 802-3-ethernet eth0 team0-eth0 5e3d9d5c-934c-448f-8fc6-ab3b4371e812 802-3-ethernet -- team0 B9F8FDCC-8682-4B2E-BDC1-3EDA2AEF70D3 Team team0 System eth1 9C92FAD9-6ECB-3E6C-EB4D-8A47C6F50C04 802-3-ethernet eth1
parsing: It is found that eth0, eth1 are not successfully bound to the TEAM0 group, because the NMCLI tool defines the mechanism that the same device can only be bound in the same configuration, that is, the configuration in the specified configuration file (Ifcfg-eth0, ifcfg-eth1) is read. Therefore, you can disconnect eth0, eth1 the original link configuration.
Activate TEAM0 Network Group member
#断开原本的eth0链接
[Email protected] network-scripts]# NMCLI device disconnect eth0
#启用team0-eth0 Network Group Devices
[Email protected] network-scripts]# nmcli connection up Team0-eth0
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M00/87/21/wKiom1fVDEfyipzvAAAIjiQhiDE772.png "title=" Enable Team0-eth0.png "alt=" Wkiom1fvdefyipzvaaaijiqhide772.png "/>#断开原本的eth1链接
[Email protected] network-scripts]# NMCLI device Disconnect eth1
#启用team0-eth1 Network Group Devices
[Email protected] network-scripts]# nmcli connection up team0-eth1
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M00/87/21/wKiom1fVDHCD30mRAAAIor3IbRo262.png "title=" Enable Team0-eth1.png "alt=" Wkiom1fvdhcd30mraaaior3ibro262.png "/>#再次查看链接
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/87/1E/wKioL1fVDIiS8bZ3AAAVlrRSxGU197.png "title=" View the link again. png "alt=" wkiol1fvdiis8bz3aaavlrrsxgu197.png " />
parsing: At this point eth1 and eth0 are already identified as member devices in the team0 , and the previous default NIC configuration and the network card has lost the binding relationship.
determine the connectivity of the network
#查看team0 device Ip address
IP Addr Show
650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M01/87/21/wKiom1fVDK_zd1S9AAAveGsSwgY164.png "title=" View TEAM0 device IP address. png "alt=" Wkiom1fvdk_zd1s9aaavegsswgy164.png "/>
Parse: Here eth0 and eth1 have been bound together to become a child of the TEAM0 Network group, common use 10.1.250.111 address.
#查看team0 routing tables and gateways
650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M01/87/21/wKiom1fVDMfxtUTUAAAJY5cmq9k221.png "title=" View Team0 device Route.png "alt=" Wkiom1fvdmfxtutuaaajy5cmq9k221.png "/>
parsing: Because two network cards are identified as TEAM0 Network group devices, the routing table also only records a single device, regardless of the data to receive data, are identified by the routing table in the network group.
test for Master and Standby mode:
#查看team0 Current usage status
[Email protected] ~]# Teamctl TEAM0 State
650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M01/87/1E/wKioL1fVDNrBZIFhAAASo2u4mbk953.png "title=" View team0 status. png "alt=" Wkiol1fvdnrbzifhaaaso2u4mbk953.png "/>
#断开 eth0 The virtual machine is used here, so the corresponding network card in the lower right corner is "disconnected", and the image is dimmed after the disconnection .
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M01/87/21/wKiom1fVDPSidlcBAAAHPp06EVA820.png "title=" Disconnect eth0.png "alt=" Wkiom1fvdpsidlcbaaahpp06eva820.png "/>
#再次查看状态
650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M00/87/1F/wKioL1fVDP6xWDZ_AAATO5febDA396.png "title=" Eth0 View team0 status after disconnecting. png "alt=" Wkiol1fvdp6xwdz_aaato5febda396.png "/>
parsing: Originally all up State, and now, ETH1 is enabled, and eth0 is already disconnected, and the number of disconnects is shown 1 times.
#再次启用eth0
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M01/87/1F/wKioL1fVDRuBCLIyAAAGw5jGFWY710.png "title=" Link Eth0.png "alt=" Wkiol1fvdrubcliyaaagw5jgfwy710.png "/>
#再次查看team0 status
650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M00/87/21/wKiom1fVDSmQFcBQAAAShjXV_wQ132.png "title=" Review the TEAM0 status after recovery. png "alt=" wkiom1fvdsmqfcbqaaashjxv_wq132.png " />
parsing: Now is enabled state, of course, if all disconnected, then TEAM0 is equivalent to the absence of active state members, also lost meaning.
This article from "Meng Tian pa-it garbage Collection Station" blog, reproduced please contact the author!
Linux Network Management (7) Implementation of Team group in CENTOS7