In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
Implementation method Bonding network group Network Teaming environment OSselinuxfirewalld network card CentOS7 shuts down eth0 and eth2Bonding
Https://www.kernel.org/doc/Documentation/networking/bonding.txt
Brief introduction
The Linux bonding driver provides a method for aggregating multiple network interfaces into a single logical "bound" interface. The behavior of the binding interface depends on the pattern. In general, the mode provides hot standby or load balancing services. In addition, link integrity monitoring can be performed
Working mode
There are 7 (0-6) modes. The default is balance-rr (loop)
Mode0 (balance-rr) loop policy: packets are transmitted sequentially from the first available slave device to the last slave device. This mode provides load balancing and fault tolerance.
Mode1 (active-backup) active-backup policy: only one slave in the binding is active. When and only when the active slave station fails, the other slave stations become active. The bound MAC address is visible externally on only one port (the network adapter) to avoid confusing the switch.
Mode2 (balance-xor): sets the XOR (XOR) policy for fault tolerance and load balancing. Using this method, the interface matches the MAC address of the incoming request with one of the MAC addresses of the slave NIC. Once the link is established, the transmission is sent out in turn from the first available interface.
Mode3 (broadcast) broadcast policy: all content is transmitted on all slave interfaces. This mode provides fault tolerance.
Mode4 (802.3ad): sets the IEEE802.3ad dynamic link aggregation policy. Create aggregation groups that share the same speed and duplex settings. Send and receive on all slaves in the active aggregator. A switch that meets the 802.3ad requirements is required
Mode5 (balance-tlb): sets the Transport load balancing (TLB) policy for fault tolerance and load balancing. Outgoing traffic is allocated based on the current load on each slave interface. Incoming traffic is currently received from the station. If the receiver slave station fails, another slave station will take over the MAC address of the failed slave station.
Mode6 (balance-alb): setup and active load balancing (ALB) policies are used for fault tolerance and load balancing. It includes sending and receiving of IPV4 traffic and load balancing. Achieve receiving load balance through ARP negotiation
Configuration is achieved through the nmcli command
View the status of added eth0 and eth2 network cards
[root@CentOS7] # nmcli dev statusDEVICE TYPE STATE CONNECTION eth0 ethernet disconnected-eth2 ethernet disconnected--
1) use active-backup mode to add bonding interface
[root@CentOS7] # nmcli con add type bond con-name bond01 ifname bond0 mode active-backup Connection 'bond01' (ca0305ce-110c-4411-a48e-5952a2c72716) successfully added.
2) add slave interface
[root@CentOS7] # nmcli con add type bond-slave con-name bond01-slave0 ifname eth0 master bond0Connection 'bond01-slave0' (5dd5a90c-9a2f-4f1d-8fcc-c7f4b333e3d2) successfully added. [root@CentOS7 ~] # nmcli con add type bond-slave con-name bond01-slave1 ifname eth2 master bond0Connection' bond01-slave1' (a8989d38-cc0b-4a4e-942d-3a2e1eb8f95b) successfully added. Note: if you do not provide a connection name for the slave interface, the name is made up of type and interface name
3) start the slave interface
[root@CentOS7 ~] # nmcli con up bond01-slave0 Connection successfully activated (D-Bus active path: / org/freedesktop/NetworkManager/ActiveConnection/14) [root@CentOS7 ~] # nmcli con up bond01-slave1Connection successfully activated (D-Bus active path: / org/freedesktop/NetworkManager/ActiveConnection/15)
4) start the bond interface
[root@CentOS7 ~] # nmcli con up bond01Connection successfully activated (master waiting for slaves) (D-Bus active path: / org/freedesktop/NetworkManager/ActiveConnection/16)
5) View bond status
[root@CentOS7 ~] # cat / proc/net/bonding/bond0 Ethernet Channel Bonding Driver: v3.7.1 (April 27 2011) Bonding Mode: fault-tolerance (active-backup) Primary Slave: NoneCurrently Active Slave: eth0MII Status: upMII Polling Interval (ms): 100Up Delay (ms): 0Down Delay (ms): 0Slave Interface: eth0MII Status: upSpeed: 1000 MbpsDuplex: fullLink Failure Count: 0Permanent HW addr: 00:0c:29:08:2a:73Slave queue ID: 0Slave Interface: eth2MII Status: upSpeed: 1000 MbpsDuplex: fullLink Failure Count: 0Permanent HW addr: 00:0c:29:08:2a:7dSlave queue ID: 0 can be found from the above results that the current active slave is eth0
6) testing
Ping the local bond0 interface ip on another Linux host, and then artificially disconnect the eth0 network card to see if the master / slave handover will occur.
View native bond0 interface ip
[root@CentOS7 ~] # ip ad show dev bond0 | sed-rn '3sroom.* (. *) / 24. #\ 1#p'192.168.8.129 [root@CentOS6 ~] # ping 192.168.8.129PING 192.168.129 (192.168.129) 56 (84) bytes of data.64 bytes from 192.168.129: icmp_seq=1 ttl=64 time=0.600 ms64 bytes from 192.168.129: icmp_seq=2 ttl=64 time=0.712 ms64 bytes from 192 .168.8.129: icmp_seq=3 ttl=64 time=2.20 ms64 bytes from 192.168.8.129: icmp_seq=4 ttl=64 time=0.986 ms64 bytes from 192.168.8.129: icmp_seq=7 ttl=64 time=0.432 ms64 bytes from 192.168.8.129: icmp_seq=8 ttl=64 time=0.700 ms64 bytes from 192.168.8.129: icmp_seq=9 ttl=64 time=0.571 Ms ^ C-- 192.168.129 ping statistics-9 packets transmitted 7 received, 22% packet loss, time 8679msrtt min/avg/max/mdev = 0.432 ms 0.887 ms
When the other host, ping, disconnected the eth0 network card and found that two packets were lost in the middle.
[root@CentOS7 ~] # cat / proc/net/bonding/bond0 Ethernet Channel Bonding Driver: v3.7.1 (April 27 2011) Bonding Mode: fault-tolerance (active-backup) Primary Slave: NoneCurrently Active Slave: eth2MII Status: upMII Polling Interval (ms): 100Up Delay (ms): 0Down Delay (ms): 0Slave Interface: eth0MII Status: downSpeed: UnknownDuplex: UnknownLink Failure Count: 4Permanent HW addr: 00:0c:29:08:2a:73Slave queue ID: 0Slave Interface: eth2MII Status: upSpeed: 1000 MbpsDuplex: fullLink Failure Count: 2Permanent HW addr: 00:0c:29:08:2a:7dSlave queue ID: 0
Check that the current active slave is eth2, indicating that the master / slave switch is successful.
MII Polling Interval (ms): specifies (in milliseconds) how often MII link monitoring occurs. This is useful if high availability is required because MII is used to verify that NIC is active
The configuration file that is automatically generated after the nmcli command is configured
[root@CentOS7 ~] # cd / etc/sysconfig/network-scripts/ [root@CentOS7 network-scripts] # ls ifcfg-bond*ifcfg-bond01 ifcfg-bond-slave-eth0 ifcfg-bond-slave-eth2 [root@CentOS7 network-scripts] # cat ifcfg-bond01 BONDING_OPTS=mode=active-backupTYPE=BondBONDING_MASTER=yesPROXY_METHOD=noneBROWSER_ONLY=noBOOTPROTO=dhcpDEFROUTE=yesIPV4_FAILURE_FATAL=noIPV6INIT=yesIPV6_AUTOCONF=yesIPV6_DEFROUTE=yesIPV6_FAILURE_FATAL=noIPV6_ADDR_GEN_MODE=stable-privacyNAME=bond01UUID=e5369ad8-2b8b-4cc1-aca2-67562282a637DEVICE=bond0ONBOOT=yes [root@CentOS7 network-scripts] # cat ifcfg-bond-slave-eth0 TYPE=EthernetNAME=bond01-slave0UUID=f6ed385e The configuration file of-e1ae-487d-b36a-43b13ac3f84fDEVICE=eth0ONBOOT=yesMASTER_UUID=e5369ad8-2b8b-4cc1-aca2-67562282a637MASTER=bond0SLAVE=yesbond01-slave1 is basically the same as this file. Introduction to netgroup Network Teaming to achieve link aggregation for high availability of Linux servers is the process of combining two or more network interfaces into one unit. Compared with the older version of bonding technology, team has two main advantages as follows:
Redundancy: improves network availability
Load balancing: improves network efficiency the concept and terminology of netgroups implementing Teaming by kernel drivers and teamd daemons teamd: an application daemon that uses the libteam library for load balancing and looping logic. It listens and communicates through Unix domain sockets. Teamdctl: this utility is used to control running instances of teamd that use D-bus. It can be used at run time to read the configuration, link the status of the monitor, check and change the status of ports, add and remove ports, and change ports between active and backup status. Runners: a separate unit of code that implements functions unique to various load sharing and backup methods, such as polling. The user specifies the runner in the JSON format configuration file, and then compiles the code to the teamd instance when the instance is created. Team operation mode
Broadcast (broadcast): data is transmitted over all ports
Active-backup (active backup): use one port or link while keeping the other port or link for backup
Round-robin (polling): data is transmitted on all ports in turn
Loadbalance (load balancing): with active Tx load balancing and BPF-based Tx port selector
Lacp: implementing 802.3ad Link aggregation Control Protocol
Configuration is achieved through the nmcli command
1) View the status of the added eth0 and eth2 Nic
[root@CentOS7] # nmcli dev statusDEVICE TYPE STATE CONNECTION eth0 ethernet disconnected-eth2 ethernet disconnected--
2) use activebackup mode to add a netgroup interface named team0
[root@CentOS7 ~] # nmcli con add type team ifname team0 con-name team0 config'{"runner": {"name": "activebackup"}} 'Connection' team0' (28b4e208-339f-4eb2-ae0f-6b07621e7685) successfully added.
3) add a slave network to a netgroup named team0
[root@CentOS7 ~] # nmcli con add type team-slave ifname eth0 con-name team0-slave0 master team0Connection 'team0-slave0' (3c1b3008-ebeb-4e2d-9790-30111f1e1271) successfully added. [root@CentOS7 ~] # nmcli con add type team-slave ifname eth2 con-name team0-slave1 master team0
4) start the netgroup and slave network
[root@CentOS7 ~] # nmcli con up team0 [root@CentOS7 ~] # nmcli con up team0-slave0 [root@CentOS7 ~] # nmcli con up team0-slave1 [root@CentOS7 ~] # nmcli dev statusDEVICE TYPE STATE CONNECTION team0 team connected team0 eth0 ethernet connected team0-slave0 eth2 ethernet connected team0-slave1
5) View netgroup status
[root@CentOS7 ~] # teamdctl team0 statesetup: runner: activebackupports: eth0 link watches: link summary: up instance [link _ watch_0]: name: ethtool link: up down count: 0 eth2 link watches: link summary: up instance [link _ watch_0]: name: ethtool link: up down count: 0runner: active port: eth0
6) testing
The configuration file that is automatically generated after the nmcli command is configured
[root@CentOS7 ~] # cd / etc/sysconfig/network-scripts/ [root@CentOS7 network-scripts] # ls ifcfg-team0* [root@CentOS7 network-scripts] # grep-v "^ IPV6" ifcfg-team0TEAM_CONFIG= "{\" runner\ ": {\" name\ ":\" activebackup\ "}" PROXY_METHOD=noneBROWSER_ONLY=noBOOTPROTO=dhcpDEFROUTE=yesIPV4_FAILURE_FATAL=noNAME=team0UUID=28b4e208-339f-4eb2-ae0f-6b07621e7685DEVICE=team0ONBOOT=yesDEVICETYPE=Team [root@CentOS7 network-scripts] # cat ifcfg-team0-slave0 NAME=team0-slave0UUID=3c1b3008-ebeb-4e2d-9790-30111f1e1271DEVICE=eth0ONBOOT=yesTEAM_MASTER=team0DEVICETYPE=TeamPort [ Root@CentOS7 network-scripts] # cat ifcfg-team0-slave1NAME=team0-slave1DEVICE=eth2ONBOOT=yesTEAM_MASTER=team0
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.