centos 5.4/6.* 双网卡绑定

修改网卡配置文件
cd /etc/sysconfig/network-scripts/
mkdir back
cp ifcfg-eth0 ifcfg-eth1 back
cp ifcfg-eth0 ifcfg-bond0

vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
BOOTPROT=none
ONBOOT=yes
TYPE=Ethernet
MASTER=bond0
SLAVE=yes

vi /etc/sysconfig/network-scripts/ifcfg-eth1
DEVICE=eth1
BOOTPROT=none
ONBOOT=yes
TYPE=Ethernet
MASTER=bond0
SLAVE=yes

vi /etc/sysconfig/network-scripts/ifcfg-bond0
DEVICE=bond0
BOOTPROTO=none
BROADCAST=192.168.65.255
IPADDR=192.168.65.253
NETMASK=255.255.255.0
NETWORK=192.168.65.0
ONBOOT=yes
GATEWAY=192.168.65.1
TYPE=Ethernet


在模块文件中添加以下内容:
#RHEL6.*版本修改:
#vim /etc/modprobe.d/dist.conf

vi /etc/modprobe.conf
......
alias bond0 bonding
options bond0 miimon=100 mode=1            
#0,mode=0表示load balancing (round-robin)为负载均衡方式,两块网卡都工作。
#mode=1表示fault-tolerance (active-backup)提供冗余功能,工作方式是主备的工作方式,也就是说默认情况下

只有一块网卡工作,另一块做备份.

在开机启动文件中添加以下内容:
vi /etc/rc.d/rc.local
......
touch /var/lock/subsys/local
ifenslave bond0 eth0 eth1

重启网络服务:
service network restart


查看绑定的网卡状态
cat /proc/net/bonding/bond0

ifdown eth1
检测连通状态