CentOS 6中配置Bond多网卡负载均衡


1 设置开机加载bonding模块

  vi /etc/modprobe.d/bonding.conf 加入以下两行:

  alias bond0 bonding
  options bond0 miimon=100 mode=0 #mode0表示负载均衡

2 修改网卡配置文件

cd /etc/sysconfig/network-scripts/ ,新建ifcfg-bond0文件 ,内容如下:

DEVICE=bond0
IPADDR=192.168.106.162
NETMASK=255.255.255.0
NETWORK=192.168.106.0
ONBOOT=yes
NAME=bond0
BOOTPROTO=none
USERCTL=no
GATEWAY=192.168.106.254

修改想要做成bond的网卡的配置文件,如ifcfg-eth0、ifcfg-eth1,内容分别如下:

DEVICE=eth0
ONBOOT=yes
BOOTPROTO=none
USERCTL=no
MASTER=bond0
SLAVE=yes

DEVICE=eth1
ONBOOT=yes
BOOTPROTO=none
USERCTL=no
MASTER=bond0
SLAVE=yes

3 重启系统,使配置生效

4 配置交换机的端口,将与服务器连接的端口加入到一个端口聚合组中

相关内容