具体请看网卡band配置文档,下面是配置实例

服务操作系统 centos 6.5

服务器 [root@fdfs-ctc-bj-10-254-9-173]

[root@fdfs-ctc-bj-10-254-9-173 ~]# cat /etc/sysconfig/network-scripts/ifcfg-bond0 
DEVICE=bond0
TYPE=Ethernet
ONBOOT=yes
BOOTPROTO=none
USERCTL=no
IPV6INIT=no
IPADDR=10.254.9.173
NETMASK=255.255.248.0
GATEWAY=10.254.8.1
DNS1=10.254.8.129
DNS2=10.254.8.130
BONDING_OPTS="miimon=100 mode=4 xmit_hash_policy=layer3+4"

[root@fdfs-ctc-bj-10-254-9-173 ~]# cat /etc/sysconfig/network-scripts/ifcfg-em1
DEVICE=em1
TYPE=Ethernet
BOOTPROTO=none
ONBOOT=yes
USERCTL=no
IPV6INIT=no
MASTER=bond0
SLAVE=yes
[root@fdfs-ctc-bj-10-254-9-173 ~]# cat /etc/sysconfig/network-scripts/ifcfg-em2
DEVICE=em2
TYPE=Ethernet
BOOTPROTO=none
ONBOOT=yes
USERCTL=no
IPV6INIT=no
MASTER=bond0
SLAVE=yes
[root@fdfs-ctc-bj-10-254-9-173 ~]# cat /etc/sysconfig/network-scripts/ifcfg-em3
DEVICE=em3
TYPE=Ethernet
BOOTPROTO=none
ONBOOT=yes
USERCTL=no
IPV6INIT=no
MASTER=bond0
SLAVE=yes
[root@fdfs-ctc-bj-10-254-9-173 ~]# cat /etc/sysconfig/network-scripts/ifcfg-em4
DEVICE=em4
TYPE=Ethernet
BOOTPROTO=none
ONBOOT=yes
USERCTL=no
IPV6INIT=no
MASTER=bond0
SLAVE=yes
[root@fdfs-ctc-bj-10-254-9-173 ~]#

服务器 [root@fdfs-ctc-bj-10-254-9-174]

[root@fdfs-ctc-bj-10-254-9-174 ~]# cat /etc/sysconfig/network-scripts/ifcfg-bond0 
DEVICE=bond0
TYPE=Ethernet
ONBOOT=yes
BOOTPROTO=none
USERCTL=no
IPV6INIT=no
IPADDR=10.254.9.174
NETMASK=255.255.248.0
GATEWAY=10.254.8.1
DNS1=10.254.8.129
DNS2=10.254.8.130
BONDING_OPTS="miimon=100 mode=4 xmit_hash_policy=layer3+4"
[root@fdfs-ctc-bj-10-254-9-174 ~]# cat /etc/sysconfig/network-scripts/ifcfg-em1
DEVICE=em1
TYPE=Ethernet
BOOTPROTO=none
ONBOOT=yes
USERCTL=no
IPV6INIT=no
MASTER=bond0
SLAVE=yes
[root@fdfs-ctc-bj-10-254-9-174 ~]# cat /etc/sysconfig/network-scripts/ifcfg-em2
DEVICE=em2
TYPE=Ethernet
BOOTPROTO=none
ONBOOT=yes
USERCTL=no
IPV6INIT=no
MASTER=bond0
SLAVE=yes
[root@fdfs-ctc-bj-10-254-9-174 ~]# cat /etc/sysconfig/network-scripts/ifcfg-em3
DEVICE=em3
TYPE=Ethernet
BOOTPROTO=none
ONBOOT=yes
USERCTL=no
IPV6INIT=no
MASTER=bond0
SLAVE=yes
[root@fdfs-ctc-bj-10-254-9-174 ~]# cat /etc/sysconfig/network-scripts/ifcfg-em4
DEVICE=em4
TYPE=Ethernet
BOOTPROTO=none
ONBOOT=yes
USERCTL=no
IPV6INIT=no
MASTER=bond0
SLAVE=yes
[root@fdfs-ctc-bj-10-254-9-174 ~]#

出现band4 网卡出流量不能超过1G的问题 ,是hash算法问题 请添加 xmit_hash_policy=layer3+4

cat /etc/sysconfig/network-scripts/ifcfg-bond0
DEVICE=bond0
ONBOOT=yes
BOOTPROTO=none
USERCTL=no
BONDING_OPTS=”mode=4 miimon=100 xmit_hash_policy=layer3+4”
!—mode=4 支持802.3ad(LACP)模式的负载均衡
!—xmit_hash_policy=1(layer3+4) 可以超过物理端口带宽
cat /etc/sysconfig/network-scripts/ifcfg-ethX
DEVICE=ethX
ONBOOT=yes
BOOTPROTO=none
USERCTL=no
MASTER=bond0
SLAVE=yes

文档更新时间: 2020-02-08 06:29   作者:月影鹏鹏