Iperf是一個網絡性能測試工具,也就是LINUX網速測試,主要應用于LINUX服務器下面?梢詼y試TCP和UDP帶寬質量,可以測量最大TCP帶寬,具有多種參數和UDP特性,可以報告帶寬,延遲抖動和數據包丟失。Iperf在linux和windows平臺均有二進制版本供自由使用。
下載地址:
http://downloads.sourceforge.net/project/iperf/iperf/2.0.4%20source/iperf-2.0.4.tar.gz?use_mirror=nchc
Iperf使用方法與參數說明
參數說明
-s 以server模式啟動,eg:iperf –s 。Server端為數據的接收端。
-c host以client模式啟動,host是server端地址,eg:iperf -c 222.35.11.23 。Client端為數據的發出端。
通用參數
-f [kmKM] 分別表示以Kbits, Mbits, KBytes, MBytes顯示報告,默認以Mbits為單位,eg:iperf -c 222.35.11.23 -f K
-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 以服務方式運行ipserf,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.125.103.56
上面使用服務端和客戶端的默認設置進行測試
iperf -s -w 300K
————————————————————
Server listening on TCP port 5001
TCP window size: 300 KByte
————————————————————
iperf -c 59.125.103.56 -f K -i 2 -w 300K
設定報告間隔為2秒,服務器端和客戶端的TCP窗口都開到300KB
iperf -c 59.125.103.56 -f K -i 2 -w 300K –n 1000000
測試傳輸約1MB數據
iperf -c 59.125.103.56 -f K -i 2 -w 300K –t 36
測試持續36秒
iperf -c 220.112.45.87 -f K -i 2 -w 300k -n 10400000 -d
測試雙向的傳輸
iperf -c 59.125.103.56 -f K -i 2 -w 300K –u
UDP測試
其中 -i 參數的含義是周期性報告的時間間隔(interval),單位為秒;在上面的例子中,表示每隔2秒報告一次帶寬等信息。
文章來源于領測軟件測試網 http://www.kjueaiud.com/