iperf3


http://blog.163.com/frank_spr/blog/static/22926500520159253346691/

iperf的主要功能:
1)TCP方面
測試網絡帶寬
支持多線程,在客戶端和服務端支持多重連接
報告MSS/MTU值的大小
支持TCP窗口值自定義並可通過套接字緩沖
2)UDP方面
可設置指定帶寬的UDP數據流
可以測試網絡抖動值、丟包數
支持多播 測試
支持多線程,在客戶端和服務端支持多重連接
安裝:
tar -xzvf iperf-3.1b3.tar.gz
cd iperf-3.1b3/
./configure
make
make install
應用實例:
1)測試TCP吞吐量
服務端:
iperf3 -s
suse11-2:/soft/iperf-3.1b3 # iperf3 -s
-----------------------------------------------------------
Server listening on 5201
-----------------------------------------------------------

客戶端:
SUSE01:/soft # iperf3 -c 192.168.17.142
Connecting to host 192.168.17.142, port 5201
[  4] local 192.168.17.141 port 48107 connected to 192.168.17.142 port 5201
[ ID] Interval           Transfer     Bandwidth       Retr  Cwnd
[  4]   0.00-1.00   sec  51.1 MBytes   428 Mbits/sec    5    151 KBytes
[  4]   1.00-2.00   sec  86.1 MBytes   723 Mbits/sec    0    175 KBytes
[  4]   2.00-3.00   sec  72.8 MBytes   611 Mbits/sec    1    102 KBytes
[  4]   3.00-4.00   sec  84.8 MBytes   712 Mbits/sec    0    112 KBytes
[  4]   4.00-5.00   sec  76.5 MBytes   641 Mbits/sec    0    124 KBytes
[  4]   5.00-6.00   sec  79.9 MBytes   671 Mbits/sec    0    132 KBytes
[  4]   6.00-7.00   sec  82.0 MBytes   688 Mbits/sec    0    137 KBytes
[  4]   7.00-8.00   sec  84.5 MBytes   709 Mbits/sec    0    144 KBytes
[  4]   8.00-9.00   sec  72.8 MBytes   608 Mbits/sec    0    153 KBytes
[  4]   9.00-10.00  sec  79.6 MBytes   670 Mbits/sec    0    158 KBytes
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bandwidth       Retr
[  4]   0.00-10.00  sec   770 MBytes   646 Mbits/sec    6             sender
[  4]   0.00-10.00  sec   769 MBytes   645 Mbits/sec                  receiver

iperf Done.
SUSE01:/soft #
iperf默認運行時間10s,每隔1s輸出一次傳輸狀態,同時還可以看到每秒傳輸的數據量在50~80M之間(我的是虛擬機環境)
剛好與Bandwidth列的值對應起來,網卡的帶寬平均速率維持在500Mbits/sec
改變iperf運行時間和輸出頻率:
-t 和-i 參數來實現
SUSE01:/soft # iperf3 -c 192.168.17.142 -t 20 -i 5
Connecting to host 192.168.17.142, port 5201
[  4] local 192.168.17.141 port 48109 connected to 192.168.17.142 port 5201
[ ID] Interval           Transfer     Bandwidth       Retr  Cwnd
[  4]   0.00-5.01   sec   301 MBytes   504 Mbits/sec   52    124 KBytes
[  4]   5.01-10.00  sec   344 MBytes   578 Mbits/sec    0    168 KBytes
[  4]  10.00-15.01  sec   369 MBytes   618 Mbits/sec    5    158 KBytes
[  4]  15.01-20.00  sec   355 MBytes   596 Mbits/sec   90    129 KBytes
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bandwidth       Retr
[  4]   0.00-20.00  sec  1.34 GBytes   574 Mbits/sec  147             sender
[  4]   0.00-20.00  sec  1.34 GBytes   574 Mbits/sec                  receiver

