Ubuntu22.04配置链路聚合
Ubuntu22.04配置链路聚合
环境:VMware Fusion,Ubuntu22.04,三网卡:ens160,ens161
从Ubuntu18开始,网卡配置文件从/etc/network变为/etc/netplan,所以网卡配置后要令其生效需要使用netplan。
1、编辑/etc/netplan/00-installer-config.yaml默认网卡配置文件:
# This is the network config written by 'subiquity'
network:
ethernets:
ens160: #网卡0
dhcp4: true
ens161: #网卡1
dhcp4: true
version: 2
renderer: networkd
bonds:
bond0: #链路聚合网卡bond0
#addresses: [192.168.232.129/24]
dhcp4: true #开启bond0的dhcp
#gateway4: 192.168.232.1
nameservers: #dns服务器
addresses: [192.168.232.1]
interfaces: #链路聚合网卡bond0需要绑定的物理网卡
- ens160
- ens161
parameters:
mode: 802.3ad #链路聚合的模式,总共有七种模式,见谷歌或百度
mii-monitor-interval:
lacp-rate: fast
transmit-hash-policy: layer2
2、应用网络配置:
netplan apply
3、使用iperf3进行效果验证
服务端运行:iperf3 -s
命令作为服务端监听
客户端运行:iperf3 -c 192.168.232.133
连接服务端测试
4、测试效果:
配置前:
iperf3 -c 192.168.232.133
Connecting to host 192.168.232.133, port 5201
[ 5] local 192.168.232.1 port 59351 connected to 192.168.232.133 port 5201
[ ID] Interval Transfer Bitrate
[ 5] 0.00-1.00 sec 62.6 MBytes 525 Mbits/sec
[ 5] 1.00-2.00 sec 58.5 MBytes 491 Mbits/sec
[ 5] 2.00-3.00 sec 59.7 MBytes 501 Mbits/sec
[ 5] 3.00-4.00 sec 58.1 MBytes 488 Mbits/sec
[ 5] 4.00-5.00 sec 58.4 MBytes 490 Mbits/sec
[ 5] 5.00-6.00 sec 58.7 MBytes 492 Mbits/sec
[ 5] 6.00-7.00 sec 58.9 MBytes 494 Mbits/sec
[ 5] 7.00-8.00 sec 58.1 MBytes 488 Mbits/sec
[ 5] 8.00-9.00 sec 59.0 MBytes 495 Mbits/sec
[ 5] 9.00-10.00 sec 59.2 MBytes 497 Mbits/sec
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval Transfer Bitrate
[ 5] 0.00-10.00 sec 591 MBytes 496 Mbits/sec sender
[ 5] 0.00-10.04 sec 590 MBytes 493 Mbits/sec receiver
iperf Done.
配置后:
iperf3 -c 192.168.232.133
Connecting to host 192.168.232.133, port 5201
[ 5] local 192.168.232.1 port 61480 connected to 192.168.232.133 port 5201
[ ID] Interval Transfer Bitrate
[ 5] 0.00-1.00 sec 126 MBytes 1.05 Gbits/sec
[ 5] 1.00-2.00 sec 129 MBytes 1.08 Gbits/sec
[ 5] 2.00-3.00 sec 128 MBytes 1.08 Gbits/sec
[ 5] 3.00-4.00 sec 127 MBytes 1.07 Gbits/sec
[ 5] 4.00-5.00 sec 128 MBytes 1.08 Gbits/sec
[ 5] 5.00-6.00 sec 129 MBytes 1.08 Gbits/sec
[ 5] 6.00-7.00 sec 129 MBytes 1.08 Gbits/sec
[ 5] 7.00-8.00 sec 128 MBytes 1.08 Gbits/sec
[ 5] 8.00-9.00 sec 130 MBytes 1.09 Gbits/sec
[ 5] 9.00-10.00 sec 128 MBytes 1.08 Gbits/sec
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval Transfer Bitrate
[ 5] 0.00-10.00 sec 1.25 GBytes 1.08 Gbits/sec sender
[ 5] 0.00-9.99 sec 1.25 GBytes 1.07 Gbits/sec receiver
iperf Done.
- 上一篇: Macbook Pro 14 2021 iTerm2配置lrzsz
- 下一篇: Portal使用流程