网卡bond是通过把多张网卡绑定为一个逻辑网卡,实现本地网卡的冗余,带宽扩容和负载均衡。在应用部署中是一种常用的技术,我们公司基本所有的项目相关服务器都做了bond,这里总结整理,以便待查。

bond模式:

Mode=0(balance-rr) 表示负载分担round-robin,和交换机的聚合强制不协商的方式配合。

Mode=1(active-backup) 表示主备模式,只有一块网卡是active,另外一块是备的standby,这时如果交换机配的是捆绑,将不能正常工作,因为交换机往两块网卡发包,有一半包是丢弃的。

Mode=2(balance-xor) 表示XOR Hash负载分担,和交换机的聚合强制不协商方式配合。(需要xmit_hash_policy)

Mode=3(broadcast) 表示所有包从所有interface发出,这个不均衡,只有冗余机制...和交换机的聚合强制不协商方式配合。

Mode=4(802.3ad) 表示支持802.3ad协议,和交换机的聚合LACP方式配合(需要xmit_hash_policy)

Mode=5(balance-tlb) 是根据每个slave的负载情况选择slave进行发送,接收时使用当前轮到的slave

Mode=6(balance-alb) 在5的tlb基础上增加了rlb。

5和6不需要交换机端的设置,网卡能自动聚合。4需要支持802.3ad。0,2和3理论上需要静态聚合方式

但实测中0可以通过mac地址欺骗的方式在交换机不设置的情况下不太均衡地进行接收。

常用的有三种

mode=0:平衡负载模式,有自动备援,但需要”Switch”支援及设定。

mode=1:自动备援模式,其中一条线若断线,其他线路将会自动备援。

mode=6:平衡负载模式,有自动备援,不必”Switch”支援及设定。

需要说明的是如果想做成mode 0的负载均衡,仅仅设置这里options bond0 miimon=100 mode=0是不够的,与网卡相连的交换机必须做特殊配置(这两个端口应该采取聚合方式),因为做bonding的这两块网卡是使用同一个MAC地址.从 原理分析一下(bond运行在mode 0下):

mode 0下bond所绑定的网卡的IP都被修改成相同的mac地址,如果这些网卡都被接在同一个交换机,那么交换机的arp表里这个mac地址对应的端口就有 多 个,那么交换机接受到发往这个mac地址的包应该往哪个端口转发呢?正常情况下mac地址是全球唯一的,一个mac地址对应多个端口肯定使交换机迷惑 了。所以 mode0下的bond如果连接到交换机,交换机这几个端口应该采取聚合方式(cisco称 为 ethernetchannel,foundry称为portgroup),因为交换机做了聚合后,聚合下的几个端口也被捆绑成一个mac地址.我们 的解 决办法是,两个网卡接入不同的交换机即可。

mode6模式下无需配置交换机,因为做bonding的这两块网卡是使用不同的MAC地址。

来段英文的

mode=0 (Balance Round Robin) per packet

mode=1 (Active backup)

mode=2 (Balance XOR)

mode=3 (Broadcast)

mode=4 (802.3ad)

mode=5 (Balance TLB)

mode=6 (Balance ALB)

Modes of bonding :

RHEL bonding supports 7 possible “modes” for bonded interfaces. These modes determine the way in which traffic sent out of the bonded interface is actually dispersed over the real interfaces. Modes 0, 1, and 2 are by far the most commonly used among them.

Mode 0 (balance-rr)

This mode transmits packets in a sequential order from the first available slave through the last. If two real interfaces are slaves in the bond and two packets arrive destined out of the bonded interface the first will be transmitted on the first slave and the second frame will be transmitted on the second slave. The third packet will be sent on the first and so on. This provides load balancing and fault tolerance.

Mode 1 (active-backup)

Mode 1 places one of the interfaces into a backup state and will only make it active if the link is lost by the active interface. Only one slave in the bond is active at an instance of time. A different slave becomes active only when the active slave fails. This mode provides fault tolerance.

Mode 2 (balance-xor)

Transmits based on XOR formula. (Source MAC address is XOR’d with destination MAC address) modula slave count. This selects the same slave for each destination MAC address and provides load balancing and fault tolerance.

Mode 3 (broadcast)

The broadcast mode transmits everything on all slave interfaces. This mode is least used (only for a specific purpose) and provides only fault tolerance.

Mode 4 (802.3ad)

The 802.3ad mode is known as Dynamic Link Aggregation mode. It creates aggregation groups that share the same speed and duplex settings. This mode requires a switch that supports IEEE 802.3ad Dynamic link. 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 in regards 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.

Mode 5 (balance-tlb)

This is called as Adaptive transmit load balancing. The outgoing traffic is distributed according to the current load and queue on each slave interface. Incoming traffic is received by the current slave.

Mode 6 (balance-alb)

