The iperf command tests the maximum throughput an interface will support. The utility must be installed on both endpoint systems. One system is designated as a “server” and the other as a “client.” It is the iperf client that is getting tested. You can use this command to ensure that throughput is meeting your expectations.
A basic test is as follows:
1. On the server, run:
# iperf -s
2. On the client, run:
# iperf -c {server address}
3. Examine the results that appear.
If you encounter the below error while running the iperf command:
iperf: command not found
you may try installing the below package as per your choice of distribution:
Distribution | Command |
---|---|
OS X | brew install iperf |
Debian | apt-get install iperf |
Ubuntu | apt-get install iperf |
Alpine | apk add iperf |
Arch Linux | pacman -S iperf |
Kali Linux | apt-get install iperf |
Fedora | dnf install iperf |
Raspbian | apt-get install iperf |
You can tune many parameters of iperf, like these:
- –u: For using a UDP socket.
- -t: For using a different time interval in seconds instead of the default of 10 seconds.
- -T: Sets a TTL for multicast (the default is 1).
- -B: Bind to a host, an interface, or a multicast address.
iperf Command Examples
1. Run on server:
# iperf -s
2. Run on server using UDP mode and set server port to listen on 5001:
# iperf -u -s -p 5001
3. Run on client:
# iperf -c server_address
4. Run on client every 2 seconds:
# iperf -c server_address -i 2
5. Run on client with 5 parallel threads:
# iperf -c server_address -P 5
6. Run on client using UDP mode:
# iperf -u -c server_address -p 5001