先描述一下我的想法,以此回答一下上面兄弟的问题:
1、我只有2张网卡,需要使用2个IP,最简单的方法当然是一个网卡一个IP了。但是,我希望这两张网卡能:负载均衡并热备。所以需要:双网卡设置两个bonding设备。
2、我的想法是,eth0与eth1模拟一个bond0,然后eth0:1与eth1:1模拟一个bond1,这样就达到目的了。
3、原帖的第二行说了“设置bond0已经实现。”,现在碰到的问题是bond1无法实现,所以后面的文字,都是针对bond1来描述的,可能造成了上面兄弟的疑惑。
再详细看了一下文档:
http://www.mjmwired.net/kernel/D ... working/bonding.txt
QUOTE:max_bonds
Specifies the number of bonding devices to create for this
instance of the bonding driver. E.g., if max_bonds is 3, and
the bonding driver is not already loaded, then bond0, bond1
and bond2 will be created. The default value is 1. Specifying
a value of 0 will load bonding, but will not create any devices.
原来要在/etc/modprobe.conf的options内指定数量的。默认是1,所以bond1我创建不起来。
再然后,再看下一节:
QUOTE:3.1.2 Configuring Multiple Bonds with Sysconfig
-----------------------------------------------
The sysconfig network initialization system is capable of
handling multiple bonding devices. All that is necessary is for each
bonding instance to have an appropriately configured ifcfg-bondX file
(as described above). Do not specify the "max_bonds" parameter to any
instance of bonding, as this will confuse sysconfig. If you require
multiple bonding devices with identical parameters, create multiple
ifcfg-bondX files.
Because the sysconfig scripts supply the bonding module
options in the ifcfg-bondX file, it is not necessary to add them to
the system /etc/modules.conf or /etc/modprobe.conf configuration file.
这里说,使用sysconfig脚本来初始化网络的系统,可以直接识别多个bonding设备,只需要设置多个ifcfg-bondX文件就好了。
看起来有点矛盾了吧?那我到底在/etc/modprobe.conf内要不要增加:
options bond1 miimon=100 mode=0
这行呢?
在options里面,要不要添加 max_bonds=2参数呢?
我需要再测试一下。
有条件的兄弟现在可以测试测试,我手上暂时没环境,要回家才可以。