iperf Done.
SUSE01:/soft #
模擬大量數據傳輸:-n指定傳輸的數據量
SUSE01:/soft # iperf3 -c 192.168.17.142 -i 10 -n 5000000000
Connecting to host 192.168.17.142, port 5201
[  4] local 192.168.17.141 port 48111 connected to 192.168.17.142 port 5201
[ ID] Interval           Transfer     Bandwidth       Retr  Cwnd
[  4]   0.00-10.00  sec   652 MBytes   547 Mbits/sec   11    150 KBytes
[  4]  10.00-20.00  sec   582 MBytes   488 Mbits/sec    8    160 KBytes
[  4]  20.00-30.00  sec   671 MBytes   562 Mbits/sec    6    148 KBytes
[  4]  30.00-40.00  sec   494 MBytes   414 Mbits/sec    3    137 KBytes
[  4]  40.00-50.01  sec   683 MBytes   573 Mbits/sec   46    140 KBytes
[  4]  50.01-60.00  sec   591 MBytes   496 Mbits/sec    3    144 KBytes
[  4]  60.00-70.00  sec   660 MBytes   554 Mbits/sec   45    180 KBytes
[  4]  70.00-77.90  sec   436 MBytes   463 Mbits/sec   46    180 KBytes
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bandwidth       Retr
[  4]   0.00-77.90  sec  4.66 GBytes   513 Mbits/sec  168             sender
[  4]   0.00-77.90  sec  4.66 GBytes   513 Mbits/sec                  receiver

iperf Done.
模擬TCP一個特定文件發送數據:-F
SUSE01:/soft # iperf3 -c 192.168.17.142 -F test.dbf -i 5 -t 40
Connecting to host 192.168.17.142, port 5201
[  4] local 192.168.17.141 port 48115 connected to 192.168.17.142 port 5201
[ ID] Interval           Transfer     Bandwidth       Retr  Cwnd
[  4]   0.00-5.01   sec  82.7 MBytes   139 Mbits/sec    8    117 KBytes
[  4]   5.01-10.02  sec   117 MBytes   195 Mbits/sec    0    168 KBytes
[  4]  10.02-15.00  sec  84.7 MBytes   143 Mbits/sec    7    110 KBytes
[  4]  15.00-20.04  sec   106 MBytes   177 Mbits/sec    0    158 KBytes
[  4]  20.04-25.00  sec   105 MBytes   177 Mbits/sec   12    140 KBytes
[  4]  25.00-30.00  sec   126 MBytes   212 Mbits/sec    0    174 KBytes
[  4]  30.00-35.03  sec   129 MBytes   215 Mbits/sec    1    148 KBytes
[  4]  35.03-40.00  sec   105 MBytes   178 Mbits/sec    6   32.5 KBytes
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bandwidth       Retr
[  4]   0.00-40.00  sec   856 MBytes   179 Mbits/sec   34             sender
        Sent  856 MByte / 1000 MByte (85%) of test.dbf
[  4]   0.00-40.00  sec   855 MBytes   179 Mbits/sec                  receiver

iperf Done.
將結果輸出都以MBytes/sec來顯示: -f M
SUSE01:/soft # iperf3 -c 192.168.17.142 -n 2000000000 -i 5 -f M
Connecting to host 192.168.17.142, port 5201
[  4] local 192.168.17.141 port 48117 connected to 192.168.17.142 port 5201
[ ID] Interval           Transfer     Bandwidth       Retr  Cwnd
[  4]   0.00-5.00   sec   388 MBytes  77.6 MBytes/sec    6    115 KBytes
[  4]   5.00-10.03  sec   283 MBytes  56.2 MBytes/sec    0    165 KBytes
[  4]  10.03-15.00  sec   181 MBytes  36.4 MBytes/sec    9    151 KBytes
[  4]  15.00-20.01  sec   229 MBytes  45.7 MBytes/sec    0    181 KBytes
[  4]  20.01-25.00  sec   379 MBytes  75.9 MBytes/sec   47    146 KBytes
[  4]  25.00-30.00  sec   333 MBytes  66.5 MBytes/sec    2    134 KBytes
[  4]  30.00-31.71  sec   116 MBytes  67.8 MBytes/sec    0    174 KBytes
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bandwidth       Retr
[  4]   0.00-31.71  sec  1.86 GBytes  60.2 MBytes/sec   64             sender
[  4]   0.00-31.71  sec  1.86 GBytes  60.1 MBytes/sec                  receiver

