将eth0和eth1绑定成bond0

1.修改配置文件:

vim /etc/sysconfig/network-script/ifcfg-eth0
DEVICE=eth0   
ONBOOT=yes0
BOOTPROTO=none0
MASTER=bond0
SLAVE=yes

对eth1的配置文件也做类似修改。

2.创建bond0配置文件:
vim /etc/sysconfig/network-scripts/ifcfg-bond0
DEVICE=bond0      
ONBOOT=yes
BOOTPROTO=static 
IPADDR=192.168.1.100     
NETMASK=255.255.255.0   
GATEWAY=192.168.1.1  

3.指定内核加载:
echo "alias bond0 bonding" >>/etc/modprobe.d/dist.conf 
echo "options bond0 miimon=100 mode=0" >> /etc/modprobe.d/dist.conf 

选项 miimon 是指定隔多长时间来进行链路监测,单位是ms。
选项 mode 是表示绑定口的工作模式,有0-7共7种模式: 
0. round robin
1.active-backup
2.load balancing (xor)
3.fault-tolerance (broadcast)
4.lacp
5.transmit load balancing
6.adaptive load balancing

注意:这一项针对centos6以上版本,之前的版本一般是修改/etc/modprobe.conf文件

4.修改开机启动时绑定:
echo "ifenslave bond0 eth0 eth1" >> /etc/rc.local

5.重启系统:
init 6

6.检查是否生效:
ifconfig 看bond0、eth0和eth1的MAC地址是否一致
cat /proc/net/bonding/bond0  可查看绑定情况


另外,不重启临时生效方法:
modprobe bonding 
ifconfig bond0 192.168.1.100 netmask 255.255.255.0
ifenslave bond0 eth0 eth1
有任何疑问请点击留言: 留言板
本文发布于http://wiki.too2.net,转载请联系本人。