使用iperf工具進行帶寬測試

  本文將介紹如何使用工具iperf進行帶寬測試。

  iperf是一個比較好用網絡性能測試工具,可以測試最大TCP和UDP帶寬性能,具有多種參數和UDP特性,可以根據需要調整,可以報告帶寬、延遲抖動和數據包丟失。本文只介紹如何測試帶寬。

 (工具下載地址:https://pan.baidu.com/s/1c22exDu,密碼:qnmg)

  下載軟件,解壓,iperf3.exe就是我們將要使用的工具。

  在兩端測試PC上安裝好工具。

  在測試帶寬之前,確保兩端網絡可達,確定可以ping通(如臺式機ping不通注意Windows自帶防火牆)。

 

  首先是服務器端,打開CMD命令行,將iperf3.exe拖入到cmd命令行中,輸入選項 -s,回車執行,如圖:

 QQ截圖20171128152722.jpg

  這表示服務器端在等待客戶端的請求。


  此時在客戶端PC上,同樣打開CMD命令行,將iperf3.exe拖入到cmd命令行中,輸入-c選項,並指定服務器IP地址,如圖所示:

 QQ截圖20171128153154.jpg

  回車執行,就能夠看到測試的帶寬值。


  下圖是我自己測試的截圖:

 QQ圖片20171128153335_看圖王.png

  我測試的是一條運營商的100M鏈路,這裏大家可以注意看一下,這裏測出的單位是bits/sec,即比特/秒。我們平時下載時顯示的速度是B/sec,即字節/每秒。讀者注意這裏的區別。


  我把此軟件支持的選項列出,有興趣的小夥伴可以深入研究。

  

C:\Users\SCEIC>C:\Users\SCEIC\Desktop\iperf\iperf3.exe

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


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章