查看: 284|回复: 0

[shell脚本] 使用Iperf进行网络性能/稳定性测试

[复制链接]
  • TA的每日心情
    奋斗
    2018-1-13 01:07
  • 签到天数: 178 天

    连续签到: 1 天

    [LV.7]常住居民III

    查看他的品牌

    发表于 2017-5-22 06:46:40 | 显示全部楼层 |阅读模式
    适用操作系统:
    Linux OS - Version Oracle Linux 4.4 and later
    Linux x86
    Linux x86-64




    作用:
    进行网络性能/稳定性测试




    简介:
    iperf被指定用于测试两个节点之间的网络性能。 您需要使用选项“-s”设置一个服务器端,并使用选项“-c host”设置一个客户端,可以是主机名或IP地址。




    使用/解决办法:

    1. The default iperf uses TCP protocol for testing as below shows:
    a) Set up the iperf server:
    [root@server ~]# ./iperf64 -s
    ------------------------------------------------------------
    Server listening on TCP port 5001
    TCP window size: 85.3 KByte (default)
    ------------------------------------------------------------
    [  4] local 1.1.1.1 port 5001 connected with 1.1.1.2 port 37611
    [ ID] Interval       Transfer     Bandwidth
    [  4]  0.0-10.0 sec  1.09 GBytes    940 Mbits/sec

    b) Connect to the iperf server from the client:
    [root@client ~]# ./iperf64 -c server
    ------------------------------------------------------------
    Client connecting to 1.1.1.1, TCP port 5001
    TCP window size: 43.4 KByte (default)
    ------------------------------------------------------------
    [  3] local 1.1.1.2 port 37611 connected with 1.1.1.1 port 5001
    [ ID] Interval       Transfer     Bandwidth
    [  3]  0.0-10.0 sec  1.09 GBytes    940 Mbits/sec



    -Interval means the test interval, the defualt value is 10 seconds and displays as "0.0-10.0 sec"
    -Transfer means how much data is transfered between the two nodes in the process of testing.
    -Bandwidth is the performance indicator which we use iperf testing for.


    2. Add option "-u" to use UDP protocol for performance testing.
    a) Server side:
    [root@server ~]# ./iperf64 -s -u
    ------------------------------------------------------------
    Server listening on UDP port 5001
    Receiving 1470 byte datagrams
    UDP buffer size:   124 KByte (default)
    ------------------------------------------------------------
    (without option "-b")
    [  3] local 1.1.1.1 port 5001 connected with 1.1.1.2 port 51598
    [ ID] Interval       Transfer     Bandwidth       Jitter   Lost/Total Datagrams
    [  3]  0.0-10.0 sec  1.25 MBytes  1.05 Mbits/sec  0.004 ms    0/  893 (0%)
    (with option "-b 1000M")
    [  4] local 1.1.1.1 port 5001 connected with 1.1.1.2 port 58097
    [ ID] Interval       Transfer     Bandwidth       Jitter   Lost/Total Datagrams
    [  4]  0.0-10.0 sec  1.08 GBytes    929 Mbits/sec  0.010 ms 16203/806540 (2%)


    b) Client side:
    [root@client ~]# ./iperf64 -u -c 1.1.1.1
    ------------------------------------------------------------
    Client connecting to 1.1.1.1, UDP port 5001
    Sending 1470 byte datagrams
    UDP buffer size:   124 KByte (default)
    ------------------------------------------------------------
    [  3] local 1.1.1.2 port 51598 connected with 1.1.1.1 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:
    [ ID] Interval       Transfer     Bandwidth       Jitter   Lost/Total Datagrams
    [  3]  0.0-10.0 sec  1.25 MBytes  1.05 Mbits/sec  0.004 ms    0/  893 (0%)
    In the UDP mode, the client uses default bandwidth (1 Mbit/sec) to send the packets to the server, so we can see the Bandwidth of UDP testing result is 1.05 Mbits/sec.
    In order to obtain the best network bandwidth, we can add option "-b value" to increase the sending bandwidth:
    [root@client ~]# ./iperf64 -u -c 1.1.1.1 -b 1000M
    ------------------------------------------------------------
    Client connecting to 1.1.1.1, UDP port 5001
    Sending 1470 byte datagrams
    UDP buffer size:   124 KByte (default)
    ------------------------------------------------------------
    [  3] local 1.1.1.2 port 58097 connected with 1.1.1.1 port 5001
    [ ID] Interval       Transfer     Bandwidth
    [  3]  0.0-10.0 sec  1.10 GBytes    948 Mbits/sec
    [  3] Sent 806540 datagrams
    [  3] Server Report:
    [ ID] Interval       Transfer     Bandwidth       Jitter   Lost/Total Datagrams
    [  3]  0.0-10.0 sec  1.08 GBytes    929 Mbits/sec  0.010 ms 16203/806540 (2%)

    您需要登录后才可以回帖 登录 | 注册

    本版积分规则

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