menu Chancel's blog
rss_feed
Chancel's blog
时来天地皆同力

Linux下进行网速测试

作者:Chancel Yang, 时间:2023 Jan 12, 阅读:75

iperf 程序是一个网络性能测试工具,通常可以用于测试网络设备之间网络速度,支持UDP/TCP与IPv4/IPv6,在Ubuntu2204中安装iperf

下面以A机器(192.168.1.1)到B机器(192.168.1.2)为例,在A/B机器上安装iperf

sudo apt install -y iperf

在A机器上开启iperf服务端

iperf -s -p 55201

常用参数

  • -s 以服务端运行
  • -p 监听端口
  • -V 兼容IPv6

在B机器上连接A机器测试速度

iperf -c 192.168.1.1 -t 30 -p 55201

常用参数

  • -c 以客户端运行
  • -p 服务端接收的端口
  • -t 测试时间
  • -V 兼容IPv6模式

测试结果输出如下

➜  ~ iperf -c 192.168.1.1 -t 30 -p 55201
------------------------------------------------------------
Client connecting to 192.168.1.1, TCP port 55201
TCP window size:  416 KByte (WARNING: requested 1.91 MByte)
------------------------------------------------------------
[  3] local 192.168.1.2 port 50038 connected with 192.168.1.1 port 55201
[ ID] Interval       Transfer     Bandwidth
[  3]  0.0- 1.0 sec   892 KBytes  7.31 Mbits/sec
[  3]  1.0- 2.0 sec  1.12 MBytes  9.44 Mbits/sec
[  3]  2.0- 3.0 sec  1.62 MBytes  13.6 Mbits/sec
[  3]  3.0- 4.0 sec  1.50 MBytes  12.6 Mbits/sec
[  3]  4.0- 5.0 sec  2.12 MBytes  17.8 Mbits/sec
[  3]  5.0- 6.0 sec  2.25 MBytes  18.9 Mbits/sec
...
[  3] 24.0-25.0 sec  3.00 MBytes  25.2 Mbits/sec
[  3] 25.0-26.0 sec  2.75 MBytes  23.1 Mbits/sec
[  3] 26.0-27.0 sec  2.88 MBytes  24.1 Mbits/sec
[  3] 27.0-28.0 sec  2.50 MBytes  21.0 Mbits/sec
[  3] 28.0-29.0 sec  2.25 MBytes  18.9 Mbits/sec
[  3] 29.0-30.0 sec  3.00 MBytes  25.2 Mbits/sec
[  3]  0.0-30.1 sec  87.7 MBytes  24.4 Mbits/sec

[[replyMessage== null?"发表评论":"发表评论 @ " + replyMessage.m_author]]

account_circle
email
web_asset
textsms

评论列表([[messageResponse.total]])

还没有可以显示的留言...
[[messageItem.m_author]] [[messageItem.m_author]]
[[messageItem.create_time]]
[[getEnviron(messageItem.m_environ)]]
[[subMessage.m_author]] [[subMessage.m_author]] @ [[subMessage.parent_message.m_author]] [[subMessage.parent_message.m_author]]
[[subMessage.create_time]]
[[getEnviron(messageItem.m_environ)]]