1IPERF3(1) User Manuals IPERF3(1)
2
3
4
6 iperf3 - perform network throughput tests
7
9 iperf3 -s [ options ]
10 iperf3 -c server [ options ]
11
12
14 iperf3 is a tool for performing network throughput measurements. It
15 can test TCP, UDP, or SCTP throughput. To perform an iperf3 test the
16 user must establish both a server and a client.
17
18 The iperf3 executable contains both client and server functionality.
19 An iperf3 server can be started using either of the -s or --server com‐
20 mand-line parameters, for example:
21
22 iperf3 -s
23
24 iperf3 --server
25
26 Note that many iperf3 parameters have both short (-s) and long
27 (--server) forms. In this section we will generally use the short form
28 of command-line flags, unless only the long form of a flag is avail‐
29 able.
30
31 By default, the iperf3 server listens on TCP port 5201 for connections
32 from an iperf3 client. A custom port can be specified by using the -p
33 flag, for example:
34
35 iperf3 -s -p 5002
36
37 After the server is started, it will listen for connections from iperf3
38 clients (in other words, the iperf3 program run in client mode). The
39 client mode can be started using the -c command-line option, which also
40 requires a host to which iperf3 should connect. The host can by speci‐
41 fied by hostname, IPv4 literal, or IPv6 literal:
42
43 iperf3 -c iperf3.example.com
44
45 iperf3 -c 192.0.2.1
46
47 iperf3 -c 2001:db8::1
48
49 If the iperf3 server is running on a non-default TCP port, that port
50 number needs to be specified on the client as well:
51
52 iperf3 -c iperf3.example.com -p 5002
53
54 The initial TCP connection is used to exchange test parameters, control
55 the start and end of the test, and to exchange test results. This is
56 sometimes referred to as the "control connection". The actual test
57 data is sent over a separate TCP connection, as a separate flow of UDP
58 packets, or as an independent SCTP connection, depending on what proto‐
59 col was specified by the client.
60
61 Normally, the test data is sent from the client to the server, and mea‐
62 sures the upload speed of the client. Measuring the download speed
63 from the server can be done by specifying the -R flag on the client.
64 This causes data to be sent from the server to the client.
65
66 iperf3 -c iperf3.example.com -p 5202 -R
67
68 Results are displayed on both the client and server. There will be at
69 least one line of output per measurement interval (by default a mea‐
70 surement interval lasts for one second, but this can be changed by the
71 -i option). Each line of output includes (at least) the time since the
72 start of the test, amount of data transferred during the interval, and
73 the average bitrate over that interval. Note that the values for each
74 measurement interval are taken from the point of view of the endpoint
75 process emitting that output (in other words, the output on the client
76 shows the measurement interval data for the client.
77
78 At the end of the test is a set of statistics that shows (at least as
79 much as possible) a summary of the test as seen by both the sender and
80 the receiver, with lines tagged accordingly. Recall that by default
81 the client is the sender and the server is the receiver, although as
82 indicated above, use of the -R flag will reverse these roles.
83
84 The client can be made to retrieve the server-side output for a given
85 test by specifying the --get-server-output flag.
86
87 Either the client or the server can produce its output in a JSON struc‐
88 ture, useful for integration with other programs, by passing it the -J
89 flag. Because the contents of the JSON structure are only completely
90 known after the test has finished, no JSON output will be emitted until
91 the end of the test.
92
93 iperf3 has a (overly) large set of command-line options that can be
94 used to set the parameters of a test. They are given in the "GENERAL
95 OPTIONS" section of the manual page below, as well as summarized in
96 iperf3's help output, which can be viewed by running iperf3 with the -h
97 flag.
98
100 -p, --port n
101 set server port to listen on/connect to to n (default 5201)
102
103 -f, --format
104 [kmgtKMGT] format to report: Kbits/Mbits/Gbits/Tbits
105
106 -i, --interval n
107 pause n seconds between periodic throughput reports; default is
108 1, use 0 to disable
109
110 -I, --pidfile file
111 write a file with the process ID, most useful when running as a
112 daemon.
113
114 -F, --file name
115 Use a file as the source (on the sender) or sink (on the re‐
116 ceiver) of data, rather than just generating random data or
117 throwing it away. This feature is used for finding whether or
118 not the storage subsystem is the bottleneck for file transfers.
119 It does not turn iperf3 into a file transfer tool. The length,
120 attributes, and in some cases contents of the received file may
121 not match those of the original file.
122
123 -A, --affinity n/n,m
124 Set the CPU affinity, if possible (Linux, FreeBSD, and Windows
125 only). On both the client and server you can set the local
126 affinity by using the n form of this argument (where n is a CPU
127 number). In addition, on the client side you can override the
128 server's affinity for just that one test, using the n,m form of
129 argument. Note that when using this feature, a process will
130 only be bound to a single CPU (as opposed to a set containing
131 potentially multiple CPUs).
132
133 -B, --bind host[%dev]
134 bind to the specific interface associated with address host. If
135 an optional interface is specified, it is treated as a shortcut
136 for --bind-dev dev. Note that a percent sign and interface de‐
137 vice name are required for IPv6 link-local address literals.
138
139 --bind-dev dev
140 bind to the specified network interface. This option uses
141 SO_BINDTODEVICE, and may require root permissions. (Available
142 on Linux and possibly other systems.)
143
144 -V, --verbose
145 give more detailed output
146
147 -J, --json
148 output in JSON format
149
150 --logfile file
151 send output to a log file.
152
153 --forceflush
154 force flushing output at every interval. Used to avoid buffer‐
155 ing when sending output to pipe.
156
157 --timestamps[=format]
158 prepend a timestamp at the start of each output line. By de‐
159 fault, timestamps have the format emitted by ctime(1). Option‐
160 ally, = followed by a format specification can be passed to cus‐
161 tomize the timestamps, see strftime(3). If this optional format
162 is given, the = must immediately follow the --timestamps option
163 with no whitespace intervening.
164
165 --rcv-timeout #
166 set idle timeout for receiving data during active tests. The re‐
167 ceiver will halt a test if no data is received from the sender
168 for this number of ms (default to 12000 ms, or 2 minutes).
169
170 --snd-timeout #
171 set timeout for unacknowledged TCP data (on both test and con‐
172 trol connections) This option can be used to force a faster test
173 timeout in case of a network partition during a test. The re‐
174 quired parameter is specified in ms, and defaults to the system
175 settings. This functionality depends on the TCP_USER_TIMEOUT
176 socket option, and will not work on systems that do not support
177 it.
178
179 -d, --debug
180 emit debugging output. Primarily (perhaps exclusively) of use
181 to developers.
182
183 -v, --version
184 show version information and quit
185
186 -h, --help
187 show a help synopsis
188
189
191 -s, --server
192 run in server mode
193
194 -D, --daemon
195 run the server in background as a daemon
196
197 -1, --one-off
198 handle one client connection, then exit. If an idle time is
199 set, the server will exit after that amount of time with no con‐
200 nection.
201
202 --idle-timeout n
203 restart the server after n seconds in case it gets stuck. In
204 one-off mode, this is the number of seconds the server will wait
205 before exiting.
206
207 --server-bitrate-limit n[KMGT]
208 set a limit on the server side, which will cause a test to abort
209 if the client specifies a test of more than n bits per second,
210 or if the average data sent or received by the client (including
211 all data streams) is greater than n bits per second. The de‐
212 fault limit is zero, which implies no limit. The interval over
213 which to average the data rate is 5 seconds by default, but can
214 be specified by adding a '/' and a number to the bitrate speci‐
215 fier.
216
217 --rsa-private-key-path file
218 path to the RSA private key (not password-protected) used to de‐
219 crypt authentication credentials from the client (if built with
220 OpenSSL support).
221
222 --authorized-users-path file
223 path to the configuration file containing authorized users cre‐
224 dentials to run iperf tests (if built with OpenSSL support).
225 The file is a comma separated list of usernames and password
226 hashes; more information on the structure of the file can be
227 found in the EXAMPLES section.
228
229 --time-skew-thresholdsecond seconds
230 time skew threshold (in seconds) between the server and client
231 during the authentication process.
232
234 -c, --client host[%dev]
235 run in client mode, connecting to the specified server. By de‐
236 fault, a test consists of sending data from the client to the
237 server, unless the -R flag is specified. If an optional inter‐
238 face is specified, it is treated as a shortcut for --bind-dev
239 dev. Note that a percent sign and interface device name are re‐
240 quired for IPv6 link-local address literals.
241
242 --sctp use SCTP rather than TCP (FreeBSD and Linux)
243
244 -u, --udp
245 use UDP rather than TCP
246
247 --connect-timeout n
248 set timeout for establishing the initial control connection to
249 the server, in milliseconds. The default behavior is the oper‐
250 ating system's timeout for TCP connection establishment. Pro‐
251 viding a shorter value may speed up detection of a down iperf3
252 server.
253
254 -b, --bitrate n[KMGT]
255 set target bitrate to n bits/sec (default 1 Mbit/sec for UDP,
256 unlimited for TCP/SCTP). If there are multiple streams (-P
257 flag), the throughput limit is applied separately to each
258 stream. You can also add a '/' and a number to the bitrate
259 specifier. This is called "burst mode". It will send the given
260 number of packets without pausing, even if that temporarily ex‐
261 ceeds the specified throughput limit. Setting the target bi‐
262 trate to 0 will disable bitrate limits (particularly useful for
263 UDP tests). This throughput limit is implemented internally in‐
264 side iperf3, and is available on all platforms. Compare with
265 the --fq-rate flag. This option replaces the --bandwidth flag,
266 which is now deprecated but (at least for now) still accepted.
267
268 --pacing-timer n[KMGT]
269 set pacing timer interval in microseconds (default 1000 mi‐
270 croseconds, or 1 ms). This controls iperf3's internal pacing
271 timer for the -b/--bitrate option. The timer fires at the in‐
272 terval set by this parameter. Smaller values of the pacing
273 timer parameter smooth out the traffic emitted by iperf3, but
274 potentially at the cost of performance due to more frequent
275 timer processing.
276
277 --fq-rate n[KMGT]
278 Set a rate to be used with fair-queueing based socket-level pac‐
279 ing, in bits per second. This pacing (if specified) will be in
280 addition to any pacing due to iperf3's internal throughput pac‐
281 ing (-b/--bitrate flag), and both can be specified for the same
282 test. Only available on platforms supporting the SO_MAX_PAC‐
283 ING_RATE socket option (currently only Linux). The default is
284 no fair-queueing based pacing.
285
286 --no-fq-socket-pacing
287 This option is deprecated and will be removed. It is equivalent
288 to specifying --fq-rate=0.
289
290 -t, --time n
291 time in seconds to transmit for (default 10 secs)
292
293 -n, --bytes n[KMGT]
294 number of bytes to transmit (instead of -t)
295
296 -k, --blockcount n[KMGT]
297 number of blocks (packets) to transmit (instead of -t or -n)
298
299 -l, --length n[KMGT]
300 length of buffer to read or write. For TCP tests, the default
301 value is 128KB. In the case of UDP, iperf3 tries to dynamically
302 determine a reasonable sending size based on the path MTU; if
303 that cannot be determined it uses 1460 bytes as a sending size.
304 For SCTP tests, the default size is 64KB.
305
306 --cport port
307 bind data streams to a specific client port (for TCP and UDP
308 only, default is to use an ephemeral port)
309
310 -P, --parallel n
311 number of parallel client streams to run. Note that iperf3 is
312 single threaded, so if you are CPU bound, this will not yield
313 higher throughput.
314
315 -R, --reverse
316 reverse the direction of a test, so that the server sends data
317 to the client
318
319 --bidir
320 test in both directions (normal and reverse), with both the
321 client and server sending and receiving data simultaneously
322
323 -w, --window n[KMGT]
324 set socket buffer size / window size. This value gets sent to
325 the server and used on that side too; on both sides this option
326 sets both the sending and receiving socket buffer sizes. This
327 option can be used to set (indirectly) the maximum TCP window
328 size. Note that on Linux systems, the effective maximum window
329 size is approximately double what is specified by this option
330 (this behavior is not a bug in iperf3 but a "feature" of the
331 Linux kernel, as documented by tcp(7) and socket(7)).
332
333 -M, --set-mss n
334 set TCP/SCTP maximum segment size (MTU - 40 bytes)
335
336 -N, --no-delay
337 set TCP/SCTP no delay, disabling Nagle's Algorithm
338
339 -4, --version4
340 only use IPv4
341
342 -6, --version6
343 only use IPv6
344
345 -S, --tos n
346 set the IP type of service. The usual prefixes for octal and hex
347 can be used, i.e. 52, 064 and 0x34 all specify the same value.
348
349 --dscp dscp
350 set the IP DSCP bits. Both numeric and symbolic values are ac‐
351 cepted. Numeric values can be specified in decimal, octal and
352 hex (see --tos above). To set both the DSCP bits and the ECN
353 bits, use --tos.
354
355 -L, --flowlabel n
356 set the IPv6 flow label (currently only supported on Linux)
357
358 -X, --xbind name
359 Bind SCTP associations to a specific subset of links using
360 sctp_bindx(3). The --B flag will be ignored if this flag is
361 specified. Normally SCTP will include the protocol addresses of
362 all active links on the local host when setting up an associa‐
363 tion. Specifying at least one --X name will disable this behav‐
364 iour. This flag must be specified for each link to be included
365 in the association, and is supported for both iperf servers and
366 clients (the latter are supported by passing the first --X argu‐
367 ment to bind(2)). Hostnames are accepted as arguments and are
368 resolved using getaddrinfo(3). If the --4 or --6 flags are
369 specified, names which do not resolve to addresses within the
370 specified protocol family will be ignored.
371
372 --nstreams n
373 Set number of SCTP streams.
374
375 -Z, --zerocopy
376 Use a "zero copy" method of sending data, such as sendfile(2),
377 instead of the usual write(2).
378
379 -O, --omit n
380 Perform pre-test for N seconds and omit the pre-test statistics,
381 to skip past the TCP slow-start period.
382
383 -T, --title str
384 Prefix every output line with this string.
385
386 --extra-data str
387 Specify an extra data string field to be included in JSON out‐
388 put.
389
390 -C, --congestion algo
391 Set the congestion control algorithm (Linux and FreeBSD only).
392 An older --linux-congestion synonym for this flag is accepted
393 but is deprecated.
394
395 --get-server-output
396 Get the output from the server. The output format is determined
397 by the server (in particular, if the server was invoked with the
398 --json flag, the output will be in JSON format, otherwise it
399 will be in human-readable format). If the client is run with
400 --json, the server output is included in a JSON object; other‐
401 wise it is appended at the bottom of the human-readable output.
402
403 --udp-counters-64bit
404 Use 64-bit counters in UDP test packets. The use of this option
405 can help prevent counter overflows during long or high-bitrate
406 UDP tests. Both client and server need to be running at least
407 version 3.1 for this option to work. It may become the default
408 behavior at some point in the future.
409
410 --repeating-payload
411 Use repeating pattern in payload, instead of random bytes. The
412 same payload is used in iperf2 (ASCII '0..9' repeating). It
413 might help to test and reveal problems in networking gear with
414 hardware compression (including some WiFi access points), where
415 iperf2 and iperf3 perform differently, just based on payload en‐
416 tropy.
417
418 --dont-fragment
419 Set the IPv4 Don't Fragment (DF) bit on outgoing packets. Only
420 applicable to tests doing UDP over IPv4.
421
422 --username username
423 username to use for authentication to the iperf server (if built
424 with OpenSSL support). The password will be prompted for inter‐
425 actively when the test is run. Note, the password to use can
426 also be specified via the IPERF3_PASSWORD environment variable.
427 If this variable is present, the password prompt will be
428 skipped.
429
430 --rsa-public-key-path file
431 path to the RSA public key used to encrypt authentication cre‐
432 dentials (if built with OpenSSL support)
433
434
436 Authentication - RSA Keypair
437 The authentication feature of iperf3 requires an RSA public keypair.
438 The public key is used to encrypt the authentication token containing
439 the user credentials, while the private key is used to decrypt the au‐
440 thentication token. The private key must be in PEM format and addi‐
441 tionally must not have a password set. The public key must be in PEM
442 format and use SubjectPrefixKeyInfo encoding. An example of a set of
443 UNIX/Linux commands using OpenSSL to generate a correctly-formed key‐
444 pair follows:
445
446 > openssl genrsa -des3 -out private.pem 2048
447 > openssl rsa -in private.pem -outform PEM -pubout -out public.pem
448 > openssl rsa -in private.pem -out private_not_protected.pem -out‐
449 form PEM
450
451 After these commands, the public key will be contained in the file pub‐
452 lic.pem and the private key will be contained in the file pri‐
453 vate_not_protected.pem.
454
455 Authentication - Authorized users configuration file
456 A simple plaintext file must be provided to the iperf3 server in order
457 to specify the authorized user credentials. The file is a simple list
458 of comma-separated pairs of a username and a corresponding password
459 hash. The password hash is a SHA256 hash of the string "{$user}$pass‐
460 word". The file can also contain commented lines (starting with the #
461 character). An example of commands to generate the password hash on a
462 UNIX/Linux system is given below:
463
464 > S_USER=mario S_PASSWD=rossi
465 > echo -n "{$S_USER}$S_PASSWD" | sha256sum | awk '{ print $1 }'
466
467 An example of a password file (with an entry corresponding to the above
468 username and password) is given below:
469 > cat credentials.csv
470 # file format: username,sha256
471 mario,bf7a49a846d44b454a5d11e7ac‐
472 faf13d138bbe0b7483aa3e050879700572709b
473
474
475
477 A list of the contributors to iperf3 can be found within the documenta‐
478 tion located at https://software.es.net/iperf/dev.html#authors.
479
480
482 libiperf(3), https://software.es.net/iperf
483
484
485
486ESnet September 2022 IPERF3(1)