Simple network performance measurements with iperf
iperf is free open-source command-line utility for measuring network performance. It is available for Linux, Windows and macOS. It can be used in both client and server mode.
Install iperf
- Ubuntu:
sudo apt-get install -y iperf - macOS:
brew install iperf - Windows: download here
Server mode
To run iperf in server mode, run the following command:
iperf -s
It listens to TCP port 5001 by default. You change this by specifying the -p parameter.
If you are doing wireless network performance monitoring, then you probably want to run iperf in server mode on a device with a wired ethernet connection.
Client mode
To run iperf in client mode, run the following command:
iperf -c <SERVER_IP>
The default behavior is that the client will send and the server will receive. You can change this behavior by specifying the -R parameter.
Options
There are plenty of options you can use. Use iperf --help to list all available options.
Below some useful options are listed.
Server
-pspecify the port to listen to.
Example: to have iperf listen on port 5551, useiperf -s -p 5551
Client
-tspecify the duration of the test.
Example:iperf -c <SERVER_IP> -t 10-ispecify the interval between reports.
Example:iperf -c <SERVER_IP> -t 30 -i 5-Rreverse the test so that the server receives and the client sends.