In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces "detailed explanation of the configuration of Linux Bonding". In the daily operation, I believe many people have doubts about the detailed explanation of the configuration of Linux Bonding. The editor consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful for you to answer the doubts of "detailed explanation of the configuration of Linux Bonding"! Next, please follow the editor to study!
What is bonding
Multiple network cards are tied together as one network card to achieve load balancing and improve bandwidth. Linux dual network cards are bound to one IP address. The real work is to use two network cards as a virtual piece, using the same IP address, so that we can get better and faster service.
II. Configuration process
The configuration is simple and consists of four steps:
The operating system of the experiment is Redhat Linux Enterprise 3.0.
The prerequisite for binding: the chipset model is the same, and the network card should have its own independent BIOS chip.
1. Edit the virtual network interface profile and specify the network card IP
The code is as follows:
Vi / etc/sysconfig/ network-scripts/ ifcfg-bond0
[root@rhas-13 root] # cp / etc/sysconfig/network-scripts/ifcfg-eth0 ifcfg-bond0
2 # vi ifcfg-bond0
Change the first line to DEVICE=bond0
The code is as follows:
# cat ifcfg-bond0
DEVICE=bond0
BOOTPROTO=static
IPADDR=172.31.0.13
NETMASK=255.255.252.0
BROADCAST=172.31.3.254
ONBOOT=yes
TYPE=Ethernet
The idea here is not to specify the IP address, subnet mask, or ID of a single network card. Assign the above information to the virtual adapter (bonding).
The code is as follows:
[root@rhas-13 network-scripts] # cat ifcfg-eth0
DEVICE=eth0
ONBOOT=yes
BOOTPROTO=dhcp
[root@rhas-13 network-scripts] # cat ifcfg-eth2
DEVICE=eth0
ONBOOT=yes
BOOTPROTO=dhcp
3 # vi / etc/modules.conf
Edit the / etc/modules.conf file and add the following line so that the system loads the bonding module at startup and the external virtual network interface device is bond0
Add the following two lines
The code is as follows:
Alias bond0 bonding
Options bond0 miimon=100 mode=1
Description: miimon is used for link monitoring. For example: miimon=100, then the system monitors the link connection status every 100ms, and if one line fails, it will be transferred to another line; the value of mode indicates the working mode. There are four modes: 0meme, 1meme, 2meme, 3, and two are commonly used.
Mode=0 indicates that load balancing (round-robin) is a load balancing method, and both NICs work.
Mode=1 said that fault-tolerance (active-backup) provides redundancy and works in an active and standby mode, 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 faulty, then bonding will continue to use the link because there is nothing wrong with it.
4 # vi / etc/rc.d/rc.local
Add two lines
The code is as follows:
Ifenslave bond0 eth0 eth2
Route add-net 172.31.3.254 netmask 255.255.255.0 bond0
By this time the configuration has been completed and the machine is restarted.
Restart will see the following message to indicate that the configuration is successful.
.
Bringing up interface bond0 OK
Bringing up interface eth0 OK
Bringing up interface eth2 OK
The working mode of Bonding
Linux Bonding uses a rotation policy by default.
The basic categories are active / standby mode and load balancer mode:
Balance-rr (mode=0)
Round-robin strategy: packets are sent on each slave interface sequentially from beginning to end. This model provides load balancing and fault tolerance.
Active-backup (mode=1)
Active-backup (active / standby) policy: only one slave is activated in the binding. Other slave is activated when and only if the active slave interface fails. To avoid switch confusion, the bound MAC address is visible on only one external port. In version 2.6.2 of bongding and later, when a failover occurs in active and standby mode, bonding will send gratuitous ARP on the primary salve interface of one or more gratuitous ARP.bonding and all VLAN interfaces configured on the interface, as long as at least one IP address is configured on these interfaces. The gratuitous ARP sent on the VLAN interface will be accompanied by the appropriate VLAN id. This model provides fault tolerance, and primary option,documented below will affect the behavior of this model.
Balance-xor (mode=2)
XOR policy: based on the selected transport hash policy.
This model provides load balancing and fault tolerance.
Broadcast (mode=3)
Broadcast strategy: send all messages on all slave interfaces. This model provides fault tolerance.
802.3ad (mode=4)
IEEE 802.3ad dynamic link aggregation. Create aggregation groups that share the same rate and duplex mode. All slave can be used to establish aggregation links according to the 802.3ad specification. The outbound choice of Salve depends on the hash policy of the transmission. The default policy is a simple XOR policy, while the hash policy can be changed through the xmit_hash_policy option. It is important to note that not all transport strategies are compatible with 802.3ad, especially the packet mis-ordering requirements in section 43.2.4 of the 802.3ad standard. There is often a great incompatibility in the implementation of different individuals.
Prerequisites:
1. The basic driver of each slave supports Ehtool access to speed and duplex status.
two。 The switch supports IEEE 802.3ad dynamic link aggregation. Most switches need to be configured to enable 802.3ad mode.
Balance-tlb (mode=5)
Adaptive transmission load balancing: Channel binding does not require special switch support. The distribution of egress traffic depends on the current load of each slave (relative speed is calculated). Incoming traffic is received from the current slave. If there is an error in receiving the salve, the MAC address of the failed slave that the other slave takes over continues to receive.
Prerequisites:
The basic driver of each slave supports Ehtool to obtain the rate status.
Balance-alb (mode=6)
Adaptive load balancing: includes balance-tlb (Mode 5) and receive load balancing for IPV4 traffic, and does not require special switch support. Receiving load balancing is implemented through ARP negotiation. The driver of bonding intercepts the ARP Replies (ARP echo message) sent by the local machine, and rewrites the source address of the ARP message with the hardware address of one of the slave of bond, so that the server uses different hardware addresses for different devices. The received traffic of the connection established by this server is also load balanced. When the local ARP Request is sent, the bonding driver copies and saves the IP information of the node through the ARP message. When the ARP Reply,bonding driver acquires the hardware address of the node from another node, it responds to an ARP Reply containing the hardware address of the bound slave to the sending node. One problem with load balancing negotiated with ARP is that each time an ARP message is broadcast with the hardware address of bond, then the data sent by other nodes are all concentrated on one slave, and when processing ARP updates to all other nodes, each node will relearn the hardware address, resulting in traffic redistribution. When a new slave is added or an inactive slave is reactivated, it also causes received traffic to be redistributed. The received traffic load is distributed serially (rotationally) on a set of slave with the highest rate in bond.
When a link reconnects or a new slave joins, bond reinitializes the ARP Replies to all clients. The value of the updelay parameter must be equal to or greater than the forwarding delay of the switch to prevent the ARP Replies from being blocked by the switch.
Prerequisites:
1. The basic driver of each slave supports Ehtool to obtain the rate status.
two。 The basic driver supports resetting the hardware address when the device is turned on. Each slave is also required to have a unique hardware address. If curr_active_slave fails, its hardware address is replaced by the newly selected curr_active_slave hardware address
At this point, the study of "detailed explanation of the configuration of Linux Bonding" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
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.