To test the link speed between two machines on a local network, a method that is often used is to send a file from one machine to the other using a network file sharing protocol such as SMB, NFS, SSHFS, or rsync over SSH.

Unless one of those protocols is already set up on the two computers, this is a very cumbersome way to test network speeds between them. And if the network is faster than one of the storage devices of the two computers involved, either the one from which the file is read or the one to which the file is written (or both), this method would not test the maximum network speed possible. This can easily happen if one of those storage devices happens to be an old fashioned hard-disk.

This is where the simple networking tool iperf comes in. It’s a small program that makes testing the link speed between two computers exceedingly easy and straightforward.

To test the network speed between two computers, on one computer start iperf as a server:

1iperf -s

And on the other computer, run iperf as a client, giving it the IP address of the computer on which iperf is running as a server:

1iperf -c 10.0.0.20

This command, by default, will take 10 seconds to complete, and its output should look something like the following:

1$ iperf -c 10.0.0.20
2------------------------------------------------------------
3Client connecting to 10.0.0.20, TCP port 5001
4TCP window size: 16.0 KByte (default)
5------------------------------------------------------------
6[  1] local 10.0.0.10 port 53928 connected with 10.0.0.20 port 5001
7[ ID] Interval       Transfer     Bandwidth
8[  1] 0.0000-10.0201 sec  1.08 GBytes   924 Mbits/sec

In my case, I’m using 1 Gbps ethernet to connect the computers on my local area network, and the network seems to be working fine at full-speed, given that the test gives a network speed of 924 Mbits/sec.

Of course, iperf can be used not only on local area networks but between any two computers that are reachable from one another.