RHEL Channel Bonding

1. 添加 kernel 模块

RHEL5上编辑 /etc/modprobe.conf 加入
alias bond0 bonding
options bond0 miimon=100 mode=1
 
RHEL6上新建文件 /etc/modprobe.d/bond0.conf 加入
alias bond0 bonding
 
关于 bonding 的参数设置问题,RHEL6中推荐在 /etc/modprobe.d/<bonding>.conf 中配置,/etc/modprobe.conf 已经被标记为deprecate
 

bonding参数:

miimon值表示两块网卡相互监测的时间,以ms为单位。

mode值为工作模式,可设置为高可用还是负载均衡,0为高可用(默认值),1为负载均衡,另外还有一种XOR模式。

2. 新增 bond0 配置

DEVICE=bond0
IPADDR=192.168.1.1
NETMASK=255.255.255.0
ONBOOT=yes
BOOTPROTO=none
USERCTL=no
BONDING_OPTS="MODE=1 MIIMON=1000"
#为了上网一般还会加网关和DNS,如下
GATEWAY=192.168.12.1
DNS1=8.8.8.8

3.  修改 em1 em2 配置

注意:RHEL6修改前必须先关闭 服务 NetworkManager ,原因见4
DEVICE=em<N>
BOOTPROTO=none
ONBOOT=yes
MASTER=bond0
SLAVE=yes
USERCTL=no

4.  重启网络,使配置生效

RHEL5上 service network restart 即可生效
RHEL6上 service network restart 无法生效,必须先关闭服务 NetworkManager ,且将其设置为不可自启动
service NetworkManager stop
chkconfig NetworkManager off

 

参考文档:

Using Channel Bonding

原文地址:https://www.cnblogs.com/JesseFang/p/3142237.html