1、 交换机配置文件
interface port-channel 34
switchport
switchport access vlan 190
interface Ethernet1/31
channel-group 34 mode active
no shutdown
interface Ethernet1/32
channel-group 34 mode active
no shutdown
2 、服务器端网卡配置
2.1 网卡ens1f4配置
[root@localhost ~]# cat /etc/sysconfig/network-scripts/ifcfg-ens1f4
DEVICE=ens1f4
NAME=ens1f4
TYPE=Ethernet
BOOTPROTO=none
ONBOOT=yes
MASTER=bond0
SLAVE=yes
2.2 网卡ens1f4d1配置
[root@localhost ~]# cat /etc/sysconfig/network-scripts/ifcfg-ens1f4d1
DEVICE=ens1f4d1
NAME=ens1f4d1
TYPE=Ethernet
BOOTPROTO=none
ONBOOT=yes
MASTER=bond0
SLAVE=yes
2.3 虚拟网卡bond0配置
[root@localhost ~]# cat /etc/sysconfig/network-scripts/ifcfg-bond0
DEVICE=bond0
NAME=bond0
Type=Bond
BONDING_MASTER=yes
IPADDR=10.190.0.35
PREFIX=24
GATEWAY=10.190.0.1
BOOTPROTO=none
ONBOOT=yes
BONDING_OPTS="mode=4 miimon=100 updelay=0 downdelay=0 xmit_hash_policy=layer3+4"
2.3 加载内核模块、重启服务器bond生效
[root@localhost ~]# modprobe bonding && reboot
2.4 查看bond0状态
[root@localhost ~]# cat /proc/net/bonding/bond0
Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011)
Bonding Mode: IEEE 802.3ad Dynamic link aggregation
Transmit Hash Policy: layer3+4 (1) # 一定得确保此参数生效,否则聚合将失败。
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 0
Down Delay (ms): 0
802.3ad info
LACP rate: fast
Min links: 0
Aggregator selection policy (ad_select): stable
Active Aggregator Info:
Aggregator ID: 1
Number of ports: 2
Actor Key: 13
Partner Key: 32802
Partner Mac Address: 00:23:04:ee:be:0a # 如果看不到上面2个参数信息,则交换机配置失败了。
Slave Interface: ens1f4
MII Status: up
Speed: 10000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 00:07:43:3e:6f:d0
Slave queue ID: 0
Aggregator ID: 1
Actor Churn State: none
Partner Churn State: none
Actor Churned Count: 0
Partner Churned Count: 0
details actor lacp pdu:
system priority: 65535
port key: 13
port priority: 255
port number: 1
port state: 63
details partner lacp pdu:
system priority: 32667
oper key: 32802
port priority: 32768
port number: 377
port state: 61
Slave Interface: ens1f4d1
MII Status: up
Speed: 10000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 00:07:43:3e:6f:d8
Slave queue ID: 0
Aggregator ID: 1
Actor Churn State: none
Partner Churn State: none
Actor Churned Count: 0
Partner Churned Count: 0
details actor lacp pdu:
system priority: 65535
port key: 13
port priority: 255
port number: 2
port state: 63
details partner lacp pdu:
system priority: 32667
oper key: 32802
port priority: 32768
port number: 16761
port state: 61
2.5 用2台配置一样的服务器进行压测
[root@localhost ~]# iperf3 -s // 服务端
[root@localhost ~]# iperf3 -P 10 -c 10.190.0.35 -t 600 // 客户端