1、配置bond网络
一、ifcfg-bond0ide
# Broadcom Corporation NetXtreme BCM5720 Gigabit Ethernet PCIe测试
DEVICE=bond0spa
BOOTPROTO=staticrest
ONBOOT=yesip
IPADDR=10.0.40.20ci
NETMASK=255.255.255.0rem
GATEWAY=10.0.40.254it
USERCTL=noio
二、ifcfg-eth0
# Broadcom Corporation NetXtreme BCM5720 Gigabit Ethernet PCIe
DEVICE=eth0
BOOTPROTO=static
ONBOOT=yes
MASTER=bond0
SLAVE=yes
USERCTL=no
三、ifcfg-eth1
# Broadcom Corporation NetXtreme BCM5720 Gigabit Ethernet PCIe
DEVICE=eth1
BOOTPROTO=static
ONBOOT=yes
MASTER=bond0
SLAVE=yes
USERCTL=no
四、/etc/modprobe.conf配置
alias eth0 tg3
alias eth1 tg3
alias eth2 bnx2
alias eth3 bnx2
alias scsi_hostadapter megaraid_sas
alias scsi_hostadapter1 ata_piix
alias scsi_hostadapter2 lpfc
alias usb0 cdc_ether
alias bond0 bonding
options bond0 miimon=100 mode=1
注:网卡绑定须要同型号网卡作bonding,若是eth0和eth2作绑定后,测试冗余性时网络故障后不会切换,可是查看cat /proc/net/bongding/bond0有绑定信息。
2、查看状态
一、重启网络
/etc/init.d/network restart
二、查看bond运行状态
cat /proc/net/bonding/bond0
Ethernet Channel Bonding Driver: v3.4.0-1 (October 7, 2008)
Bonding Mode: load balancing (round-robin)
MII Status: up
MII Polling Interval (ms): 1
Up Delay (ms): 0
Down Delay (ms): 0
Slave Interface: eth0
MII Status: up
Speed: 100 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 00:50:56:a2:4d:00
Slave Interface: eth1
MII Status: up
Speed: 100 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 00:50:56:a2:4d:01
3、测试bond
一、断开eth1网口
[root@test1 network-scripts]# ifdown eth0
二、查看bond状态,eth0已经掉线,如今eth1接管
[root@test1 network-scripts]# cat /proc/net/bonding/bond0
Ethernet Channel Bonding Driver: v3.4.0-1 (October 7, 2008)
Bonding Mode: load balancing (round-robin)
MII Status: up
MII Polling Interval (ms): 1
Up Delay (ms): 0
Down Delay (ms): 0
Slave Interface: eth1
MII Status: up
Speed: 100 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 00:50:56:a2:4d:01
三、激活eth1
[root@test1 network-scripts]# ifup eth0
四、查看bond状态,eth0上线,可是网络流量仍是在eth1上跑,eth0做为备份。(以前eth0是承载流量)
[root@test1 network-scripts]# cat /proc/net/bonding/bond0
Ethernet Channel Bonding Driver: v3.4.0-1 (October 7, 2008)
Bonding Mode: load balancing (round-robin)
MII Status: up
MII Polling Interval (ms): 1
Up Delay (ms): 0
Down Delay (ms): 0
Slave Interface: eth1
MII Status: up
Speed: 100 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 00:50:56:a2:4d:01
Slave Interface: eth0
MII Status: up
Speed: 100 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 00:50:56:a2:4d:00