Nelson's log

iperf to measure UDP loss

Sometimes I want to test link quality by seeing if UDP packets are getting lost. iPerf is a nice tool for that. It’s a client + server command line app that generates floods of packets and verifies they arrived on the other end. A bandwidth intensive ping.

To confuse things, there’s an iperf2 and an iperf3. They sort of do similar things but I think iperf3 is mostly better. In particular the server is now mostly a dumb packet reflector and the client can give the server instructions like “try UDP now” etc, more suited for running a server somewhere stable and headless and testing with the client. See in particular the -R option to ask the server to send packets to the client.


server$ iperf3 -s

client$ iperf3 -u -c somebits.com
Connecting to host somebits.com, port 5201
[  5] local 192.168.0.23 port 63531 connected to 107.150.51.74 port 5201
[ ID] Interval           Transfer     Bandwidth       Total Datagrams
[  5]   0.00-1.00   sec   120 KBytes   983 Kbits/sec  15
[  5]   1.00-2.00   sec   128 KBytes  1.05 Mbits/sec  16
[  5]   2.00-3.00   sec   128 KBytes  1.05 Mbits/sec  16
[  5]   3.00-4.00   sec   128 KBytes  1.05 Mbits/sec  16
[  5]   4.00-5.00   sec   128 KBytes  1.05 Mbits/sec  16
[  5]   5.00-6.00   sec   128 KBytes  1.05 Mbits/sec  16
[  5]   6.00-7.00   sec   128 KBytes  1.05 Mbits/sec  16
[  5]   7.00-8.00   sec   128 KBytes  1.05 Mbits/sec  16
[  5]   8.00-9.00   sec   128 KBytes  1.05 Mbits/sec  16
[  5]   9.00-10.00  sec   128 KBytes  1.05 Mbits/sec  16
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bandwidth       Jitter    Lost/Total Datagrams
[  5]   0.00-10.00  sec  1.24 MBytes  1.04 Mbits/sec  1.545 ms  1/159 (0.63%)
[  5] Sent 159 datagrams

iperf Done.

If I understand correctly the default UDP settings try to send 1 megabit a second worth of packets. That works out to 128 KBytes each second in 16 datagrams, or 8192 byte UDP datagrams. With the usual 1500 byte MTU that works out to 6 actual packets. You can set options for bandwidth, maximum datagram size, etc. Here’s a nice long test sending 1400 byte packets.


iperf3 -R -l 1400 -l 1000 -t 100 -u -c somebits.com

There’s a few public iperf servers to test against. The one run by @scottlinux in California was working well when I just tried it.