bat 批处理测试局域网速度 两端电脑

时间:2019-06-12
本文章向大家介绍bat 批处理测试局域网速度 两端电脑,主要包括bat 批处理测试局域网速度 两端电脑使用实例、应用技巧、基本知识点总结和需要注意事项,具有一定的参考价值,需要的朋友可以参考一下。
C:\Users\Administrator>iperf3
iperf3: parameter error - must either be a client (-c) or server (-s)

Usage: iperf [-s|-c host] [options]
iperf [-h|--help] [-v|--version]

Server or Client:
-p, --port # server port to listen on/connect to
-f, --format [kmgKMG] format to report: Kbits, Mbits, KBytes, MBytes
-i, --interval # seconds between periodic bandwidth reports
-F, --file name xmit/recv the specified file
-B, --bind <host> bind to a specific interface
-V, --verbose more detailed output
-J, --json output in JSON format
--logfile f send output to a log file
-d, --debug emit debugging output
-v, --version show version information and quit
-h, --help show this message and quit
Server specific:
-s, --server run in server mode
-D, --daemon run the server as a daemon
-I, --pidfile file write PID file
-1, --one-off handle one client connection then exit
Client specific:
-c, --client <host> run in client mode, connecting to <host>
-u, --udp use UDP rather than TCP
-b, --bandwidth #[KMG][/#] target bandwidth in bits/sec (0 for unlimited)
(default 1 Mbit/sec for UDP, unlimited for TCP)
(optional slash and packet count for burst mode)
-t, --time # time in seconds to transmit for (default 10 secs)
-n, --bytes #[KMG] number of bytes to transmit (instead of -t)
-k, --blockcount #[KMG] number of blocks (packets) to transmit (instead of -
t or -n)
-l, --len #[KMG] length of buffer to read or write
(default 128 KB for TCP, 8 KB for UDP)
--cport <port> bind to a specific client port (TCP and UDP, default
: ephemeral port)
-P, --parallel # number of parallel client streams to run
-R, --reverse run in reverse mode (server sends, client receives)
-w, --window #[KMG] set window size / socket buffer size
-M, --set-mss # set TCP/SCTP maximum segment size (MTU - 40 bytes)
-N, --no-delay set TCP/SCTP no delay, disabling Nagle's Algorithm
-4, --version4 only use IPv4
-6, --version6 only use IPv6
-S, --tos N set the IP 'type of service'
-Z, --zerocopy use a 'zero copy' method of sending data
-O, --omit N omit the first n seconds
-T, --title str prefix every output line with this string
--get-server-output get results from server
--udp-counters-64bit use 64-bit counters in UDP test packets

[KMG] indicates options that support a K/M/G suffix for kilo-, mega-, or giga-

iperf3 homepage at: http://software.es.net/iperf/
Report bugs to: https://github.com/esnet/iperf

最近在做监控视频系统建设和运维相关工作,其中有队友提出缺乏对网络线路带宽和质量的检查和监控手段。作为从业20多年的“资深”工程师,怎么能受得了“没办法”这样的结论呢,于是淡然推出iPerf3这个小工具。

iPerf3是用于主动侦测IP网络上最大可实现带宽的工具。它支持时序、缓冲区、协议(TCP,UDP,SCTP与IPv4和IPv6)有关的各种参数。对于每个测试,它都会报告带宽,丢包和其他参数。

iPerf3与原始iPerf不共享代码,也不向后兼容。iPerf最初由NLANR / DAST开发。iPerf3主要由ESnet/Lawrence Berkeley国家实验室开发。iPerf3采用新版BSD许可(BSD 3-clause License)。

iPerf3的官方网站:http://software.es.net/iperf/index.html
iPerf3的Github网站:https://github.com/esnet/iperf
iPerf3 v3.1.3等已编译版本的下载网站:https://iperf.fr/iperf-download.php

 

因为这个监控视频系统建设和运维相关的项目主要是Windows平台,下面的介绍以iPerf3 v3.1.3 Windows 64bits版本为例。

1、安装

将下载得到的“iperf-3.1.3-win64.zip”文件解压缩,得到“iperf3.exe”和“cygwin1.dll”两个文件。将这两个文件复制到“%systemroot%”(大多数Windows版本都是“Windows”这个文件夹,之所以用“%systemroot%”指代,是因为大家的“Windows”文件夹不一定都在“C”盘)文件夹的“System32”文件夹里,如果有权限相关的提示出现,都选择“允许”之类的。

2、使用

完整的使用请参考官方文档网站:https://iperf.fr/iperf-doc.php

重要的内容说三遍:服务器端和客户端的命令行窗口都要以管理员身份运行!
重要的内容说三遍:服务器端和客户端的命令行窗口都要以管理员身份运行!
重要的内容说三遍:服务器端和客户端的命令行窗口都要以管理员身份运行!

 
服务器端和客户端的命令行窗口都要以管理员身份运行!

服务器端命令行(其中,-s表示服务器端;-p定义端口号;-i设置每次报告之间的时间间隔,单位为秒,如果设置为非零值,就会按照此时间间隔输出测试报告,默认值为零):

iperf3 -s -p 12345 -i 1

客户端命令行(其中,-c表示服务器的IP地址;-p表示服务器的端口号;-i设置每次报告之间的时间间隔,单位为秒,如果设置为非零值,就会按照此时间间隔输出测试报告,默认值为零;-t设置传输的总时间,Iperf在指定的时间内,重复的发送指定长度的数据包,默认是10秒钟;-w设置套接字缓冲区为指定大小,对于TCP方式,此设置为TCP窗口大小,对于UDP方式,此设置为接受UDP数据包的缓冲区大小,限制可以接受数据包的最大值):

iperf3 -c 192.168.88.248 -p 12345 -i 1 -t 10 -w 100K

 
客户端的执行结果

说明:我的测试环境是1000Mbps局域网,从上面的截图可以看到发送和接收的平均带宽是813Mbps,损失的部分带宽可能是被IP包的控制信息等占用了。


作者:开源大熊
链接:https://www.jianshu.com/p/074c8c51d3d9
来源:简书
简书著作权归作者所有,任何形式的转载都请联系作者获得授权并注明出处。

原文地址:https://www.cnblogs.com/--3q/p/11010751.html