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
vim /etc/sysconfig/network-scripts/ifcfg-eth0 DEVICE=eth0 BOOTPROTO=none MASTER=bond0 SLAVE=yes ONBOOT=yes
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
alias bond0 bonding options bond0 miimon=100 mode=6
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
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用的比較多