bond网卡绑定(centos6.5 + centos 7)
----------------------CentOS 6.5-------------------------------
1.添加bond内核模块
modprobe bonding
2.添加四块网卡
3.编辑网卡进行配置
eth0:
vim /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
ONBOOT=yes
TYPE=Ethernet
BOOTPROTO=static
USERCTL=no
MASTER=bond0
SLAVE=yes
eth1:
vim /etc/sysconfig/network-scripts/ifcfg-eth1
DEVICE=eth1
ONBOOT=yes
TYPE=Ethernet
BOOTPROTO=static
USERCTL=no
MASTER=bond0
SLAVE=yes
eth2:
vim /etc/sysconfig/network-scripts/ifcfg-eth2
DEVICE=eth2
ONBOOT=yes
TYPE=Ethernet
BOOTPROTO=static
USERCTL=no
MASTER=bond0
SLAVE=yes
eth3:
vim /etc/sysconfig/network-scripts/ifcfg-eth3
DEVICE=eth3
ONBOOT=yes
TYPE=Ethernet
BOOTPROTO=static
USERCTL=no
MASTER=bond0
SLAVE=yes
4.编辑bond虚拟主网卡
vim /etc/sysconfig/network-scripts/ifcfg-bond0
DEVICE=bond0
TYPE=Ethernet
ONBOOT=yes
BOOTPROTO=static
USERCTL=no
PEERDNS=yes
IPV6INIT=no
IPADDR=192.168.187.200
NETMASK=255.255.255.0
BROADCAST=192.168.187.255
GATEWAY=192.168.187.2
BONDING_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.conf
cat /proc/net/bonding/bond0
ethtool bond0
6.重启系统
reboot
-------------------CentOS 7---------------------------------------------
nmcli connection add type bond ifname bond0 mode 6
nmcli connection add type bond-slave ifname ens33 master bond0
nmcli connection add type bond-slave ifname ens37 master bond0
nmcli connection add type bond-slave ifname ens38 master bond0
nmcli connection add type bond-slave ifname ens39 master bond0
systemctl restart network
cat /proc/net/bonding/bond0
ethtool bond0