在Linux下,您可以将多个networking接口组合成一个“绑定”networking接口来提供故障转移。
但有几种模式,其中一些模式不需要开关支持。 我没有限制在我的开关,我可以使用任何模式。
然而,在阅读不同的模式时,并不清楚每个模式的优缺点。
故障切换的最大因素是检测到链路故障的速度。 从主机拔下电缆,他们将工作得很好。 在一个死活的交换机上留下一个实时链接,大多数模式(除了那些支持beacon / keepalive的模式)都会将你的部分stream量发送到任何地方。
一般来说networkingstream量是由中断驱动的。 各种哈希algorithm不会产生有意义的差异。
任何不是主动/备用或广播的模式都将在不同程度上共享stream量。 有些模式可以在每个数据包的基础上进行平衡,有些模式可以按照每个stream量进行工作 前者将更均匀地分散负载,而后者在实际networking中更有用(读取:function/稳定)。
是的 – 每种模式都有限制,但我们需要了解更多关于您的应用程序的信息。
只有LACP / 802.3ad(模式4)明确要求在交换机上支持。 这就是说,仅仅因为你以特定模式发送到交换机并不意味着交换机将以相同的方式发送给你。
我倾向于生产的唯一模式是802.3ad,它具有适当configuration的交换机,将确保只有正确的链路将在信道中结束,并且提供一些在业务共享中的对称性和可预测的响应。链接已closures。 这种模式还可以避免一些常见的问题(即单播泛滥)。 主动/备用也很常见。 在某些情况下可能需要其他模式,但国际海事组织往往更加痛苦。
其他基于stream量/ MAC / IP的平衡模式或主动/备用模式也可以,并且在处理非pipe理型交换机时可能需要。
其中大部分内容在您最喜爱的发行版的linux源码包的/usr/src/linux/Documentation/networking/bonding.txt文档文件中有相当详细的描述。 对于大多数模式,故障转移的速度由“miimon”参数控制,但不应设置得太低; 无论如何,正常值都在一秒以内。
这里是我完成的最好的部分:
balance-rr or 0 Round-robin policy: Transmit packets in sequential order from the first available slave through the last. This mode provides load balancing and fault tolerance. active-backup or 1 Active-backup policy: Only one slave in the bond is active. A different slave becomes active if, and only if, the active slave fails. The bond's MAC address is externally visible on only one port (network adapter) to avoid confusing the switch. This mode provides fault tolerance. The "primary" option affects the behavior of this mode. balance-xor or 2 XOR policy: Transmit based on the selected transmit hash policy. The default policy is a simple [(source MAC address XOR'd with destination MAC address) modulo slave count]. Alternate transmit policies may be selected via the xmit_hash_policy option. This mode provides load balancing and fault tolerance. broadcast or 3 Broadcast policy: transmits everything on all slave interfaces. This mode provides fault tolerance. 802.3ad or 4 IEEE 802.3ad Dynamic link aggregation. Creates aggregation groups that share the same speed and duplex settings. Utilizes all slaves in the active aggregator according to the 802.3ad specification. Slave selection for outgoing traffic is done according to the transmit hash policy, which may be changed from the default simple XOR policy via the xmit_hash_policy option. Note that not all transmit policies may be 802.3ad compliant, particularly inregards to the packet mis-ordering requirements of section 43.2.4 of the 802.3ad standard. Differing peer implementations will have varying tolerances for noncompliance. Note: Most switches will require some type of configuration to enable 802.3ad mode. balance-tlb or 5 Adaptive transmit load balancing: channel bonding that does not require any special switch support. The outgoing traffic is distributed according to the current load (computed relative to the speed) on each slave. Incoming traffic is received by the current slave. If the receiving slave fails, another slave takes over the MAC address of the failed receiving slave. balance-alb or 6 Adaptive load balancing: includes balance-tlb plus receive load balancing (rlb) for IPV4 traffic, and does not require any special switch support. When a link is reconnected or a new slave joins the bond the receive traffic is redistributed among all active slaves in the bond by initiating ARP Replies with the selected MAC address to each of the clients. The updelay parameter must be set to a value equal or greater than the switch's forwarding delay so that the ARP Replies sent to the peers will not be blocked by the switch.
balance-rr,active-backup,balance-tlb和balance-alb不需要交换机支持。
balance-rr以分段的价格来增强性能,在某些协议(CIFS)下执行得不好,而且有两个以上的接口。
所有交换机的balance-alb和balance-tlb可能无法正常工作; 经常会出现一些ARP问题(例如有些机器可能无法连接到对方)。 你可能需要调整各种设置(miimon,updelay)来获得稳定的networking。
balance-xor可能会或可能不需要交换机configuration。 您需要在HP和Cisco交换机上设置接口组( 而不是 LACP),但显然在D-Link,Netgear和Fujitsu交换机上不需要。
802.3ad在交换机端绝对需要一个LACP组。 总体来说,这是增强性能的最佳选项。
注意:无论你做什么,一个networking连接总是经过一个且只有一个物理链路。 因此,当聚合GigE接口时,即使每台计算机有4个聚合GigE接口(无论使用哪种绑定模式),从机器A到机器B的文件传输都不能达到1千兆位/秒。
内核文档回答了这些问题:
以太网绑定