← 返回命令列表

Linux command

iperf 命令

网络

复制后可按需替换文件名、目录或参数。

常用示例

Start server

iperf -s

Connect to server

iperf -c [server_ip]

Run test for specific

iperf -c [server_ip] -t [30]

Run UDP test

iperf -c [server_ip] -u

Test with multiple

iperf -c [server_ip] -P [4]

Run bidirectional

iperf -c [server_ip] -d

Set target bandwidth

iperf -c [server_ip] -u -b [100M]

Specify port

iperf -c [server_ip] -p [5001]

Report at intervals

iperf -c [server_ip] -i [1]

说明

iperf measures network bandwidth between two endpoints. One host runs in server mode (-s), and another connects as a client (-c) to perform the test. By default, iperf measures TCP throughput. UDP mode (-u) tests UDP performance with configurable target bandwidth. This is useful for measuring packet loss and jitter at specific rates. Parallel streams (-P) can saturate high-bandwidth links that a single stream cannot fill. Results show bandwidth achieved, along with additional metrics depending on protocol (retransmits for TCP, packet loss and jitter for UDP).

参数

-s
Run in server mode.
-c _HOST_
Run in client mode, connecting to server at HOST.
-p _PORT_
Server port to listen on or connect to (default: 5001).
-u
Use UDP instead of TCP.
-b _BANDWIDTH_
Target bandwidth (e.g., 10M, 1G). Limits UDP and TCP rates.
-t _TIME_
Test duration in seconds (default: 10).
-n _BYTES_
Transmit specified number of bytes instead of using a time duration (e.g., 100M, 1G).
-i _INTERVAL_
Report interval in seconds.
-P _STREAMS_
Number of parallel client streams.
-d
Bidirectional test using separate unidirectional sockets.
-r
Bidirectional test (sequential: client-to-server, then reverse).
--full-duplex
Full duplex test using a single socket for both directions.
-R
Reverse traffic flow (server sends, client receives).
-f _FORMAT_
Report format: a (adaptive), k/m/g (bits), K/M/G (bytes).
-w _SIZE_
Socket buffer size (TCP window size).
-l _LENGTH_
Read/write buffer length (TCP default 128K, UDP default 1470).
-M _MSS_
Set TCP maximum segment size via TCP_MAXSEG.
-N
Disable Nagle's algorithm (set TCP_NODELAY).
-B _HOST_
Bind to a specific host, interface, or multicast address.
-D
Run the server as a daemon.
-e
Display enhanced output in reports.
-o _FILE_
Write report output to specified file.

FAQ

What is the iperf command used for?

iperf measures network bandwidth between two endpoints. One host runs in server mode (-s), and another connects as a client (-c) to perform the test. By default, iperf measures TCP throughput. UDP mode (-u) tests UDP performance with configurable target bandwidth. This is useful for measuring packet loss and jitter at specific rates. Parallel streams (-P) can saturate high-bandwidth links that a single stream cannot fill. Results show bandwidth achieved, along with additional metrics depending on protocol (retransmits for TCP, packet loss and jitter for UDP).

How do I run a basic iperf example?

Run `iperf -s` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -s do in iperf?

Run in server mode.