A quick memo of how to use iperf/iperf3 to test network speed between two machines.
Server
$ iperf -s -p <port>
Client
$ iperf -c <server_address> -p <port>
Example run
Server
-----------------------------------------------------------
Server listening on 5201
-----------------------------------------------------------
Accepted connection from 10.0.0.2, port 60874
[ 5] local 10.0.0.1 port 5201 connected to 10.0.0.2 port 60876
[ ID] Interval Transfer Bitrate
[ 5] 0.00-1.00 sec 4.53 MBytes 38.0 Mbits/sec
[ 5] 1.00-2.00 sec 4.24 MBytes 35.6 Mbits/sec
[ 5] 2.00-3.00 sec 4.63 MBytes 38.9 Mbits/sec
[ 5] 3.00-4.00 sec 4.68 MBytes 39.2 Mbits/sec
[ 5] 4.00-5.00 sec 4.79 MBytes 40.2 Mbits/sec
[ 5] 5.00-6.00 sec 4.63 MBytes 38.9 Mbits/sec
[ 5] 6.00-7.00 sec 3.89 MBytes 32.6 Mbits/sec
[ 5] 7.00-8.00 sec 3.97 MBytes 33.3 Mbits/sec
[ 5] 8.00-9.00 sec 3.65 MBytes 30.7 Mbits/sec
[ 5] 9.00-10.00 sec 3.93 MBytes 33.0 Mbits/sec
[ 5] 10.00-10.01 sec 22.6 KBytes 30.1 Mbits/sec
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval Transfer Bitrate
[ 5] 0.00-10.01 sec 43.0 MBytes 36.0 Mbits/sec receiver
Client
Connecting to host andy-laptop.local, port 5201
[ 5] local 10.0.0.2 port 60876 connected to 10.0.0.1 port 5201
[ ID] Interval Transfer Bitrate Retr Cwnd
[ 5] 0.00-1.00 sec 5.20 MBytes 43.6 Mbits/sec 8 25.5 KBytes
[ 5] 1.00-2.00 sec 4.35 MBytes 36.5 Mbits/sec 3 60.8 KBytes
[ 5] 2.00-3.00 sec 4.41 MBytes 37.0 Mbits/sec 7 42.4 KBytes
[ 5] 3.00-4.00 sec 4.85 MBytes 40.7 Mbits/sec 8 73.5 KBytes
[ 5] 4.00-5.00 sec 4.78 MBytes 40.1 Mbits/sec 12 31.1 KBytes
[ 5] 5.00-6.00 sec 4.54 MBytes 38.1 Mbits/sec 9 29.7 KBytes
[ 5] 6.00-7.00 sec 3.79 MBytes 31.8 Mbits/sec 11 12.7 KBytes
[ 5] 7.00-8.00 sec 4.16 MBytes 34.9 Mbits/sec 8 28.3 KBytes
[ 5] 8.00-9.00 sec 3.42 MBytes 28.7 Mbits/sec 7 29.7 KBytes
[ 5] 9.00-10.00 sec 4.16 MBytes 34.9 Mbits/sec 7 31.1 KBytes
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval Transfer Bitrate Retr
[ 5] 0.00-10.00 sec 43.7 MBytes 36.6 Mbits/sec 80 sender
[ 5] 0.00-10.01 sec 43.0 MBytes 36.0 Mbits/sec receiver
iperf Done.