Iperf使用方法與參數說明linux
http://pkgs.repoforge.org/iperf/windows
Iperf是一個網絡性能測試工具。能夠測試TCP和UDP帶寬質量,能夠測量最大TCP帶寬,具備多種參數和UDP特性,能夠報告帶寬,延遲抖動和數據包丟失。Iperf在linux和windows平臺均有二進制版本供自由使用。服務器
Iperf was developed by NLANRDAST as a modern alternative for measuring maximum TCP and UDP bandwidth performance. Iperf allows the tuning of various parameters and UDP characteristics. Iperf reports bandwidth, delay jitter, datagram loss.網絡
Iperf使用方法與參數說明tcp
參數說明ide
-s 以server模式啓動,eg:iperf -s工具
-c host以client模式啓動,host是server端地址,eg:iperf -c 222.35.11.23性能
通用參數測試
-f [kmKM] 分別表示以Kbits, Mbits, KBytes, MBytes顯示報告,默認以Mbits爲單位,eg:iperf -c 222.35.11.23 -f Kspa
-i sec 以秒爲單位顯示報告間隔,eg:iperf -c 222.35.11.23 -i 2
-l 緩衝區大小,默認是8KB,eg:iperf -c 222.35.11.23 -l 16
-m 顯示tcp最大mtu值
-o 將報告和錯誤信息輸出到文件eg:iperf -c 222.35.11.23 -o ciperflog.txt
-p 指定服務器端使用的端口或客戶端所鏈接的端口eg:iperf -s -p 9999;iperf -c 222.35.11.23 -p 9999
-u 使用udp協議
-w 指定TCP窗口大小,默認是8KB
-B 綁定一個主機地址或接口(當主機有多個地址或接口時使用該參數)
-C 兼容舊版本(當server端和client端版本不同時使用)
-M 設定TCP數據包的最大mtu值
-N 設定TCP不延時
-V 傳輸ipv6數據包
server專用參數
-D 以服務方式運行iperf,eg:iperf -s -D
-R 中止iperf服務,針對-D,eg:iperf -s -R
client端專用參數
-d 同時進行雙向傳輸測試
-n 指定傳輸的字節數,eg:iperf -c 222.35.11.23 -n 100000
-r 單獨進行雙向傳輸測試
-t 測試時間,默認10秒,eg:iperf -c 222.35.11.23 -t 5
-F 指定須要傳輸的文件
-T 指定ttl值
應用實例
使用 iperf -s 命令將 Iperf 啓動爲 server 模式,在客戶機上使用 iperf -c啓動client模式。
iperf –s
------------------------------------------------------------
Server listening on TCP port 5001
TCP window size: 8.00 KByte (default)
------------------------------------------------------------
iperf -c 59.128.103.56
上面使用服務端和客戶端的默認設置進行測試
iperf -s -w 300K
------------------------------------------------------------
Server listening on TCP port 5001
TCP window size: 300 KByte
------------------------------------------------------------
iperf -c 59.128.103.56 -f K -i 2 -w 300K
設定報告間隔爲2秒,服務器端和客戶端的TCP窗口都開到300KB
iperf -c 59.128.103.56 -f K -i 2 -w 300K –n 1000000
測試傳輸約1MB數據
iperf -c 59.128.103.56 -f K -i 2 -w 300K –t 36
測試持續36秒
iperf -c 59.128.103.56 -f K -i 2 -w 300K -n 10400000 –d
測試雙向的傳輸
iperf -c 59.128.103.56 -f K -i 2 -w 300K –u
UDP測試
其中 -i 參數的含義是週期性報告的時間間隔(interval),單位爲秒;在上面的例子中,表示每隔2秒報告一次帶寬等信息。