虚拟机

mode=1


#vi /etc/sysconfig/network-scripts/ifcfg-bond0

DEVICE=bond0
ONBOOT=yes
BOOTPROTO=none
IPADDR=10.203.5.36
#BROADCAST=10.203.5.255
NETMASK=255.255.255.0
GATEWAY=10.203.5.123
USERCTL=no
TYPE=Ethernet
BONDING_OPTS="mode=1 miimon=50"


#vi /etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE="eth0"
#HWADDR="00:0c:29:b3:8f:cc"
#NM_CONTROLLED="yes"
ONBOOT=yes
BOOTPROTO=none
MASTER=bond0
SLAVE=yes
USERCTL=no


#vi /etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE="eth1"
#HWADDR="00:0c:29:b3:8f:cc"
#NM_CONTROLLED="yes"
ONBOOT=yes
BOOTPROTO=none
MASTER=bond0
SLAVE=yes
USERCTL=no


# vi /etc/modprobe.d/bonding.conf

alias bond0 bonding


#vi /etc/rc.d/rc.loacl

modprobe bonding

ifenslave bond0 eth0 eth1


遇到的问题是:当ifconfig eth0 down 时,没法上外网;eth1自动切换成功。也可以ping通自己的ip