This is Adaptive load balancing mode. This includes balance-tlb + receive load balancing (rlb) for IPV4 traffic. The receive load balancing is achieved by ARP negotiation. The bonding driver intercepts the ARP Replies sent by the server on their way out and overwrites the src hw address with the unique hw address of one of the slaves in the bond such that different clients use different hw addresses for the server.

参考链接

https://www.cnblogs.com/lcword/p/5914089.html

https://www.cloudibee.com/network-bonding-modes/

bond4 交换机配置_Linux--多网卡的7种Bond模式和交换机配置相关推荐

  1. 网卡设置 多网卡的7种bond模式原理

    多网卡的7种bond模式原理 Linux 多网卡绑定 网卡绑定mode共有七种(0~6) bond0.bond1.bond2.bond3.bond4.bond5.bond6 常用的有三种 mode=0 ...

  2. 【转载】多网卡的7种bond模式原理

    多网卡的7种bond模式原理 Linux 多网卡绑定 网卡绑定mode共有七种(0~6) bond0.bond1.bond2.bond3.bond4.bond5.bond6 常用的有三种 mode=0 ...

  3. 多网卡的7种bond模式原理

    Linux 多网卡绑定 网卡绑定mode共有七种(0~6) bond0.bond1.bond2.bond3.bond4.bond5.bond6 常用的有三种 mode=0:平衡负载模式,有自动备援,但 ...

  4. linux7解绑bond命令,linux多网卡的7种bond模式原理配置

    网卡绑定的目的: 1.提高网卡的吞吐量. 2.增强网络的高可用,同时也能实现负载均衡. 网卡绑定mode共有七种(0~6) bond0.bond1.bond2.bond3.bond4.bond5.bo ...

  5. 网卡的7种bond模式

    一.bond模式 Mode=0(balance-rr) 表示负载分担round-robin,和交换机的聚合强制不协商的方式配合 Mode=1(active-backup) 表示主备模式,只有一块网卡是 ...

  6. linux bond配置步骤,七种bond模式说明

    linux bond配置步骤,七种bond模式说明 https://www.cnblogs.com/suzhigang/p/6140018.html 一.网卡绑定: 第一步:创建一个ifcfg-bon ...

  7. linux网卡汇聚模式,Linux网卡聚合 linux多网卡绑定聚合之bond模式原理

    Linux网卡聚合 linux多网卡绑定聚合之bond模式原理 发布时间:2014-10-14 09:44:35   作者:佚名   我要评论 将多个Linux网络端口绑定为一个,可以提升网络的性能, ...

  8. Linux系统bond模式原理与配置

    一.bond模式简述 多块网卡虚拟成一张,实现冗余:多张网卡对外显示一张,具有同一个IP:网络配置都会使用Bonding技术做网口硬件层面的冗余,防止单个网口应用的单点故障. 对于多物理网卡的 Bon ...

  9. 【Linux】CentOS系统网络配置—动态、静态配置及vim编辑器的3种工作模式

    目录 Centos是什么系统? 相关命令 vim编辑器的3种工作模式 命令模式<-->底线命令模式 命令模式<-->输入模式 配置系统网络(动态) 配置系统网络(静态) 配置动 ...

最新文章

  1. 写作心得——文章标题的重要性之一
  2. 1/r单中心双电子积分Li+
  3. 《Stellaris》游戏分析报告
  4. C语言使用找出二维数组所有元素中的最大值,下标
  5. 父亲的忠告:把孩子培养成普通人
  6. 领会CSS,实际中的研究
  7. php七牛持久化处理,使用七牛自定义数据处理范例
  8. 《编码规范和测试方法——C/C++版》作业 ·004——设计一个顺序表
  9. tecplot脚本在Linux系统下运行,Linux系统下安装Tecplot的步骤
  10. 10分钟了解Activity工作流
  11. 转载《港股基础知识大全》
  12. 如何快速的入门单片机?单片机自学教程有哪些?
  13. RabbitMQ实现订单30分钟超时自动关闭
  14. 程序员必学电脑计算机专业英语词汇 04 (200 单词)
  15. 戴维解惑——用iTestin云测做测试怎样拿大奖
  16. iOS 玩不转的GCD第0课时
  17. Android音乐播放器(高分课设)
  18. 开发到底要不要转行软件测试?一篇足以 最全方位分析
  19. oracle open_cursors参数配置
  20. gradle-6.5-all 快速下载

热门文章

  1. P7 P8:训练神经网络
  2. AcWing321.棋盘分割(区间DP)题解
  3. B - Frogger(最短路之多条最短路径中最大权值的最小值)
  4. Puzzle——模拟
  5. CSS中的偏僻知识点
  6. c/c++教程 - 2.4.2.6 初始化列表语法,初始化列表参数
  7. Java线程之间的协作
  8. Linux查看、运行和杀死java进程
  9. JSP和Servlet
  10. Javascript自动登录B/S系统的简单实现