linux双网卡绑定bond配置

2016-01-0417:00:39linux双网卡绑定bond配置已关闭评论 563

配置eth0

vim /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE="eth0"
BOOTPROTO="static"
ONBOOT="yes"
TYPE="Ethernet"
MASTER=bond0
SLAVE=yes

配置eth1
vim /etc/sysconfig/network-scripts/ifcfg-eth1
DEVICE="eth1"
BOOTPROTO="static"
ONBOOT="yes"
TYPE="Ethernet"
MASTER=bond0
SLAVE=yes

配置bond0
vim /etc/sysconfig/network-scripts/ifcfg-bond0
DEVICE="bond0"
BOOTPROTO="static"
GATEWAY="网关"
IPADDR="地址"
NETMASK="掩码"
NM_CONTROLLED="no"
ONBOOT="yes"
TYPE="Ethernet"

vim /etc/modprobe.d/modprobe.conf
alias bond0 bonding
options miimon=100 mode=0

miimon=100 //每100ms检测一次链路状态

查看bond0状态
cat /proc/net/bonding/bond0

bond的7种模式
mode=0 (balance-rr) Round-robin policy(平衡抡循环策略)
mode=1 //(active-backup) Active-backup policy(主-备份策略) (需要交换机支持)
mode=2 (balance-xor) XOR policy(平衡策略)
mode=3 broadcast(广播策略)
mode=4 Dynamic link aggregation (动态链接聚合) (需要交换机支持)
mode=5 (balance-tlb) Adaptive transmit load balancing(适配器传输负载均衡)
mode=6 (balance-alb) Adaptive load balancing(适配器适应性负载均衡)