网卡阵列-bond
1.1 网卡阵列工作模式
mode 0 负载均衡
mode 1 主备
1.2 查看系统是否支持bonding模块
grep -i bonding /boot/config-2.6.32-573.el6.x86_64
CONFIG_BONDING=m
说明:
m 以模块形式加载
y 随内核启动
查看bonding模块
lsmod |grep -i bonding
bonding 131724 0
此实验 bond 包含两块物理网卡eth0 eth1
1.3 创建网卡阵列
vim /etc/sysconfig/network-scripts/ifcfg-bond0
DEVICE=bond0
TYPE=Ethernet
ONBOOT=yes
#BONDING_OPTS="miimon=100 mode=1"
BOOTPROTO=static
IPADDR=10.0.0.51
PREFIX=24
GATEWAY=10.0.0.2
vim /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
TYPE=Ethernet
ONBOOT=yes
BOOTPROTO=none
SLAVE=yes
MASTER=bond0
vim /etc/sysconfig/network-scripts/ifcfg-eth1
DEVICE=eth1
TYPE=Ethernet
ONBOOT=yes
BOOTPROTO=none
SLAVE=yes
MASTER=bond0
1.4 bond配置文件
vim /etc/modprobe.d/dist.conf
在文件末尾添加:
alias bond0 bonding
options bond0 miimon=100 mode=1
1.5 配置开机加载bonding模块
echo "modprobe bonding" >>/etc/rc.local
配置完成后,重启网络服务
1.6 查看bond状态
[root@db01 ~]# cat /proc/net/bonding/bond0
Ethernet Channel Bonding Driver: v3.7.1 (April 27,2011)
Bonding Mode: fault-tolerance (active-backup)
Primary Slave: None
Currently Active Slave: eth0
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 0
Down Delay (ms): 0
Slave Interface: eth0
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 1
Permanent HW addr: 00:0c:29:c0:84:af
Slave queue ID: 0
Slave Interface: eth1
MII Status: down
Speed: Unknown
Duplex: Unknown
Link Failure Count: 1
Permanent HW addr: 00:0c:29:c0:84:b9
Slave queue ID: 0
1.7 验证bonding效果
拔掉一根网线,观察网络是否自动切换到另一个网卡上去,网络是否还能连通;等会拔掉另一根网线再次观察网络连通性
转载于:https://blog.51cto.com/wuxingge/1842253