Http://www.tektea.com/archives/1969.html.
In Enterprise and telecom Linux Server environment, network configuration will use bonding technology to do network port hardware level redundancy, prevent single point of failure of individual network port application.
Linux bond configuration is very simple, there is a lot of information on the network, here we do not introduce. In this article, we introduce the principles and shortcomings of Linux bond.
Principle
Linux Bond has two typical modes: primary and Standby, and load balancing. Regardless of the mode, bonding technology is changed by changing the network Port drive of Linux, to realize the smooth switching after the network port failure.
Main Standby mode:
Load Balancing Mode:
1. Let's look at the main standby mode.
In master and Standby mode, the Linux bonding implementation will change the MAC address of the two slave network port of Bond to the MAC address of Bond, while the MAC address of Bond is the MAC address of the main use slave network port after bond creation is started.
When the live network port fault, bond will switch to the backup network, switching process, the upper layer of the application is not aware of the impact, because bond in the drive layer, will take over the upper application of the packet, cache and so on standby network card and then sent out through the backup network card. Of course, the premise is that the switching time is very short, otherwise the buffer will overflow, after the overflow began to drop packets. The specific time value I have not verified.
2. See Load Balancing mode again
In load Balancing mode, the Linux bonding implementation can keep the MAC address of two slave network ports unchanged, the MAC address of Bond is one of the network cards , the choice of Bond MAC address is based on Bond's own implementation of an algorithm, The specific how to choose has not been studied.
Of course, here to focus on is, bond load balancing mode, requires the switch to do configuration, yes, two slave network port can be interoperable, otherwise, the packet will be very bad, basic can not be used. This is because Bond's load-balanced mode algorithm transfers packets between two ports to achieve load balancing.
Since two slave have separate MAC addresses in load Balancing mode, you might wonder if I can bind an IP address to the slave network for other purposes.
This approach is not possible.
In load Balancing mode, two slave ports are seen on the operational system as two separate MAC addresses, but when you specify a MAC address to send packets, the actual behavior that occurs is not what you expect. You specify the MAC address 1 package, this packet may go to MAC address 2 out.
This is because Bond has manipulated the two nets and changed the drive of the network. It looks like they have separate MAC addresses, in fact their MAC addresses are not independent and can only be used by Bond.
Insufficient
From the above introduction, it is easy to see the lack of bond:
Bond changes the drive of the network port, and its network port cannot be used for other purposes.
Bond has a little bit of fault monitoring above:
bond is only available for network Port MII monitoring cannot do link monitoring (link refers to native to Gateway Path) , that is, can only monitor the network port is connected (whether the network port is bright); Of course, Bond also supports the ARP Protocol link monitoring, but ARP link monitoring in some scenarios, too much consumption of resources, not worth the candle. We used to use in the actual application, the effect is really not good.