一、网卡绑定:
第一步:创建一个ifcfg-bondX
# vi /etc/sysconfig/network-scripts/ifcfg-bond0
DEVICE=bond0
BONDING_OPTS="mode=0 miimon=100"
BOOTPROTO=none
ONBOOT=yes
BROADCAST=192.168.0.255
IPADDR=192.168.0.180
NETMASK=255.255.255.0
NETWORK=192.168.0.0
USERCTL=no
BONDING_OPTS="mode=0 miimon=100" ,mode有多种模式实现不同的功能,
第二步:修改/etc/sysconfig/network-scripts /ifcfg-ethX
# vi /etc/sysconfig/network-scripts /ifcfg-eth0
DEVICE=eth0
BOOTPROTO=none
ONBOOT=yes
MASTER=bond0
SLAVE=yes
USERCTL=no
# vi /etc/sysconfig/network-scripts /ifcfg-eth1
DEVICE=eth1
BOOTPROTO=none
ONBOOT=yes
MASTER=bond0
SLAVE=yes
USERCTL=no
第三步:配置/etc/modprobe.conf,添加alias bond0 bonding
# vi /etc/modprobe.conf
alias eth0 e1000e
alias eth1 e1000e
alias scsi_hostadapter mptbase
alias scsi_hostadapter1 mptspi
alias bond0 bonding
第四步:重启网络服务
#service network restart
通过查看/proc/net/bonding/bond0,查看当前是用什么mode,如果是主备的话,当前是哪个网卡工作。
# cat/proc/net/bonding/bond0
Ethernet ChannelBonding Driver: v3.0.3 (March 23, 2006)
Bonding Mode: fault-tolerance (active-backup)
Primary Slave:None
Currently Active Slave: eth0
MII Status: up
MII PollingInterval (ms): 100
Up Delay (ms): 0
Down Delay (ms):0
Slave Interface:eth0
MII Status: up
Link FailureCount: 0
Permanent HWaddr: 00:0c:29:01:4f:77
Slave Interface:eth1
MII Status: up
Link FailureCount: 0
Permanent HWaddr: 00:0c:29:01:4f:8b
本栏目更多精彩内容:http://www.bianceng.cnhttp://www.bianceng.cn/OS/Linux/