In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >
Share
Shulou(Shulou.com)06/01 Report--
I. bonding technology
Bonding (binding) is a kind of network card binding technology in linux system, which can abstract (bind) n physical network cards on the server into a logical network card in the system, which can improve network throughput, realize network redundancy, load and other functions, and has many advantages.
Bonding technology is implemented at the kernel level of the linux system, and it is a kernel module (driver). Use it requires the system to have this module, we can modinfo command to view the information of this module, generally supported.
# modinfo bonding
There are seven working modes of bonding:
Bonding technology provides seven working modes, one of which needs to be specified when using, each with its own advantages and disadvantages.
Both balance-rr (mode=0) network cards work, but the switch ports connected to the network cards must be specially configured (the two ports should be aggregated) because the two network cards for bonding use the same MAC address.
Active-backup (mode=1) indicates that fault-tolerance (active-backup) provides redundancy and works in an active / standby way, that is, by default, only one network card works and the other is backed up. Bonding can only provide link monitoring, that is, whether the link from the host to the switch is connected. If only the external link down of the switch is down and the switch itself is not down, then bonding will continue to use the link as if there is nothing wrong with it. Miimon is used for link monitoring. For example: miimon=80, then the system monitors the link connection status every 100ms, and if one line fails, it will be transferred to another line.
Mode=2 indicates that XOR policy is a balancing strategy. This mode provides load balancing and fault tolerance.
Mode=3 indicates that broadcast is a broadcast policy. This model provides fault tolerance.
Mode=4 indicates that IEEE 802.3ad Dynamic link aggregation is IEEE 802.3ad for dynamic link aggregation. This policy can be changed from the default XOR policy to other policies through the xmit_hash_policy option.
Mode=5 indicates that Adaptive transmit load balancing is the load balancing of adapter transport. A necessary condition for this mode: ethtool supports getting the rate of each slave
Balance-alb (mode=6) has high availability (fault tolerance) and load balancing functions, and does not require switch configuration (traffic distribution to each interface is not particularly balanced). The two network cards for bonding use different MAC addresses.
II. Configure bonding for Centos7
Environment:
System: Centos7
Nic: em1, em2
Bond0:172.16.10.183
Load pattern: mode6 (adaptive load balancing)
Two physical network cards on the server, em1 and em2, are bound into a logical network card bond0,bonding mode to select mode6
Note: the ip address is configured on the bond0, and the physical Nic does not need to configure the ip address.
1. Shut down and stop the NetworkManager service
Systemctl stop NetworkManager.service # stop NetworkManager service systemctl disable NetworkManager.service # disable startup of NetworkManager service
Ps: be sure to turn it off. It will interfere with bonding.
2. Load bonding module
Modprobe-first-time bonding
There is no prompt to indicate that the loading is successful. If modprobe: ERROR: could not insert 'bonding': Module already in kernel appears, it means that you have already loaded this module. Never mind.
You can also use lsmod | grep bonding to see if the module is loaded
Lsmod | grep bondingbonding 136705 0
3. Create a configuration file based on bond0 interface
Vim / etc/sysconfig/network-scripts/ifcfg-bond0
Modify it as follows, according to your situation:
DEVICE=bond0TYPE=BondIPADDR=172.16.10.183NETMASK=255.255.255.0GATEWAY=172.16.10.1DNS1=114.114.114.114USERCTL=noBOOTPROTO=noneONBOOT=yesBONDING_MASTER=yesBONDING_OPTS= "mode=6 miimon=100"
The above BONDING_OPTS= "mode=6 miimon=100" indicates that the working mode configured here is mode6 (adaptive load balancing), miimon means the frequency of monitoring network links (milliseconds), we set it to 100ms, you can also specify mode as other load modes according to your needs.
4. Modify the configuration file of em1 interface
Vim / etc/sysconfig/network-scripts/ifcfg-em1
Modify it as follows:
DEVICE=em1USERCTL=noONBOOT=yesMASTER=bond0 # needs to correspond to the value of DEVICE in the above ifcfg-bond0 configuration file SLAVE=yesBOOTPROTO=none
5. Modify the configuration file of em2 interface
Vim / etc/sysconfig/network-scripts/ifcfg-em2
Modify it as follows:
DEVICE=em2USERCTL=noONBOOT=yesMASTER=bond0 # needs to correspond to the value of DEVICE in the ifcfg-bond0 configuration file on the SLAVE=yesBOOTPROTO=none
6. Testing
Restart network services
Systemctl restart network.service
# cat / proc/net/bonding/bond0Bonding Mode: adaptive load balancing / / binding mode: currently in ald mode (mode 6), that is, high availability and load balancing mode Primary Slave: NoneCurrently Active Slave: em1MII Status: up / / API status: up (MII is abbreviated as Media Independent Interface) Meaning of interface) MII Polling Interval (ms): 100 / / interval between interface polling (here is 100ms) Up Delay (ms): 0Down Delay (ms): 0Slave Interface: em1 / / standby interface: em0MII Status: up / / interface status: up (MII is Media Independent Interface abbreviation The speed of Speed: 1000 Mbps / / port is 1000 MpbsDuplex: full / / full duplex Link Failure Count: 0 / / number of link failures: 0 Permanent HW addr: 84:2b:2b:6a:76:d4 / / permanent MAC address Slave queue ID: 0Slave Interface: em1 / / slave API: em1MII Status: up / / API status: up (MII is abbreviated as Media Independent Interface Speed: 1000 MbpsDuplex: full / / full-duplex Link Failure Count: 0 / / number of link failures: 0Permanent HW addr: 84:2b:2b:6a:76:d5 / / permanent MAC address Slave queue ID: 0
3. Configure bonding for Centos6
Centos6 configuration bonding and the above Cetons7 to do bonding is basically the same, but the configuration is somewhat different.
System: Centos6
Nic: em1, em2
Bond0:172.16.10.183
Load mode: mode1 (adaptive load balancing) # here the load mode is 1, that is, active / standby mode.
1. Shut down and stop the NetworkManager service
Service NetworkManager stopchkconfig NetworkManager off
Ps: if it is installed, turn it off. If the error indicates that it is not installed, then don't worry about it.
2. Load bonding module
Modprobe-first-time bonding
3. Create a configuration file based on bond0 interface
Vim / etc/sysconfig/network-scripts/ifcfg-bond0
Modify it as follows (according to your needs):
DEVICE=bond0TYPE=BondBOOTPROTO=noneONBOOT=yesIPADDR=172.16.10.183NETMASK=255.255.255.0GATEWAY=172.16.10.1DNS1=114.114.114.114USERCTL=noBONDING_OPTS= "mode=6 miimon=100"
4. Load the bond0 interface to the kernel
Vi / etc/modprobe.d/bonding.conf
Modify it as follows:
Alias bond0 bonding
5. Edit the interface files of em1 and em2
Vim / etc/sysconfig/network-scripts/ifcfg-em1
Modify it as follows:
DEVICE=em1MASTER=bond0SLAVE=yesUSERCTL=noONBOOT=yesBOOTPROTO=none
Vim / etc/sysconfig/network-scripts/ifcfg-em2
Modify it as follows:
DEVICE=em2MASTER=bond0SLAVE=yesUSERCTL=noONBOOT=yesBOOTPROTO=none
6. Load module, restart network and test
Modprobe bonding
Service network restart
7. View the status of the bondo interface
Cat / proc/net/bonding/bond0
The current load mode of Bonding Mode: fault-tolerance (active-backup) # bond0 interface is active / standby mode Primary Slave: NoneCurrently Active Slave: em2MII Status: upMII Polling Interval (ms): 100Up Delay (ms): 0Down Delay (ms): 0Slave Interface: em1MII Status: upSpeed: 1000 MbpsDuplex: fullLink Failure Count: 2Permanent HW addr: 84:2b:2b:6a:76:d4Slave queue ID: 0Slave Interface: em2MII Status: upSpeed: 1000 MbpsDuplex: fullLink Failure Count: 0Permanent HW addr: 84:2b:2b:6a:76:d5Slave queue ID: 0
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.