51Testing软件测试论坛

 找回密码
 (注-册)加入51Testing

QQ登录

只需一步,快速开始

微信登录,快人一步

手机号码,快捷登录

查看: 4041|回复: 0
打印 上一主题 下一主题

(转)WIFI 无线传输速率测试-iperf

[复制链接]
  • TA的每日心情
    无聊
    3 天前
  • 签到天数: 1050 天

    连续签到: 1 天

    [LV.10]测试总司令

    跳转到指定楼层
    1#
    发表于 2016-5-9 13:32:44 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

    Iperf是一个TCP/IP和UDP/IP的性能测量工具,能够提供网络吞吐率信息,以及震动、丢包率、最大段和最大传输单元大小等统计信息;从而能够帮助我们测试网络性能,定位网络瓶颈。

    现在ubuntu单虚拟机不同终端以及不同虚拟机之间的测试为例说明如何安装以及使用,然后提供MT7688  openwrt平台交叉编译的方法。

    使用这个工具的目的是为了测试MTK7688开发板上面的wifi性能,所以后面还需要对其进行交叉编译!

    ubuntu下iperf的安装

    Iperf 安装
    linux@ubuntu:~$ sudo apt-get install iperf
    [sudo] password for linux:
    Reading package lists... Done
    Building dependency tree      
    Reading state information... Done
    The following NEW packages will be installed:
      iperf
    0 upgraded, 1 newly installed, 0 to remove and 615 not upgraded.
    Need to get 54.0 kB of archives.
    After this operation, 169 kB of additional disk space will be used.
    Get:1 http://cn.archive.ubuntu.com/ubuntu/ precise/universe iperf i386 2.0.5-2.1 [54.0 kB]
    Fetched 54.0 kB in 0s (71.7 kB/s)
    Selecting previously unselected package iperf.
    (Reading database ... 149737 files and directories currently installed.)
    Unpacking iperf (from .../iperf_2.0.5-2.1_i386.deb) ...
    Processing triggers for doc-base ...
    Processing 1 added doc-base file...
    Processing triggers for man-db ...
    Setting up iperf (2.0.5-2.1) ...
    linux@ubuntu:~$ iperf -V
    Usage: iperf [-s|-c host] [options]
    Try `iperf --help' for more information.
    linux@ubuntu:~$ iperf -v
    iperf version 2.0.5 (08 Jul 2010) pthreads

    1.同一虚拟机,不同终端

    终端1
    linux@ubuntu:~$ iperf -s
    ------------------------------------------------------------
    Server listening on TCP port 5001
    TCP window size: 85.3 KByte (default)
    ------------------------------------------------------------
    [  4] local 192.168.0.127 port 5001 connected with 192.168.0.127 port 34052
    [ ID] Interval       Transfer     Bandwidth
    [  4]  0.0-10.0 sec  38.9 GBytes  33.4 Gbits/sec
    终端2
    linux@ubuntu:~$ iperf -c 192.168.0.127
    ------------------------------------------------------------
    Client connecting to 192.168.0.127, TCP port 5001
    TCP window size:  334 KByte (default)
    ------------------------------------------------------------
    [  3] local 192.168.0.127 port 34052 connected with 192.168.0.127 port 5001
    [ ID] Interval       Transfer     Bandwidth
    [  3]  0.0-10.0 sec  38.9 GBytes  33.4 Gbits/sec


    2.不同虚拟机 TCP iperf测试

    虚拟机1
    linux@ubuntu:~$ iperf -s
    ------------------------------------------------------------
    Server listening on TCP port 5001
    TCP window size: 85.3 KByte (default)
    ------------------------------------------------------------
    [  4] local 192.168.0.160 port 5001 connected with 192.168.0.127 port 60192
    [ ID] Interval       Transfer     Bandwidth
    [  4]  0.0-10.0 sec  4.80 GBytes  4.12 Gbits/sec



    虚拟机2
    linux@ubuntu:~$ iperf -c 192.168.0.160
    ------------------------------------------------------------
    Client connecting to 192.168.0.160, TCP port 5001
    TCP window size: 21.0 KByte (default)
    ------------------------------------------------------------
    [  3] local 192.168.0.127 port 60192 connected with 192.168.0.160 port 5001
    [ ID] Interval       Transfer     Bandwidth
    [  3]  0.0-10.0 sec  4.80 GBytes  4.13 Gbits/sec


    3.不同虚拟机 udp iperf测试

    虚拟机1
    ^Clinux@ubuntu:~$ iperf -s -u
    ------------------------------------------------------------
    Server listening on UDP port 5001
    Receiving 1470 byte datagrams
    UDP buffer size:  160 KByte (default)
    ------------------------------------------------------------
    [  3] local 192.168.0.160 port 5001 connected with 192.168.0.127 port 39359
    [ ID] Interval       Transfer     Bandwidth        Jitter   Lost/Total Datagrams
    [  3]  0.0-10.0 sec  1.25 MBytes  1.05 Mbits/sec   0.044 ms    0/  893 (0%)



    虚拟机2
    linux@ubuntu:~$ iperf -c 192.168.0.160 -u
    ------------------------------------------------------------
    Client connecting to 192.168.0.160, UDP port 5001
    Sending 1470 byte datagrams
    UDP buffer size:  160 KByte (default)
    ------------------------------------------------------------
    [  3] local 192.168.0.127 port 39359 connected with 192.168.0.160 port 5001
    [ ID] Interval       Transfer     Bandwidth
    [  3]  0.0-10.0 sec  1.25 MBytes  1.05 Mbits/sec
    [  3] Sent 893 datagrams
    [  3] Server Report:
    [  3]  0.0-10.0 sec  1.25 MBytes  1.05 Mbits/sec   0.043 ms    0/  893 (0%)


    -i制定输出间隔

    linux@ubuntu:~$ iperf -c 192.168.0.160 -u -i 2
    ------------------------------------------------------------
    Client connecting to 192.168.0.160, UDP port 5001
    Sending 1470 byte datagrams
    UDP buffer size:  160 KByte (default)
    ------------------------------------------------------------
    [  3] local 192.168.0.127 port 35034 connected with 192.168.0.160 port 5001
    [ ID] Interval       Transfer     Bandwidth
    [  3]  0.0- 2.0 sec   257 KBytes  1.05 Mbits/sec
    [  3]  2.0- 4.0 sec   256 KBytes  1.05 Mbits/sec
    [  3]  4.0- 6.0 sec   256 KBytes  1.05 Mbits/sec
    [  3]  6.0- 8.0 sec   257 KBytes  1.05 Mbits/sec
    [  3]  8.0-10.0 sec   256 KBytes  1.05 Mbits/sec
    [  3]  0.0-10.0 sec  1.25 MBytes  1.05 Mbits/sec
    [  3] Sent 893 datagrams
    [  3] Server Report:
    [  3]  0.0-10.0 sec  1.25 MBytes  1.05 Mbits/sec   0.056 ms    0/  893 (0%)

    -b制定带宽
    linux@ubuntu:~$ iperf -c 192.168.0.160 -u -i 2 -b 2M
    ------------------------------------------------------------
    Client connecting to 192.168.0.160, UDP port 5001
    Sending 1470 byte datagrams
    UDP buffer size:  160 KByte (default)
    ------------------------------------------------------------
    [  3] local 192.168.0.127 port 39060 connected with 192.168.0.160 port 5001
    [ ID] Interval       Transfer     Bandwidth
    [  3]  0.0- 2.0 sec   490 KBytes  2.01 Mbits/sec
    [  3]  2.0- 4.0 sec   488 KBytes  2.00 Mbits/sec
    [  3]  4.0- 6.0 sec   488 KBytes  2.00 Mbits/sec
    [  3]  6.0- 8.0 sec   488 KBytes  2.00 Mbits/sec
    [  3]  8.0-10.0 sec   488 KBytes  2.00 Mbits/sec
    [  3]  0.0-10.0 sec  2.39 MBytes  2.00 Mbits/sec
    [  3] Sent 1702 datagrams
    [  3] Server Report:
    [  3]  0.0-10.0 sec  2.39 MBytes  2.00 Mbits/sec   0.099 ms    0/ 1702 (0%)


    -t指定测试时间

    linux@ubuntu:~$ iperf -c 192.168.0.160 -u -i 2 -b 2M -t 30
    ------------------------------------------------------------
    Client connecting to 192.168.0.160, UDP port 5001
    Sending 1470 byte datagrams
    UDP buffer size:  160 KByte (default)
    ------------------------------------------------------------
    [  3] local 192.168.0.127 port 37215 connected with 192.168.0.160 port 5001
    [ ID] Interval       Transfer     Bandwidth
    [  3]  0.0- 2.0 sec   488 KBytes  2.00 Mbits/sec
    [  3]  2.0- 4.0 sec   490 KBytes  2.01 Mbits/sec
    [  3]  4.0- 6.0 sec   488 KBytes  2.00 Mbits/sec
    [  3]  6.0- 8.0 sec   488 KBytes  2.00 Mbits/sec
    [  3]  8.0-10.0 sec   488 KBytes  2.00 Mbits/sec
    [  3] 10.0-12.0 sec   488 KBytes  2.00 Mbits/sec
    [  3] 12.0-14.0 sec   488 KBytes  2.00 Mbits/sec
    [  3] 14.0-16.0 sec   490 KBytes  2.01 Mbits/sec
    [  3] 16.0-18.0 sec   488 KBytes  2.00 Mbits/sec
    [  3] 18.0-20.0 sec   488 KBytes  2.00 Mbits/sec
    [  3] 20.0-22.0 sec   488 KBytes  2.00 Mbits/sec
    [  3] 22.0-24.0 sec   488 KBytes  2.00 Mbits/sec
    [  3] 24.0-26.0 sec   488 KBytes  2.00 Mbits/sec
    [  3] 26.0-28.0 sec   488 KBytes  2.00 Mbits/sec
    [  3] 28.0-30.0 sec   488 KBytes  2.00 Mbits/sec
    [  3]  0.0-30.0 sec  7.15 MBytes  2.00 Mbits/sec
    [  3] Sent 5103 datagrams
    [  3] Server Report:
    [  3]  0.0-30.0 sec  7.15 MBytes  2.00 Mbits/sec   0.036 ms    0/ 5102 (0%)
    [  3]  0.0-30.0 sec  1 datagrams received out-of-order

    5. 交叉编译iperf

      1)下载iperf-2.0.5-source.tar.gz

    https://iperf.fr/iperf-download.php

      2)解压,并进行编译配置


    ./configure --host=mipsel-openwrt-linux CC=mipsel-openwrt-linux-gcc LD=mipsel-openwrt-linux-ld ac_cv_func_malloc_0_nonnull=yes
    echo "ac_cv_func_malloc_0_nonnull=yes" > arm-linux.cache
    ./configure --host=mipsel-openwrt-linux CC=mipsel-openwrt-linux-gcc LD=mipsel-openwrt-linux-ld -cache-file=arm-linux.cache


    3)编译

    出现的错误以及警告解决方法:

    a.     mips-openwrt-linux-gcc: warning: environment variable'STAGING_DIR' not defined

    解决办法是在命令行输入:

    export STAGING_DIR=(你的OpenWrt目录的绝对路径)/staging_dir

    exportSTAGING_DIR=/home/linux/mt7688/openwrt-3.10.14/staging_dir


    b.undefinedreference to `rpl_malloc'

    必须添加ac_cv_func_malloc_0_nonnull=yes,否则编译时会报错undefined reference to `rpl_malloc'


    ./configure --host=mipsel-openwrt-linux CC=mipsel-openwrt-linux-gcc LD=mipsel-openwrt-linux-ldac_cv_func_malloc_0_nonnull=yes
    echo "ac_cv_func_malloc_0_nonnull=yes" > arm-linux.cache
    ./configure --host=mipsel-openwrt-linux CC=mipsel-openwrt-linux-gcc LD=mipsel-openwrt-linux-ld -cache-file=arm-linux.cache



    linux@ubuntu:~/linux_c/iperf-2.0.5/src$ file iperf

    iperf: ELF 32-bit LSB executable, MIPS,MIPS32 rel2 version 1, dynamically linked (usesshared libs), with unknown capability 0xf41 = 0x756e6700, with unknowncapability 0x70100 = 0x3040000, not stripped

    发现默认是动态文件,最好可以编译成静态,可惜无法编译成功,看信息是因为libstdc++.so.6缺乏部分函数定义


    linux@ubuntu:~/linux_c/iperf-2.0.5/src$ cd../

    linux@ubuntu:~/linux_c/iperf-2.0.5$./configure --host=mipsel-openwrt-linux CC=mipsel-openwrt-linux-gccLD=mipsel-openwrt-linux-ld ac_cv_func_malloc_0_nonnull=yes CFLAGS=-static –无法编译成功,注意要先make clean

      4)下载到开发板进行 测试

    ./iperf: can't load library 'libstdc++.so.6'
    交叉编译工具链有的这个库,需要把工具链中的文件拷贝进开发板的/usr/lib

    root@OpenWrt:/tmp# ./iperf -c 192.168.0.107
    ------------------------------------------------------------
    Client connecting to 192.168.0.107, TCP port 5001
    TCP window size: 20.5 KByte (default)
    ------------------------------------------------------------
    [  3] local 192.168.0.143 port 44193 connected with 192.168.0.107 port 5001
    [ ID] Interval       Transfer     Bandwidth
    [  3]  0.0-10.0 sec  94.8 MBytes  79.3 Mbits/sec
    root@OpenWrt:/tmp# ./iperf -l 2048 -c 192.168.0.107
    ------------------------------------------------------------
    Client connecting to 192.168.0.107, TCP port 5001
    TCP window size: 20.5 KByte (default)
    ------------------------------------------------------------
    [  3] local 192.168.0.143 port 44194 connected with 192.168.0.107 port 5001
    [ ID] Interval       Transfer     Bandwidth
    [  3]  0.0-10.0 sec  78.7 MBytes  66.1 Mbits/sec

    6. ixcharit测试工具

    用的无线网卡测试 ;无线对有线,无线对无线

    转自:http://blog.csdn.net/xushx_bigbear/article/details/47997995


    分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
    收藏收藏2
    回复

    使用道具 举报

    本版积分规则

    关闭

    站长推荐上一条 /1 下一条

    小黑屋|手机版|Archiver|51Testing软件测试网 ( 沪ICP备05003035号 关于我们

    GMT+8, 2024-11-24 10:09 , Processed in 0.069654 second(s), 27 queries .

    Powered by Discuz! X3.2

    © 2001-2024 Comsenz Inc.

    快速回复 返回顶部 返回列表