网卡的7种bond模式

1、bond模式html

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

  Mode=1(active-backup) 表示主备模式,只有一块网卡是active,另一块是备的standby,这时若是交换机配的是捆绑,将不能正常工做,由于交换机往两块网卡发包,有一半包是丢弃的服务器

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

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

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

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

  Mode=6(balance-alb) 在5的tlb基础上增长了rlbhtm

2、交换机设置blog

  mode 一、五、6不须要交换机设置
  mode 0、二、3须要交换机设置静态聚合,mode 4须要交换机支持802.3adip

3、网卡配置文件

  2个物理网口分别是:eth0,eth1

  绑定后的虚拟口是:bond0

  服务器IP是:192.168.0.100

1)修改eth0配置文件
vim /etc/sysconfig/network-scripts/ifcfg-eth0
  DEVICE=eth0
  BOOTPROTO=none
  MASTER=bond0
  SLAVE=yes
  ONBOOT=yes
2)修改eth1配置文件  
vim /etc/sysconfig/network-scripts/ifcfg-eth1
  DEVICE=eth1
  BOOTPROTO=none
  MASTER=bond0
  SLAVE=yes
  ONBOOT=yes

3)修改bond0配置文件  

vim /etc/sysconfig/network-scripts/ifcfg-bond0
  DEVICE=bond0
  BOOTPROTO=static
  IPADDR=192.168.0.100
  NETMASK=255.255.255.0
  ONBOOT=yes
4)修改bonding配置文件
      CentOS6追加写/etc/modprobe.d/dist.conf,CentOS7新建写/etc/modprobe.d/bonding.conf  
alias bond0 bonding
options bond0 miimon=100 mode=6
5)加载bonding模块 
modprobe bonding

确认模块是否加载成功

lsmod |grep bonding

6)重启网络

service network restart

查看bond

cat /proc/net/bonding/bond0

4、设置多个bond

1)多个bond口的模式设成相同

alias bond0 bonding
alias bond1 bonding
options bonding max_bonds=2 miimon=100 mode=6
2)不一样的bond口mode设成不同
alias bond0 bonding
options bond0 miimon=100 mode=1
install bond1 /sbin/modprobe bonding -o bond1 miimon=100 mode=0 

  miimon:监视网络连接的频度,单位是毫秒,咱们设置的是100毫秒

  max_bonds:配置的bond口个数

  mode:bond模式,在通常的实际应用中,0和1用的比较多

 

参考:http://www.cnblogs.com/lcword/p/5914089.html

相关文章
相关标签/搜索