iperf Done.
多線程:-P
SUSE01:/soft # iperf3 -c 192.168.17.142 -n 2000000000 -i 5 -f M -P 2
Connecting to host 192.168.17.142, port 5201
[  4] local 192.168.17.141 port 48119 connected to 192.168.17.142 port 5201
[  6] local 192.168.17.141 port 48120 connected to 192.168.17.142 port 5201
[ ID] Interval           Transfer     Bandwidth       Retr  Cwnd
[  4]   0.00-5.09   sec   126 MBytes  24.7 MBytes/sec   46    117 KBytes
[  6]   0.00-5.09   sec   104 MBytes  20.4 MBytes/sec  102   99.0 KBytes
[SUM]   0.00-5.09   sec   229 MBytes  45.1 MBytes/sec  148
- - - - - - - - - - - - - - - - - - - - - - - - -
[  4]   5.09-10.00  sec   139 MBytes  28.3 MBytes/sec   31   93.3 KBytes
[  6]   5.09-10.00  sec   141 MBytes  28.7 MBytes/sec   16    115 KBytes
[SUM]   5.09-10.00  sec   280 MBytes  57.0 MBytes/sec   47
- - - - - - - - - - - - - - - - - - - - - - - - -
[  4]  10.00-15.06  sec   108 MBytes  21.4 MBytes/sec    0    158 KBytes
[  6]  10.00-15.06  sec  98.2 MBytes  19.4 MBytes/sec   60   2.83 KBytes
[SUM]  10.00-15.06  sec   206 MBytes  40.8 MBytes/sec   60
- - - - - - - - - - - - - - - - - - - - - - - - -
[  4]  15.06-20.00  sec   126 MBytes  25.6 MBytes/sec   38   70.7 KBytes
[  6]  15.06-20.00  sec   141 MBytes  28.5 MBytes/sec    0    117 KBytes
[SUM]  15.06-20.00  sec   267 MBytes  54.0 MBytes/sec   38
- - - - - - - - - - - - - - - - - - - - - - - - -
[  4]  20.00-25.00  sec   131 MBytes  26.2 MBytes/sec   11   96.2 KBytes
[  6]  20.00-25.00  sec   141 MBytes  28.1 MBytes/sec    2    113 KBytes
[SUM]  20.00-25.00  sec   272 MBytes  54.3 MBytes/sec   13
- - - - - - - - - - - - - - - - - - - - - - - - -
[  4]  25.00-30.11  sec   129 MBytes  25.2 MBytes/sec   24   67.9 KBytes
[  6]  25.00-30.11  sec   146 MBytes  28.6 MBytes/sec   19    126 KBytes
[SUM]  25.00-30.11  sec   275 MBytes  53.7 MBytes/sec   43
- - - - - - - - - - - - - - - - - - - - - - - - -
[  4]  30.11-35.01  sec   107 MBytes  21.9 MBytes/sec   32   74.9 KBytes
[  6]  30.11-35.01  sec  99.6 MBytes  20.3 MBytes/sec   41    105 KBytes
[SUM]  30.11-35.01  sec   207 MBytes  42.2 MBytes/sec   73
- - - - - - - - - - - - - - - - - - - - - - - - -
[  4]  35.01-38.33  sec  84.9 MBytes  25.6 MBytes/sec   22   83.4 KBytes
[  6]  35.01-38.33  sec  86.4 MBytes  26.0 MBytes/sec    3    113 KBytes
[SUM]  35.01-38.33  sec   171 MBytes  51.6 MBytes/sec   25
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bandwidth       Retr
[  4]   0.00-38.33  sec   951 MBytes  24.8 MBytes/sec  204             sender
[  4]   0.00-38.33  sec   950 MBytes  24.8 MBytes/sec                  receiver
[  6]   0.00-38.33  sec   956 MBytes  24.9 MBytes/sec  243             sender
[  6]   0.00-38.33  sec   956 MBytes  24.9 MBytes/sec                  receiver
[SUM]   0.00-38.33  sec  1.86 GBytes  49.8 MBytes/sec  447             sender
[SUM]   0.00-38.33  sec  1.86 GBytes  49.7 MBytes/sec                  receiver

iperf Done.
SUSE01:/soft #
測試UDP丟包和延遲
SUSE01:/soft # iperf3 -c 192.168.17.142 -u -b 100M -f M -i 3
Connecting to host 192.168.17.142, port 5201
[  4] local 192.168.17.141 port 44195 connected to 192.168.17.142 port 5201
[ ID] Interval           Transfer     Bandwidth       Total Datagrams
[  4]   0.00-3.00   sec  34.6 MBytes  11.5 MBytes/sec  4428
[  4]   3.00-6.00   sec  36.1 MBytes  12.0 MBytes/sec  4625
[  4]   6.00-9.00   sec  35.7 MBytes  11.9 MBytes/sec  4564
[  4]   9.00-10.00  sec  12.4 MBytes  12.4 MBytes/sec  1589
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bandwidth       Jitter    Lost/Total Datagrams
[  4]   0.00-10.00  sec   119 MBytes  11.9 MBytes/sec  0.340 ms  357/15206 (2.3%)
[  4] Sent 15206 datagrams

iperf Done.


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM