iperf is a command line tool for performing real-time network throughput measurements. It is a powerful tool for testing the maximum achievable bandwidth in an IP network.
Important
To perform an iperf test, the user must establish both a server and a client session.
Initial Setup
Server
Server parameter
-s run in server mode
-p port to listen n (default 5001)
-f traffic format to report
K KBytes M Mbytes G Gbytes
Server command
iperf -s -p 5111 -f K
Server output
------------------------------------------------------------
Server listening on TCP port 5111 TCP window size: 85.3 KByte (default)
------------------------------------------------------------
Client
Next, connect to the device which you will use as the client and issue the iperf command with the following parameters.
Client parameter
-c connect to the specified server
-p port to connect to n (default 5001)
-f traffic format to report
K KBytes M Mbytes G Gbytes
Client command
iperf -c 172.30.6.110 -p 5111 -f K
Client output
------------------------------------------------------------
Client connecting to 172.30.6.110, TCP port 5111 TCP window size: 85.0 KByte (default)
------------------------------------------------------------
[ 3] local 192.168.199.138 port 51840 connected with 172.30.6.110 port 5111
[ ID] Interval Transfer Bandwidth
[ 3] 0.0-10.1 sec 5248 KBytes 519 KBytes/sec
Reverse Mode
Client
iperf can be used in both forward (normal) and reverse modes. The default mode is where iperf initiates traffic from the client side to the server side. In reverse mode, the server just listens for traffic and reports any data it receives.
Client command
iperf -c 172.30.6.110 -p 5111 -f K -R
UDP Protocol
iperf UDP mode allows you to test the maximum possible throughput of your connection. This can be useful when troubleshooting networking issues or when you are trying to optimize your network’s performance.
Server
Sever command
iperf -s -p 5111 -f K -u
Sever output
------------------------------------------------------------
Server listening on UDP port 5111
Receiving 1470 byte datagrams
UDP buffer size: 41.1 KByte (default)
------------------------------------------------------------
[ 3] local 172.30.6.1 port 5111 connected with 172.30.6.101 port 36141
------------------------------------------------------------
Client
Client command
iperf -c 172.30.6.1 -p 5111 -f K -f -u
Sever output
[ ID] Interval Transfer Bandwidth Jitter Lost/Total Datagrams
[ 3] local 172.30.6.1 port 5111 connected with 172.30.6.101 port 34011
[ 3] 0.0- 9.9 sec 1282 KBytes 130 KBytes/sec 8.960 ms