分类: LINUX
2010-01-15 20:29:11
测试中发现,只有一个bond0时,一切正常,但当再增加一个bond1时,发现就不正常了,有时是bond1要根本不正常工作,有时发现bond0和bond1要那都工作在负载均衡方式,要么都工作在主备方式,而不是我们要求的bond0工作在主备方式,bond1工作在负载均衡方式,最后通过多次实验,最后终于找到了问题所在,请见我的具体测试过程:
我的操作系统版本Redhat AS 4.7:
#cat /etc/redhat-release
Red Hat Enterprise Linux AS release 4 (Nahant Update 7)
#uname -a
[root@rhel etc]# cat /etc/redhat-release
Red Hat Enterprise Linux AS release 4 (Nahant Update 7)
[root@rhel etc]# uname -a
Linux rhel 2.6.9-78.EL #1 Wed Jul 9 15:27:01 EDT 2008 i686 i686 i386 GNU/Linux
机器上有四块网卡:eth0和eth1绑定为bond0,eth2和eth3绑定为bond1,bond0使用主备模式,bond1使用负载均衡模式
/etc/modprobe.conf中bond的配置按正常的配置:
alias bond0 bonding
options bond0 -o bond0 mode=1 miimon=100
alias bond1 bonding
options bond1 -o bond1 mode=0 miimon=100
ls -l /proc/net/bonding下查看,只发现有bond0设备,没有发现bond1设备,同时发现bond0居然工作在负载均衡模式:
[root@rhel ~]# cat /proc/net/bonding/bond0
Ethernet Channel Bonding Driver: v2.6.3-rh (June 8, 2005)
Bonding Mode: load balancing (round-robin)
MII Status: up
MII Polling Interval (ms): 0
Up Delay (ms): 0
Down Delay (ms): 0
Slave Interface: eth0
MII Status: up
Link Failure Count: 0
Permanent HW addr: 08:00:27:e7:08:ed
Slave Interface: eth1
MII Status: up
Link Failure Count: 0
Permanent HW addr: 08:00:27:0f:65:f0
按Linux的bond文档上说的:
In some circumstances (typically with older distributions),
the above does not work, and the second bonding instance never sees
its options. In that case, the second options line can be substituted
as follows:
install bond1 /sbin/modprobe --ignore-install bonding -o bond1 \
mode=balance-alb miimon=50
这段说的意思是说在一些旧的系统上,第二个bond配置的参数不能被识别,建议使用:
install bond1 /sbin/modprobe --ignore-install bonding -o bond1 \
mode=balance-alb miimon=50
于是我把内容改成:
alias bond0 bonding
options bond0 -o bond0 mode=1 miimon=100
install bond1 /sbin/modprobe --ignore-install bonding -o bond1 \
mode=balance-alb miimon=50
发现两个bond网卡都是工作在负载均衡模式,很奇怪。
[root@rhel ~]# cat /proc/net/bonding/bond0
Ethernet Channel Bonding Driver: v2.6.3-rh (June 8, 2005)
Bonding Mode: load balancing (round-robin)
MII Status: up
MII Polling Interval (ms): 0
Up Delay (ms): 0
Down Delay (ms): 0
Slave Interface: eth0
MII Status: up
Link Failure Count: 0
Permanent HW addr: 08:00:27:e7:08:ed
Slave Interface: eth1
MII Status: up
Link Failure Count: 0
Permanent HW addr: 08:00:27:0f:65:f0
[root@rhel ~]# cat /proc/net/bonding/bond1
Ethernet Channel Bonding Driver: v2.6.3-rh (June 8, 2005)
Bonding Mode: load balancing (round-robin)
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 0
Down Delay (ms): 0
Slave Interface: eth2
MII Status: up
Link Failure Count: 0
Permanent HW addr: 08:00:27:af:70:b1
Slave Interface: eth3
MII Status: up
Link Failure Count: 0
Permanent HW addr: 08:00:27:7a:a9:8e
怀疑是Redhat4.7中的modprobe.conf中的options不支持-o选项
最后把配置改成:
install bond0 /sbin/modprobe bonding -o bond0 mode=1 miimon=100
install bond1 /sbin/modprobe --ignore-install bonding -o bond1 mode=0 miimon=100
再检查bond网卡的工作状态,发现工作正常了,bond0工作在主备模式,bond1工作在负载均衡模式。
结论:redhat4.7的modprobe不支持option的-o选项,如果要装载bond驱动的多个实例,需要使用install bondX XXXX命令。