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