Testing local connection speed with iperf

iperf lets you test the connection speed between two computers you have access to, making it useful to test the speed within your local network.

This post assumes you’re running a Linux distro, in my case Ubuntu, but it’ll be relevant for most ones with a common package manager.

To test your internet speed, you can use speedtest (from the speedtest-cli) package, but in some cases you just want to check the speed between two machines on your local network.

Install the iperf package, on two machines:

# Debian-based like Ubuntu
$ sudo apt-get install iperf

# Arch-based:
$ sudo pacman -S iperf

On one machine, run the iperf server to accept connections:

$ iperf -s

Note that machine’s IP address or local hostname. Often it’s accessible through just the hostname. Our main router requires the .broadband suffix but that may vary.

On the other machine, run iperf as a client, specifying the hostname or IP of the server:

# IP for example
# or hostname example: raspberrypi.broadband
$ iperf -c # Replace with your iperf server ip/hostname

iperf will then take a few moments to pump some data through, and will present you with the amount of data it transfered, and the speed. This will be shown on both the server and client machine.

Exit the server iperf process with by pressing ctrl-c.

Further reading: Network Throughput Testing with iPerf On linode docs