作为一个网络工程师经常会遇到这种情况,需要在两点间测试实际可跑带宽。
带宽小的线路可以搭个FTP服务器,或者直接用scp拷文件这种方式,如果线路超过10G以上就不好用了,一方面需要准备大文件,另一方面磁盘的读写性能也影响到测试结果的准确性,这时这个小巧的开源软件就派上用场了。
iPerf是用于主动测量IP网络上最大可承载带宽的工具。它支持调整与时序,缓冲区和协议(TCP,UDP,SCTP与IPv4和IPv6)有关的各种参数。对于每个测试,它都会报告带宽,丢失和其他参数。官方地址https://iperf.fr/
iPerf功能
TCP和SCTP
测量带宽
报告MSS / MTU大小和观察的读取大小。
通过套接字缓冲区支持TCP窗口大小。
UDP
客户端可以创建指定带宽的UDP流。
测量数据包丢失
测量延迟抖动
多播能力
跨平台:Windows,Linux,Android,MacOS X,FreeBSD,OpenBSD,NetBSD,VxWorks,Solaris ...基本所有的系统都支持了。软件下载地址https://iperf.fr/iperf-download.php,当前最新版本为iperf3
安装
CentOS 可以直接用 yum install iperf或yum install iperf3安装
使用(我使用的是iperf3)
TCP模式
服务器端:
[root@10-57-22-228 ~]# iperf3 -s -p 1234 -i 1
-----------------------------------------------------------
Server listening on 1234
客户端:
[root@10-57-22-128 ~]# iperf3 -c 10.57.22.228 -p 1234 -i 1 -t 10
Connecting to host 10.57.22.228, port 1234
[ 4] local 10.57.22.128 port 38079 connected to 10.57.22.228 port 1234
[ ID] Interval Transfer Bandwidth Retr Cwnd
[ 4] 0.00-1.00 sec 112 MBytes 941 Mbits/sec 250 270 KBytes
[ 4] 1.00-2.00 sec 111 MBytes 932 Mbits/sec 305 369 KBytes
[ 4] 2.00-3.00 sec 111 MBytes 933 Mbits/sec 978 259 KBytes
[ 4] 3.00-4.00 sec 111 MBytes 930 Mbits/sec 358 349 KBytes
[ 4] 4.00-5.00 sec 111 MBytes 931 Mbits/sec 654 286 KBytes
[ 4] 5.00-6.00 sec 111 MBytes 933 Mbits/sec 360 354 KBytes
[ 4] 6.00-7.00 sec 111 MBytes 934 Mbits/sec 417 366 KBytes
[ 4] 7.00-8.00 sec 111 MBytes 934 Mbits/sec 696 329 KBytes
[ 4] 8.00-9.00 sec 111 MBytes 931 Mbits/sec 660 209 KBytes
[ 4] 9.00-10.00 sec 110 MBytes 926 Mbits/sec 912 202 KBytes
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval Transfer Bandwidth Retr
[ 4] 0.00-10.00 sec 1.09 GBytes 932 Mbits/sec 5590 sender
[ 4] 0.00-10.00 sec 1.08 GBytes 931 Mbits/sec receiver
在tcp模式下,客户端到服务器10.57.22.228上传带宽测试,测试时间为10秒。
[root@10-57-22-128 ~]# iperf3 -c 10.57.22.228 -p 1234 -d -t 10
send_parameters:
{
"tcp": true,
"omit": 0,
"time": 10,
"parallel": 1,
"len": 131072,
"client_version": "3.1.7"
}
Connecting to host 10.57.22.228, port 1234
SNDBUF is 16384, expecting 0
RCVBUF is 87380, expecting 0
Congestion algorithm is cubic
[ 4] local 10.57.22.128 port 38112 connected to 10.57.22.228 port 1234
tcpi_snd_cwnd 225 tcpi_snd_mss 1448 tcpi_rtt 2379
[ ID] Interval Transfer Bandwidth Retr Cwnd
[ 4] 0.00-1.00 sec 112 MBytes 940 Mbits/sec 317 318 KBytes
tcpi_snd_cwnd 187 tcpi_snd_mss 1448 tcpi_rtt 2001
[ 4] 1.00-2.00 sec 110 MBytes 923 Mbits/sec 1763 264 KBytes
tcpi_snd_cwnd 255 tcpi_snd_mss 1448 tcpi_rtt 1908
[ 4] 2.00-3.00 sec 109 MBytes 914 Mbits/sec 1741 361 KBytes
tcpi_snd_cwnd 261 tcpi_snd_mss 1448 tcpi_rtt 2795
[ 4] 3.00-4.00 sec 109 MBytes 916 Mbits/sec 1729 369 KBytes
tcpi_snd_cwnd 198 tcpi_snd_mss 1448 tcpi_rtt 2081
[ 4] 4.00-5.00 sec 109 MBytes 917 Mbits/sec 2040 280 KBytes
tcpi_snd_cwnd 255 tcpi_snd_mss 1448 tcpi_rtt 5058
[ 4] 5.00-6.00 sec 106 MBytes 889 Mbits/sec 4096 361 KBytes
tcpi_snd_cwnd 190 tcpi_snd_mss 1448 tcpi_rtt 2277
[ 4] 6.00-7.00 sec 109 MBytes 916 Mbits/sec 2050 269 KBytes
tcpi_snd_cwnd 255 tcpi_snd_mss 1448 tcpi_rtt 2336
[ 4] 7.00-8.00 sec 110 MBytes 919 Mbits/sec 1702 361 KBytes
tcpi_snd_cwnd 262 tcpi_snd_mss 1448 tcpi_rtt 3349
[ 4] 8.00-9.00 sec 108 MBytes 910 Mbits/sec 2175 370 KBytes
tcpi_snd_cwnd 199 tcpi_snd_mss 1448 tcpi_rtt 3639
send_results
{
"cpu_util_total": 4.364935,
"cpu_util_user": 0.135769,
"cpu_util_system": 4.285394,
"sender_has_retransmits": 1,
"congestion_used": "cubic",
"streams": [{
"id": 1,
"bytes": 1138941776,
"retransmits": 23838,
"jitter": 0,
"errors": 0,
"packets": 0
}]
}
get_results
{
"cpu_util_total": 5.207115,
"cpu_util_user": 0.278441,
"cpu_util_system": 4.931552,
"sender_has_retransmits": -1,
"congestion_used": "cubic",
"streams": [{
"id": 1,
"bytes": 1137687808,
"retransmits": -1,
"jitter": 0,
"errors": 0,
"packets": 0
}]
}
[ 4] 9.00-10.00 sec 103 MBytes 867 Mbits/sec 6225 281 KBytes
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval Transfer Bandwidth Retr
[ 4] 0.00-10.00 sec 1.06 GBytes 911 Mbits/sec 23838 sender
[ 4] 0.00-10.00 sec 1.06 GBytes 910 Mbits/sec receiver
iperf Done.
进行上下行带宽测试。
更多功能使用Iperf3 --help查看说明
如果觉得《网卡性能测试用什么软件 小巧好用的网络性能测试工具iPerf》对你有帮助,请点赞、收藏,并留下你的观点哦!