----------------------CentOS 6.5-------------------------------
1.添加bond内核模块
modprobe bonding
2.添加四块网卡
3.编辑网卡进行配置
eth0:
vim /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0ONBOOT=yesTYPE=EthernetBOOTPROTO=staticUSERCTL=noMASTER=bond0SLAVE=yeseth1:
vim /etc/sysconfig/network-scripts/ifcfg-eth1DEVICE=eth1ONBOOT=yesTYPE=EthernetBOOTPROTO=staticUSERCTL=noMASTER=bond0SLAVE=yeseth2:
vim /etc/sysconfig/network-scripts/ifcfg-eth2DEVICE=eth2ONBOOT=yesTYPE=EthernetBOOTPROTO=staticUSERCTL=noMASTER=bond0SLAVE=yeseth3:
vim /etc/sysconfig/network-scripts/ifcfg-eth3DEVICE=eth3ONBOOT=yesTYPE=EthernetBOOTPROTO=staticUSERCTL=noMASTER=bond0SLAVE=yes4.编辑bond虚拟主网卡vim /etc/sysconfig/network-scripts/ifcfg-bond0DEVICE=bond0TYPE=EthernetONBOOT=yesBOOTPROTO=staticUSERCTL=noPEERDNS=yesIPV6INIT=noIPADDR=192.168.187.200NETMASK=255.255.255.0BROADCAST=192.168.187.255GATEWAY=192.168.187.2BONDING_OPTS="miimon=20 mode=6"//表示这里配置的工作模式是mode6(adaptive load balancing), miimon表示监视网络链接的频度 (毫秒), 我们设置的是100毫秒, 根据你的需求也可以指定mode成其它的负载模式。
5.创建一个加载bonding的专属设定文件/etc/modprobe.d/bonding.conf
echo "alias netdev-bond0 bonding" > /etc/modprobe.d/bonding.confcat /proc/net/bonding/bond0ethtool bond0
6.重启系统
reboot-------------------CentOS 7---------------------------------------------nmcli connection add type bond ifname bond0 mode 6nmcli connection add type bond-slave ifname ens33 master bond0nmcli connection add type bond-slave ifname ens37 master bond0nmcli connection add type bond-slave ifname ens38 master bond0nmcli connection add type bond-slave ifname ens39 master bond0systemctl restart network cat /proc/net/bonding/bond0ethtool bond0