close

Iperf 是一個 TCP/IP 和 UDP/IP 的性能測量工具,能夠提供網絡吞吐率信息,以及Jitter震動、丟包率、最大段和最大傳輸單元大小等統計信息;從而能夠幫助我們測試網絡性能,定位網絡瓶頸。



參數說明
-s 以server模式啟動,eg:iperf -s
-c host以client模式啟動,host是server端地址,eg:iperf -c 222.35.11.23



通用參數
-f [k|m|K|M] 分別表示以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 c:\iperflog.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
為一免費之網路封包產生軟體,它可用來產生IPv6IPv4的網路封包,進而產生TCPUDP相關的傳輸數據報表。他可以用來量測網路的最大TCP throughputUDP bandwidthUDP delay jitterUDP packet loss

針對IPv6部分,可透過以下指令來達成:

Server side

$ iperf -s –V

Client side

$ iperf -c <Server IPv6 Address> -V

詳細使用參數,如下所示:
 















































































































































Command line option



Environment variable option



Description



Client and Server options



-f, --format [bkmaBKMA]



$IPERF_FORMAT



A letter specifying the format to print bandwidth numbers in. Supported formats are 


    'b' = bits/sec            'B' = Bytes/sec


    'k' = Kbits/sec           'K' = KBytes/sec


    'm' = Mbits/sec           'M' = MBytes/sec


    'g' = Gbits/sec           'G' = GBytes/sec


    'a' = adaptive bits/sec   'A' = adaptive Bytes/sec


       


The adaptive formats choose between kilo- and mega- as appropriate. Fields other than bandwidth always print bytes, but otherwise follow the requested format. Default is 'a'. 
NOTE: here Kilo = 1024, Mega = 1024^2 and Giga = 1024^3 when dealing with bytes. Commonly in networking, Kilo = 1000, Mega = 1000^2, and Giga = 1000^3 so we use this when dealing with bits. If this really bothers you, use -f b and do the math.



-i, --interval #



$IPERF_INTERVAL



Sets the interval time in seconds between periodic bandwidth, jitter, and loss reports. If non-zero, a report is made every interval seconds of the bandwidth since the last report. If zero, no periodic reports are printed. Default is zero.



-l, --len #[KM]



$IPERF_LEN



The length of buffers to read or write. Iperf works by writing an array of len bytes a number of times. Default is 8 KB for TCP, 1470 bytes for UDP. Note for UDP, this is the datagram size and needs to be lowered when using IPv6 addressing to 1450 or less to avoid fragmentation. See also the -n and -t options.



-m, --print_mss



$IPERF_PRINT_MSS



Print the reported TCP MSS size (via the TCP_MAXSEG option) and the observed read sizes which often correlate with the MSS. The MSS is usually the MTU - 40 bytes for the TCP/IP header. Often a slightly smaller MSS is reported because of extra header space from IP options. The interface type corresponding to the MTU is also printed (ethernet, FDDI, etc.). This option is not implemented on many OSes, but the read sizes may still indicate the MSS.



-p, --port #



$IPERF_PORT



The server port for the server to listen on and the client to connect to. This should be the same in both client and server. Default is 5001, the same as ttcp.



-u, --udp



$IPERF_UDP



Use UDP rather than TCP. See also the -b option.



-w, --window #[KM]



$TCP_WINDOW_SIZE



Sets the socket buffer sizes to the specified value. For TCP, this sets the TCP window size. For UDP it is just the buffer which datagrams are received in, and so limits the largest receivable datagram size.



-B, --bind host



$IPERF_BIND



Bind to host, one of this machine's addresses. For the client this sets the outbound interface. For a server this sets the incoming interface. This is only useful on multihomed hosts, which have multiple network interfaces. 


For Iperf in UDP server mode, this is also used to bind and join to a multicast group. Use addresses in the range 224.0.0.0 to 239.255.255.255 for multicast. See also the -T option.



-C, --compatibility



$IPERF_COMPAT



Compatibility mode allows for use with older version of iperf. This mode is not required for interoperability but it is highly recommended. In some cases when using representative streaming you could cause a 1.7 server to crash or cause undesired connection attempts.



-M, --mss #[KM}



$IPERF_MSS



Attempt to set the TCP maximum segment size (MSS) via the TCP_MAXSEG option. The MSS is usually the MTU - 40 bytes for the TCP/IP header. For ethernet, the MSS is 1460 bytes (1500 byte MTU). This option is not implemented on many OSes.



