iperf
iperf3 (安装包是:iperf-master)安装遇到error while loading shared libraries:libiperf.so.0 解决方法:在正常编译以后运行ldconfig 安装软件包的方法(参考REDMINE):在顶层目录下: ./configure make make install
yqq@ubuntu18:~/Tool/iperf-master$ iperf3 -s
iperf3: error while loading shared libraries: libiperf.so.0: cannot open shared object file: No such file or directory
yqq@ubuntu18:~/Tool/iperf-master$ sudo ldconfig
yqq@ubuntu18:~/Tool/iperf-master$ iperf3 -s
Server listening on 5201 (test #1)
安装
方法1:sudo apt-get install iperf 方法2:下载iperf的源码包( 在板子上使用二进制文件时,可将源码直接拷贝到板子上 ./configure make)
测试
无论是tcp还是udp方式测试,都要一端运行服务器模式,另一端运行客户端模式,另外如果打开了iptables,要打开tcp 5001端口,当然也可以指定端口
tcp方式
服务器端:iperf -s 客户端: iperf -c SERVERIP -t 60 -i 1 -P 5
udp方式
服务器端:iperf -u -s //iperf3服务端不支持-u选项 客户端: iperf -c SERVERIP -t 60 -i 1 -b 100M
共用的指令
-f --格式[k|m|K|M]分别表示Kbits,Mbits,Kbits,KBytes,MBytes显示报告,默认是Mbits
-i --以秒为单位统计带宽值
-l --读写缓冲区的大小,默认是8kb
-m --显示最大的TCP数据段大小(MTU-TCP/IP header)
-o --将报告和错误信息输出到文件
-p --指定服务器和客户端连接的端口
-w --指定TCP窗口的大小,默认是8KB
-B --绑定一个主机地址或接口(当主机有多个地址或接口时使用该参数)
-C --兼容旧版本(当server和client端版本不一样时使用)
-M --指定TCP 数据包的最大MTU值
-N --设定TCP不延时
-V --传递ipv6数据包
适用于server
-s --服务器
-U --单线程UDP模式下运行
-D --以守护进程模式运行
适用于client
-b --指定客户端通过udp协议发送信息的带宽,默认为1Mbit/s
-c --客户端
-d --同时进行双向传输测试
-n --指定传输的字节数
-r --单独进行双向传输测试
-t --指定iperf测试时间,默认10秒
-F --指定需要传输的文件
-I --从标准输入(stdin)中读取要传输的数据
-L --指定一个端口,服务器将利用这个端口与客户端相连
-P --客户端到服务器的连接数,默认为1
-T --ttl值
-u --使用udp协议
# iperf -s -u
------------------------------------------------------------
Server listening on UDP port 5001
Receiving 1470 byte datagrams
UDP buffer size: 208 KByte (default)
------------------------------------------------------------
[ 3] local 192.168.1.6 port 5001 connected with 192.168.1.6 port 52657
[ ID] Interval Transfer Bandwidth Jitter Lost/Total Datagrams
[ 3] 0.0-16.4 sec 196 MBytes 101 Mbits/sec 0.003 ms 0/139968 (0%)
[ 3] 0.0-16.4 sec 1 datagrams received out-of-order
[ 4] local 192.168.1.6 port 5001 connected with 192.168.1.6 port 39426
[ 4] 0.0-41.1 sec 2.90 GBytes 606 Mbits/sec 0.004 ms 9271/2128456 (0.44%)
[ 4] 0.0-41.1 sec 1 datagrams received out-of-order
[ 3] local 127.0.0.1 port 5001 connected with 127.0.0.1 port 60678
[ 3] 0.0-22.1 sec 1.55 GBytes 602 Mbits/sec 0.032 ms 4317/1136481 (0.38%)
[ 3] 0.0-22.1 sec 1 datagrams received out-of-order
[ 3840.205662] ata1: exception Emask 0x10 SAct 0x0 SErr 0x10200 action 0xe frozen
[ 3840.213102] ata1: irq_stat 0x00400000, PHY RDY changed
[ 3840.218375] ata1: SError: { Persist PHYRdyChg }
# iperf -c 192.168.1.6 -t 60 -i 1 -b 1GB
WARNING: option -b implies udp testing
------------------------------------------------------------
Client connecting to 192.168.1.6, UDP port 5001
Sending 1470 byte datagrams
UDP buffer size: 208 KByte (default)
------------------------------------------------------------
[ 3] local 192.168.1.6 port 39426 connected with 192.168.1.6 port 5001
[ ID] Interval Transfer Bandwidth
[ 3] 0.0- 1.0 sec 76.0 MBytes 638 Mbits/sec
[ 3] 1.0- 2.0 sec 71.2 MBytes 597 Mbits/sec
[ 3] 2.0- 3.0 sec 65.2 MBytes 547 Mbits/sec
[ 3] 3.0- 4.0 sec 66.5 MBytes 557 Mbits/sec
[ 3] 4.0- 5.0 sec 72.5 MBytes 608 Mbits/sec
[ 3] 5.0- 6.0 sec 73.4 MBytes 616 Mbits/sec
[ 3] 6.0- 7.0 sec 76.8 MBytes 644 Mbits/sec
[ 3] 7.0- 8.0 sec 76.2 MBytes 639 Mbits/sec
[ 3] 8.0- 9.0 sec 75.1 MBytes 630 Mbits/sec
[ 3] 9.0-10.0 sec 76.6 MBytes 643 Mbits/sec
[ 3] 10.0-11.0 sec 76.3 MBytes 640 Mbits/sec
[ 3] 11.0-12.0 sec 76.7 MBytes 643 Mbits/sec
[ 3] 12.0-13.0 sec 76.1 MBytes 638 Mbits/sec
[ 3] 13.0-14.0 sec 76.4 MBytes 641 Mbits/sec
[ 3] 14.0-15.0 sec 76.8 MBytes 644 Mbits/sec
[ 3] 15.0-16.0 sec 76.7 MBytes 643 Mbits/sec
[ 3] 16.0-17.0 sec 72.8 MBytes 610 Mbits/sec
[ 3] 17.0-18.0 sec 69.5 MBytes 583 Mbits/sec
[ 3] 18.0-19.0 sec 69.6 MBytes 584 Mbits/sec
[ 3] 19.0-20.0 sec 75.8 MBytes 636 Mbits/sec
[ 3] 20.0-21.0 sec 62.1 MBytes 521 Mbits/sec
[ 3] 21.0-22.0 sec 76.1 MBytes 639 Mbits/sec
# iperf -c 127.0.0.1 -t 60 -i 1 -b 4g
WARNING: option -b implies udp testing
------------------------------------------------------------
Client connecting to 127.0.0.1, UDP port 5001
Sending 1470 byte datagrams
UDP buffer size: 208 KByte (default)
------------------------------------------------------------
[ 3] local 127.0.0.1 port 60678 connected with 127.0.0.1 port 5001
[ ID] Interval Transfer Bandwidth
[ 3] 0.0- 1.0 sec 78.8 MBytes 661 Mbits/sec
[ 3] 1.0- 2.0 sec 77.2 MBytes 648 Mbits/sec
[ 3] 2.0- 3.0 sec 70.1 MBytes 588 Mbits/sec
[ 3] 3.0- 4.0 sec 73.5 MBytes 617 Mbits/sec
[ 3] 4.0- 5.0 sec 73.1 MBytes 613 Mbits/sec
[ 3] 5.0- 6.0 sec 72.4 MBytes 608 Mbits/sec
[ 3] 6.0- 7.0 sec 74.5 MBytes 625 Mbits/sec
[ 3] 7.0- 8.0 sec 61.4 MBytes 515 Mbits/sec
[ 3] 8.0- 9.0 sec 71.0 MBytes 596 Mbits/sec
|