It can be used to determine available bandwidth using both Transmission Control Protocol (TCP) and User Datagram Protocol (UDP) data streams.
To install an already
compiled version of iPerf on a Mac
OS X system,
such as a MacBook Pro laptop, download the
Apple macOS Intel 64bits
version. The latest version is a 3.x version. You will need matching
versions on both the client and server systems. E.g., a 2.x version on both
or a 3.x version on both. The software is available in
ZIP file format. If you double-click on the zip file in the
Finder application, a Unix Executable File will be extracted from the
.zip file, e.g.,
iperf3. You can move the file to the
Applications/Utilities directory or place it wherever
you like on the system.
To run the program, open a
Terminal window -
the Terminal application is found in the
directory. If you type
/pathtofile/iperf3 -h, where
pathtofile is the location where you placed the executable file,
for the iperf3 version you will see the following "help" information on
the usage of the program:
$ /Applications/Utilities/iperf3 -h Usage: iperf [-s|-c host] [options] iperf [-h|--help] [-v|--version] Server or Client: -p, --port # server port to listen on/connect to -f, --format [kmgKMG] format to report: Kbits, Mbits, KBytes, MBytes -i, --interval # seconds between periodic bandwidth reports -F, --file name xmit/recv the specified file -B, --bind <host> bind to a specific interface -V, --verbose more detailed output -J, --json output in JSON format --logfile f send output to a log file -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 Client specific: -c, --client <host> run in client mode, connecting to <host> -u, --udp use UDP rather than TCP -b, --bandwidth #[KMG][/#] target bandwidth in bits/sec (0 for unlimited) (default 1 Mbit/sec for UDP, unlimited for TCP) (optional slash and packet count for burst mode) -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, --len #[KMG] length of buffer to read or write (default 128 KB for TCP, 8 KB 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 -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' -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 [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 $
If you run iPerf version 3in server mode with the command
, you will see the following:
$ /Applications/Utilities/iperf3 -s ----------------------------------------------------------- Server listening on 5201 -----------------------------------------------------------
Version 3 of the program listens on TCP port 5201 by default whereas version 2.x versions listen on TCP port 5001 by default.
You will also see a window open with the following question (image):
Do you want the application "iperf3" to
accept incoming network connections?
Clicking Deny may limit the application's behavior.
This setting can be changed in the Firewall pane of
Security & Privacy preferences.
You will need to click on Allow to allow external systems running
iPerf in client mode to connect to the system. You can terminate the
program from the command line by hitting
c keys simultaneously.
You can check on whether iPerf is allowed to listen for incoming connections on an OS X system by the following steps:
You can determine if iperf is allowed to accept incoming connections from
a command line interface (CLI), e.g., a
Terminal window - the Terminal program is found in the
Applications/Utilities directory - by using the
socketfilterfw --listapps command as shown below:
$ /usr/libexec/ApplicationFirewall/socketfilterfw --listapps ALF: total number of apps = 6 1 : /System/Library/StagedFrameworks/Safari/WebKit.framework/Versions/A/XPCServ ices/com.apple.WebKit.Plugin.32.xpc ( Allow incoming connections ) 2 : /Applications/Utilities/iperf3 ( Allow incoming connections ) 3 : /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/java ( Allow incoming connections ) 4 : /Applications/Firefox.app/Contents/MacOS/plugin-container.app ( Allow incoming connections ) 5 : /System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.a pp ( Allow incoming connections ) 6 : /System/Library/Frameworks/WebKit.framework/Versions/A/Frameworks/WebKitLeg acy.framework/WebKitPluginHost.app ( Allow incoming connections ) $
The above command shows the status of firewall rules for other applications as well; you can restrict the displayed output to just the rule for iperf with the command shown below:
$ /usr/libexec/ApplicationFirewall/socketfilterfw --listapps | grep -A 1 "iperf" 2 : /Applications/Utilities/iperf3 ( Allow incoming connections ) $
If the firewall software on the system is blocking incoming connectivity to iperf, you would see the following, instead.
$ /usr/libexec/ApplicationFirewall/socketfilterfw --listapps | grep -A 1 "iperf" 2 : /Applications/Utilities/iperf3 ( Block incoming connections ) $
To run iPerf in client mode to connect to an external iPerf system,
use the command
iperf -c remotehost where remotehost
is the IP address or
fully qualified domain name (FQDN) for the remote
system. E.g., the iPerf output included below is from a test to a
publicly available iPerf server,
$ /Applications/Utilities/iperf3 -c bouygues.testdebit.info Connecting to host bouygues.testdebit.info, port 5201 [ 6] local 192.168.3.7 port 59177 connected to 18.104.22.168 port 5201 [ ID] Interval Transfer Bandwidth [ 6] 0.00-1.00 sec 630 KBytes 5.16 Mbits/sec [ 6] 1.00-2.00 sec 1.13 MBytes 9.43 Mbits/sec [ 6] 2.00-3.00 sec 1.30 MBytes 10.9 Mbits/sec [ 6] 3.00-4.00 sec 0.00 Bytes 0.00 bits/sec [ 6] 4.00-5.00 sec 23.5 KBytes 193 Kbits/sec [ 6] 5.00-6.00 sec 0.00 Bytes 0.00 bits/sec [ 6] 6.00-7.00 sec 165 KBytes 1.35 Mbits/sec [ 6] 7.00-8.01 sec 222 KBytes 1.81 Mbits/sec [ 6] 8.01-9.00 sec 341 KBytes 2.80 Mbits/sec [ 6] 9.00-10.00 sec 386 KBytes 3.16 Mbits/sec - - - - - - - - - - - - - - - - - - - - - - - - - [ ID] Interval Transfer Bandwidth [ 6] 0.00-10.00 sec 4.15 MBytes 3.48 Mbits/sec sender [ 6] 0.00-10.00 sec 4.07 MBytes 3.41 Mbits/sec receiver iperf Done. $