机器网络带宽不足是现实中经常遇到的事情。我们可以通过链路聚合,添加双口bond 或者多口bond!来解决网络带宽不足的问题。一般我们都是以双口bond来解决问题。
如果双口bond还不能满足网络带宽的问题,那么我们一般选择添加万兆网卡,将网线该换为光纤,效果要比bond。
而多口bond我们一般不会去做,因为添加万兆网卡效果更好,而且不会过多占用交换机的插口。
ethtool ifcfg-eth0 #查看网卡协商速率
这里可以看到speed 为1000。
下面我们来配置bond
-
接口配置文件
[root@install network-scripts]# cat ifcfg-bond0 DEVICE=bond0 TYPE=Ethernet ONBOOT=yes NM_CONTROLLED=no BOOTPROTO=none IPADDR=172.16.8.100 PREFIX=24 /NETMASK=255.255.255.0 IPV6INIT=no USERCTL=no GATEWAY=172.16.8.2 [root@install network-scripts]# cat ifcfg-eth0 DEVICE=eth0 TYPE=Ethernet ONBOOT=yes NM_CONTROLLED=no BOOTPROTO=none IPV6INIT=no USERCTL=no MASTER=bond0 SLAVE=yes [root@install network-scripts]# cat ifcfg-eth1 DEVICE=eth1 TYPE=Ethernet ONBOOT=yes NM_CONTROLLED=no BOOTPROTO=none IPV6INIT=no USERCTL=no MASTER=bond0 SLAVE=yes
-
bonding参数
[root@install ~]#/etc/modprobe.d/bond0 #配置bond0轮询模式 alias bond0 bonding options bonding mode=0 miimon=100 #这两行加入
-
重启网络服务
[root@install ~]# systemctl restart network [root@install ~]# ip a
查看可以看出eth0 和eth1 没有ip ,只有bond有ip
最后我们再执行
ethtool bond0
这里speed为2000,说明配置完成。
注意:机器配置完成后,交换机也要配置bond对应的网口。