有两台服务器,都有两块服务器网卡,把它们bonding起来,增加带宽。
server1:
/etc/sysconfig/network-scripts/ifcfg-bond0
DEVICE=bond0
IPADDR=192.168.0.30
NETMASK=255.255.255.0
GATEWAY=192.168.0.1
USERCTL=no
BOOTPROTO=none
ONBOOT=yes
/etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
BOOTPROTO=none
ONBOOT=yes
# Settings for Bond
MASTER=bond0
SLAVE=yes
/etc/sysconfig/network-scripts/ifcfg-eth1
DEVICE=eth1
BOOTPROTO=none
ONBOOT=yes
# Settings for Bond
MASTER=bond0
SLAVE=yes
/etc/modprobe.d/bond.conf
alias bond0 bonding
运行:
modprobe bonding mode=0
/etc/init.d/network restart
server2:
/etc/sysconfig/network-scripts/ifcfg-bond0
DEVICE=bond0
IPADDR=192.168.0.100
NETMASK=255.255.255.0
GATEWAY=192.168.0.1
USERCTL=no
BOOTPROTO=none
ONBOOT=yes
/etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
BOOTPROTO=none
ONBOOT=yes
# Settings for Bond
MASTER=bond0
SLAVE=yes
/etc/sysconfig/network-scripts/ifcfg-eth1
DEVICE=eth1
BOOTPROTO=none
ONBOOT=yes
# Settings for Bond
MASTER=bond0
SLAVE=yes
/etc/modprobe.d/bond.conf
alias bond0 bonding
运行:
modprobe bonding mode=0
/etc/init.d/network restart
注意,一定要将server1和server2上的NetworkManager关掉,要不然传输起来比一块网卡的速度还慢,这点切记!!!
用两根网线将这两台服务器两两连接起来,测试发现速度确实更快了,不过没有理想的double,一根网线的速度110MB/S,现在两个一起跑 增加到 150MB/S。
如果想用主备模式,只要将mode=0改成mode=1,当然还有其它模式,这里不做介绍。