iperf3 is a commonly used tool to test network throughput on servers, and is regarded as a more reliable test method compared to other tools like speedtest-cli due to the different testing methodology and the fact that iperf3 is has many features to customize usage. 

The following command will test with the client (the server you're running the command from) sending UDP to the remote server. Note that the server we're testing has been replaced with EXAMPLE. You can find public iperf3 servers by searching online, many network providers run their own. In our examples, we're using Clouvider's public iperf3 servers.

[root@server ~]# iperf3 -c ash.speedtest.EXAMPLE.net -p 5202 -ub 1G
Connecting to host ash.speedtest.EXAMPLE.net, port 5202
[ 5] local [IP_REDACTED] port 50108 connected to [IP_REDACTED] port 5202
[ ID] Interval Transfer Bitrate Total Datagrams
[ 5] 0.00-1.00 sec 119 MBytes 999 Mbits/sec 86284
[ 5] 1.00-2.00 sec 119 MBytes 1000 Mbits/sec 86307
[ 5] 2.00-3.00 sec 119 MBytes 1.00 Gbits/sec 86336
[ 5] 3.00-4.00 sec 119 MBytes 1000 Mbits/sec 86316
[ 5] 4.00-5.00 sec 119 MBytes 1.00 Gbits/sec 86328
[ 5] 5.00-6.00 sec 119 MBytes 1.00 Gbits/sec 86332
[ 5] 6.00-7.00 sec 119 MBytes 1000 Mbits/sec 86317
[ 5] 7.00-8.00 sec 119 MBytes 1000 Mbits/sec 86322
[ 5] 8.00-9.00 sec 119 MBytes 1.00 Gbits/sec 86348
[ 5] 9.00-10.00 sec 119 MBytes 1.00 Gbits/sec 86335
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval Transfer Bitrate Jitter Lost/Total Datagrams
[ 5] 0.00-10.00 sec 1.16 GBytes 1000 Mbits/sec 0.000 ms 0/863225 (0%) sender
[ 5] 0.00-10.00 sec 985 MBytes 826 Mbits/sec 0.006 ms 149906/863222 (17%) receiver

The command above runs iperf3 in client mode (-c) and tests against the remote server "ash.speedtest.EXAMPLE.net" which is listening on port 5202 (-p 5202). The parameter "-u" tells the client to use UDP protocol, and "-b" (or "-ub" combined) tells the client to limit bitrate, so our command is limiting to 1Gbps of UDP. If you do not specify a bitrate limit with the "-b" parameter, iperf3 will automatically limit UDP to 1Mbps.

The following command uses  TCP instead of UDP.

[root@server ~]# iperf3 -c ash.speedtest.EXAMPLE.net -p 5202 -b 1G
Connecting to host ash.speedtest.EXAMPLE.net, port 5202
[ 5] local [IP_REDACTED] port 42460 connected to [IP_REDACTED] port 5202
[ ID] Interval Transfer Bitrate Retr Cwnd
[ 5] 0.00-1.00 sec 6.82 MBytes 57.2 Mbits/sec 613 653 KBytes
[ 5] 1.00-2.00 sec 14.9 MBytes 125 Mbits/sec 0 908 KBytes
[ 5] 2.00-3.00 sec 10.5 MBytes 88.1 Mbits/sec 20 687 KBytes
[ 5] 3.00-4.00 sec 10.9 MBytes 91.2 Mbits/sec 0 725 KBytes
[ 5] 4.00-5.00 sec 11.5 MBytes 96.5 Mbits/sec 0 751 KBytes
[ 5] 5.00-6.00 sec 11.8 MBytes 98.6 Mbits/sec 0 765 KBytes
[ 5] 6.00-7.00 sec 12.0 MBytes 101 Mbits/sec 0 771 KBytes
[ 5] 7.00-8.00 sec 12.0 MBytes 101 Mbits/sec 0 771 KBytes
[ 5] 8.00-9.00 sec 12.0 MBytes 101 Mbits/sec 0 771 KBytes
[ 5] 9.00-10.00 sec 12.0 MBytes 101 Mbits/sec 0 773 KBytes
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval Transfer Bitrate Retr
[ 5] 0.00-10.00 sec 114 MBytes 95.9 Mbits/sec 633 sender
[ 5] 0.00-10.00 sec 112 MBytes 94.4 Mbits/sec receiver

The command above instead uses TCP not UDP. TCP throughput will typically be lower than UDP.

Specifying the parameter "-4" or "-6" will force iperf3 to use IPv4 or IPv6 respectively.

If you wish to run your own iperf3 server to test against, you can use the following command.

iperf3 -s -p 5200

This will run iperf3 in server mode on port 5200. You can replace the "-s" parameter with "-d" if you want to run the iperf3 server in daemon mode in the background.

If you are looking for iperf3 servers to test against, here are a few that we consider reliable...

Clouvider (Click link for all of their locations and iperf3 servers):
https://as62240.net/speedtest
Online.net (Paris, France):
ping.online.net -p 5200-5209
Worldstream (Netherlands):
iperf.worldstream.nl -p 5201
Hybula (Netherlands):
speedtest-nl-oum.hybula.net -p 5201

To get an understanding of how it works and the parameters available, check the manual output below.

[root@server ~]# iperf3 -help
Usage: iperf3 [-s|-c host] [options]
iperf3 [-h|--help] [-v|--version]

Server or Client:
-p, --port # server port to listen on/connect to
-f, --format [kmgtKMGT] format to report: Kbits, Mbits, Gbits, Tbits
-i, --interval # seconds between periodic throughput reports
-F, --file name xmit/recv the specified file
-A, --affinity n/n,m set CPU affinity
-B, --bind <host> bind to the interface associated with the address <host>
-V, --verbose more detailed output
-J, --json output in JSON format
--logfile f send output to a log file
--forceflush force flushing output at every interval
-d, --debug emit debugging output
-v, --version show version information and quit
-h, --help show this message and quit
Server specific:
-s, --server run in server mode
-D, --daemon run the server as a daemon
-I, --pidfile file write PID file
-1, --one-off handle one client connection then exit
--rsa-private-key-path path to the RSA private key used to decrypt
authentication credentials
--authorized-users-path path to the configuration file containing user
credentials
Client specific:
-c, --client <host> run in client mode, connecting to <host>
--sctp use SCTP rather than TCP
-X, --xbind <name> bind SCTP association to links
--nstreams # number of SCTP streams
-u, --udp use UDP rather than TCP
--connect-timeout # timeout for control connection setup (ms)
-b, --bitrate #[KMG][/#] target bitrate in bits/sec (0 for unlimited)
(default 1 Mbit/sec for UDP, unlimited for TCP)
(optional slash and packet count for burst mode)
--pacing-timer #[KMG] set the timing for pacing, in microseconds (default 1000)
--fq-rate #[KMG] enable fair-queuing based socket pacing in
bits/sec (Linux only)
-t, --time # time in seconds to transmit for (default 10 secs)
-n, --bytes #[KMG] number of bytes to transmit (instead of -t)
-k, --blockcount #[KMG] number of blocks (packets) to transmit (instead of -t or -n)
-l, --length #[KMG] length of buffer to read or write
(default 128 KB for TCP, dynamic or 1460 for UDP)
--cport <port> bind to a specific client port (TCP and UDP, default: ephemeral port)
-P, --parallel # number of parallel client streams to run
-R, --reverse run in reverse mode (server sends, client receives)
-w, --window #[KMG] set window size / socket buffer size
-C, --congestion <algo> set TCP congestion control algorithm (Linux and FreeBSD only)
-M, --set-mss # set TCP/SCTP maximum segment size (MTU - 40 bytes)
-N, --no-delay set TCP/SCTP no delay, disabling Nagle's Algorithm
-4, --version4 only use IPv4
-6, --version6 only use IPv6
-S, --tos N set the IP type of service, 0-255.
The usual prefixes for octal and hex can be used,
i.e. 52, 064 and 0x34 all specify the same value.
--dscp N or --dscp val set the IP dscp value, either 0-63 or symbolic.
Numeric values can be specified in decimal,
octal and hex (see --tos above).
-L, --flowlabel N set the IPv6 flow label (only supported on Linux)
-Z, --zerocopy use a 'zero copy' method of sending data
-O, --omit N omit the first n seconds
-T, --title str prefix every output line with this string
--get-server-output get results from server
--udp-counters-64bit use 64-bit counters in UDP test packets
--username username for authentication
--rsa-public-key-path path to the RSA public key used to encrypt
authentication credentials

[KMG] indicates options that support a K/M/G suffix for kilo-, mega-, or giga-

iperf3 homepage at: http://software.es.net/iperf/
Report bugs to: https://github.com/esnet/iperf

Was this answer helpful? 4 Users Found This Useful (42 Votes)