机器环境:gentoo_amd64 kernel:3.5.7
执行lspci
双网卡机器
确认内核中由编译bonding
我的编译为模块
(编译为module的话,很容易做参数控制)
修改/etc/conf.d/modules
echo "modules=\"bonding\"" >> /etc/conf.d/modules
添加模块参数
cd /etc/modprobe.d/
touch bonding.conf
在bonding.conf中添加
alias bond0 bonding
options bond0 miimon=100 mode=6
注:
#miimon是指定隔多长时间进行链路监测,单位是ms miimon=100的意思就是,每100毫秒检测网卡和交换机之间是否连通,如不通则使用另外的链路。
#mode是表示绑定口的工作模式,有0-6共7种,常用的是0和1 ,6,
#mode=0表示是round-robin的方式, 同时工作工作在负载均衡状态
#mode=1 表示冗余方式,网卡只有一个工作,一个出问题启用另外的
#mode=2 表示是balance-xor,表示提供负载均衡和和耐故障功能
#mode=3表示是broadcast,广播策略,耐故障功能。把数据以广播的方式,发给包含在该bond口内的所有网口
#mode=4表示是802.3ad ,IEEE 802.3ad动态链接集合
#mode=5表示是自动适应传输负载均衡策略。
#mode=6表示是自动适应负载均衡策略
mode:我的就选用一下6吧安装ifenslave
修改/etc/conf.d/net
####### eth0 ######### 关闭原来的配置
#config_eth0="dhcp"
####### eth0 ######### 关闭原来的配置
#config_eth1="dhcp"
#config_eth1="192.168.0.50 netmask 255.255.255.0"
#routes_eth1="default via 192.168.0.51"
####### bond0 #########
config_eth0="null"
config_eth1="null"
slaves_bond0="eth0 eth1"
config_bond0="dhcp"
depend_bond0() {
need net.eth0 net.eth1
}
我内网上用dhcp,按需配置吧
手动执行
/etc/init.d/net.bond0 start
直接运行
在local.d中会出错,/var/log/rc.log记录如下
一个/etc/local.d/*.start脚本应该是
#!/bin/bash
#
/etc/init.d/net.eth0 start
/etc/init.d/net.eth1 start
/etc/init.d/net.bond0 start
我自己机器上使用的情况
参考
http://blog.csdn.net/guowake/article/details/7022595
http://www.phpfans.net/ask/fansa1/4665947513.html
http://547502462.blog.163.com/blog/static/63304822201205111246664/ 这个很详细