-N, --nodelay



$IPERF_NODELAY



Set the TCP no delay option, disabling Nagle's algorithm. Normally this is only disabled for interactive applications like telnet.



-V (from v1.6 or higher)



.



Bind to an IPv6 address
Server side:
$ iperf -s -V 


Client side:
$ iperf -c <Server IPv6 Address> -V
 


Note: On version 1.6.3 and later a specific IPv6 Address does not need to be bound with the -B option, previous 1.6 versions do. Also on most OSes using this option will also respond to IPv4 clients using IPv4 mapped addresses.



Server specific options



-s, --server



$IPERF_SERVER



Run Iperf in server mode.



-D (from v1.2 or higher)



.



Run the server as a daemon (Unix platforms)
On Win32 platforms where services are available, Iperf will start running as a service.



-R (only for Windows, from v1.2 or higher)



.



Remove the Iperf service (if it's running). 



-o (only for Windows, from v1.2 or higher)



.



Redirect output to given file. 



-c, --client host



$IPERF_CLIENT



If Iperf is in server mode, then specifying a host with -c will limit the connections that Iperf will accept to the host specified. Does not work well for UDP.



-P, --parallel #



$IPERF_PARALLEL



The number of connections to handle by the server before closing. Default is 0 (which means to accept connections forever).



Client specific options



-b, --bandwidth #[KM]



$IPERF_BANDWIDTH



The UDP bandwidth to send at, in bits/sec. This implies the -u option. Default is 1 Mbit/sec.



-c, --client host



$IPERF_CLIENT



Run Iperf in client mode, connecting to an Iperf server running on host.



-d, --dualtest



$IPERF_DUALTEST



Run Iperf in dual testing mode. This will cause the server to connect back to the client on the port specified in the -L option (or defaults to the port the client connected to the server on). This is done immediately therefore running the tests simultaneously. If you want an alternating test try -r.



-n, --num #[KM]



$IPERF_NUM



The number of buffers to transmit. Normally, Iperf sends for 10 seconds. The -n option overrides this and sends an array of len bytes num times, no matter how long that takes. See also the -l and -t options.



-r, --tradeoff



$IPERF_TRADEOFF



Run Iperf in tradeoff testing mode. This will cause the server to connect back to the client on the port specified in the -L option (or defaults to the port the client connected to the server on). This is done following the client connection termination, therefore running the tests alternating. If you want an simultaneous test try -d.



-t, --time #



$IPERF_TIME



The time in seconds to transmit for. Iperf normally works by repeatedly sending an array of len bytes for time seconds. Default is 10 seconds. See also the -l and -n options.



-L, --listenport #



$IPERF_LISTENPORT



This specifies the port that the server will connect back to the client on. It defaults to the port used to connect to the server from the client.



-P, --parallel #



$IPERF_PARALLEL



The number of simultaneous connections to make to the server. Default is 1. Requires thread support on both the client and server.



-S, --tos #



$IPERF_TOS



The type-of-service for outgoing packets. (Many routers ignore the TOS field.) You may specify the value in hex with a '0x' prefix, in octal with a '0' prefix, or in decimal. For example, '0x10' hex = '020' octal = '16' decimal. The TOS numbers specified in RFC 1349 are: 


    IPTOS_LOWDELAY     minimize delay        0x10


    IPTOS_THROUGHPUT   maximize throughput   0x08


    IPTOS_RELIABILITY  maximize reliability  0x04


    IPTOS_LOWCOST      minimize cost         0x02


    


       



-T, --ttl #



$IPERF_TTL



The time-to-live for outgoing multicast packets. This is essentially the number of router hops to go through, and is also used for scoping. Default is 1, link-local.



-F (from v1.2 or higher)



.



Use a representative stream to measure bandwidth, e.g. :- 
$ iperf -c <server address> -F <file-name>



-I (from v1.2 or higher)



.



Same as -F, input from stdin.



Miscellaneous options



-h, --help



 



Print out a summary of commands and quit.



-v, --version



 



Print version information and quit. Prints 'pthreads' if compiled with POSIX threads, 'win32 threads' if compiled with Microsoft Win32 threads, or 'single threaded' if compiled without threads.




 


arrow
arrow
    全站熱搜

    小雷 發表在 痞客邦 留言(0) 人氣()