一、配置bond
1、ifcfg-bond0
# Advanced Micro Devices [AMD] 79c970 [PCnet32 LANCE]
DEVICE=bond0
BOOTPROTO=static
ONBOOT=yes
IPADDR=10.0.26.27
NETMASK=255.255.255.0
GATEWAY=10.0.26.1
2、ifcfg-eth1
# Advanced Micro Devices [AMD] 79c970 [PCnet32 LANCE]
DEVICE=eth1
BOOTPROTO=none
ONBOOT=yes
MASTER=bond0
SLAVE=yes
3、ifcfg-eth2
# Advanced Micro Devices [AMD] 79c970 [PCnet32 LANCE]
DEVICE=eth2
BOOTPROTO=none
ONBOOT=yes
MASTER=bond0
SLAVE=yes
4、/etc/modprobe.conf配置
alias eth0 pcnet32
alias scsi_hostadapter mptbase
alias scsi_hostadapter1 mptspi
alias scsi_hostadapter2 ata_piix
alias net-pf-10 off
alias ipv6 off
options ipv6 disable=1
alias eth1 pcnet32
alias eth2 pcnet32
alias bond0 bonding
options bonding millmon=100 mode=1
二、查看状态
1、重启网络
/etc/init.d/network restart
2、查看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: eth1
MII Status: up
Speed: 100 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 00:50:56:a2:4d:00
Slave Interface: eth2
MII Status: up
Speed: 100 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 00:50:56:a2:4d:01
三、测试bond
1、断开eth1网口
[root@test1 network-scripts]# ifdown eth1
2、查看bond状态,eth1已经掉线,现在eth2接管
[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: eth2
MII Status: up
Speed: 100 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 00:50:56:a2:4d:01
3、激活eth1
[root@test1 network-scripts]# ifup eth1
4、查看bond状态,eth1上线,但是网络流量还是在eth2上跑,eth1作为备份。(之前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: eth2
MII Status: up
Speed: 100 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 00:50:56:a2:4d:01
Slave Interface: eth1
MII Status: up
Speed: 100 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 00:50:56:a2:4d:00
本文出自 “lose” 博客,请务必保留此出处http://blove.blog.51cto.com/3116850/1536064
原文地址:http://blove.blog.51cto.com/3116850/1536064