First, the principle of introduction:
1, what is bonding?
The Linux bonding driver provides a network interface device bundled with a single set of network interfaces to be used for load balancing and network redundancy;
Linux Dual card binding implementation is to use two network card virtual to become a network card, the aggregation of equipment appears to be a separate Ethernet interface equipment, popular point is that two network cards have the same IP address and parallel link aggregation into a logical link work.
2. Function of bonding technology?
Bonding is mainly used in two directions:
A, to achieve load balance;
By bonding technology, the network traffic is distributed evenly to different servers and network devices to reduce the burden of the single server and network equipment, thereby improving the efficiency of the whole system.
b, the realization of network redundancy;
In the network, the reliability of network equipment is especially important, especially the network network redundancy, we can greatly improve the reliability and security of the network, in the production system, mostly through the redundancy of hardware equipment to provide server reliability and security;
3, the bonding mode:
The first model: Mod=0, that is: (BALANCE-RR) round-robin policy (balanced Whirl cycle strategy)
Features: Transmission packet sequence is transmitted sequentially (that is, the 1th package to go eth0, the next package go eth1 ....) This pattern provides load balancing and fault tolerance, but we know that if a connection or session packet is sent from a different interface and then passes through a different link, there is a good chance that the packet will arrive in a disorderly way at the client, Out-of-order packets need to be sent again, so the throughput of the network drops
Second mode: Mod=1, that is: (active-backup) active-backup policy (primary-backup policy)
Feature: Only one device is active, and when one is down another is immediately converted to a primary device by a backup. The MAC address is externally visible, and from the outside it appears that the Bond's MAC address is unique to avoid confusion in the switch (switch). This pattern provides only fault tolerance; it can be seen that the advantage of this algorithm is to provide high network connectivity availability, but its resource utilization is low, only one interface in the working state, in the case of N network interface, resource utilization is 1/n
Third mode: mod=2, i.e.: (BALANCE-XOR) XOR policy (Balance strategy)
Feature: Transmit packets based on the specified transport hash policy. The default policy is: (Source MAC address XOR destination MAC address)% slave number. Other transport policies can be specified through the Xmit_hash_policy option, which provides load balancing and fault tolerance
Mode Fourth: Mod=3, that is: Broadcast (broadcast policy)
Feature: Transmit each packet on each slave interface, this pattern provides fault tolerance
Mode Fifth: Mod=4, that is: (802.3AD) IEEE 802.3ad Dynamic Link Aggregation (IEEE 802.3ad dynamical link aggregation)
Feature: Create an aggregation group that shares the same rate and duplex settings. Multiple slave are worked under the same active aggregation under the 802.3AD specification.
The slave election for outgoing traffic is based on the transport hash policy, which can be changed from the default XOR policy to other policies through the Xmit_hash_policy option. It should be noted that not all transport strategies are 802.3AD compliant, especially given the problem of packet chaos mentioned in the 802.3AD standard 43.2.4 section. Different implementations may have different adaptations.
Necessary:
Conditional 1:ethtool support to obtain rate and duplex settings for each slave
Conditional 2:switch (switch) supports IEEE 802.3ad Dynamic link Aggregation
Condition 3: Most switch (switches) require a specific configuration to support 802.3ad mode
Mode sixth: Mod=5, that is: (BALANCE-TLB) Adaptive Transmit load balancing (adapter transport load Balancing)
Features: Channel bonding that do not require any special switch (switch) support. The outgoing traffic is allocated on each slave according to the current load (calculated according to the speed). If the slave that is receiving the data fails, another slave takes over the MAC address of the failed slave.
The necessary condition for this pattern: ethtool support Gets the rate of each slave
Mode seventh: Mod=6, i.e.: (BALANCE-ALB) Adaptive load Balancing (adapter Adaptive load Balancing)
Feature: This pattern includes the balance-tlb mode, coupled with receive load balancing for IPV4 traffic (receive load balance, RLB), and does not require any switch (switch) support. Receive load balancing is implemented through ARP negotiation. The bonding driver intercepts the ARP reply sent by the native and rewrites the source hardware address as the only hardware address of a slave in the bond, allowing different pairs to communicate using different hardware addresses.