iPerf is a command line tool that allows you to test the throughput of a network using TCP or UDP protocols. This is helpful for knowing where bottlenecks exist in your network or if specific hardware is performing as intended. I personally used this tool to test my crimping of CAT5/6 cables as I was running them through my dwelling.
When using this tool, it is important to know that there are two versions and that these versions are not compatible with each other. So when you decide to install the tool on your machines, be sure you pick the same one. iPerf and iPerf3 are available in your Linux OS repos but also as pre-compiled binaries for Windows, Mac, Android, etc.
The iPerf tool runs as a client or server on your machine, so to test the speed of your network, you'll need two machines total and have one run the tool as the server and the other as a client.
On the machine you are running as the server, you'll want to put in the following command:
iperf3 -s -p 5001
There are two options used in the command
-s which tells the tool that it should run the server and
-p which designates what port the server should listen to for traffic. If you don't designate a port, iPerf will pick one. You'll need to open up ports on your firewall for both machines so that they can reach out to each other. A common way to do this on systems that use
ufw is to use the command:
sudo ufw allow 5001
This will open up port 5001 for IPv4 and IPv6 traffic. When you are done with your testing, you can close up the firewall ports again using
sudo ufw deny 5001 on both of your machines.
On the machine acting as the client you'll want to put in the following command:
iPerf3 -c 10.10.0.140 -p 5001 -bidir
There are three options being performed in this command. The
-c tells the tool that the machine is acting as the client. The
-p is the port designation as discussed above and the
-bidir tells the tool that we want to test the connection in both directions. This is helpful because it shows the amount of traffic to and from the server.
Results from the server on a wired connection and laptop on wireless 5G
[ 4] local 10.10.0.141 port 60252 connected to 10.10.0.140 port 5001 [ ID] Interval Transfer Bandwidth [ 4] 0.00-1.00 sec 5.62 MBytes 47.0 Mbits/sec [ 4] 1.00-2.01 sec 5.50 MBytes 45.8 Mbits/sec [ 4] 2.01-3.01 sec 5.62 MBytes 47.3 Mbits/sec [ 4] 3.01-4.00 sec 5.38 MBytes 45.4 Mbits/sec [ 4] 4.00-5.01 sec 1.00 MBytes 8.32 Mbits/sec [ 4] 5.01-6.01 sec 4.00 MBytes 33.4 Mbits/sec [ 4] 6.01-7.00 sec 3.50 MBytes 29.7 Mbits/sec [ 4] 7.00-8.01 sec 3.00 MBytes 25.0 Mbits/sec [ 4] 8.01-9.01 sec 4.75 MBytes 39.6 Mbits/sec [ 4] 9.01-10.02 sec 4.25 MBytes 35.6 Mbits/sec - - - - - - - - - - - - - - - - - - - - - - - - - [ ID] Interval Transfer Bandwidth [ 4] 0.00-10.02 sec 42.6 MBytes 35.7 Mbits/sec sender [ 4] 0.00-10.02 sec 42.6 MBytes 35.7 Mbits/sec receiver
Results from two wired connections running through a TPLink 1 GB 4-Port Switch about 30 feet away.
[ 4] local 10.10.0.166 port 58827 connected to 10.10.0.140 port 5001 [ ID] Interval Transfer Bandwidth [ 4] 0.00-1.00 sec 90.9 MBytes 761 Mbits/sec [ 4] 1.00-2.00 sec 88.8 MBytes 745 Mbits/sec [ 4] 2.00-3.00 sec 92.4 MBytes 775 Mbits/sec [ 4] 3.00-4.00 sec 91.5 MBytes 767 Mbits/sec [ 4] 4.00-5.00 sec 92.5 MBytes 777 Mbits/sec [ 4] 5.00-6.00 sec 92.1 MBytes 772 Mbits/sec [ 4] 6.00-7.00 sec 92.5 MBytes 776 Mbits/sec [ 4] 7.00-8.00 sec 91.2 MBytes 765 Mbits/sec [ 4] 8.00-9.00 sec 92.6 MBytes 777 Mbits/sec [ 4] 9.00-10.00 sec 92.9 MBytes 779 Mbits/sec - - - - - - - - - - - - - - - - - - - - - - - - - [ ID] Interval Transfer Bandwidth [ 4] 0.00-10.00 sec 917 MBytes 770 Mbits/sec sender [ 4] 0.00-10.00 sec 917 MBytes 770 Mbits/sec receiver
As you can see from the output above, I get much better speeds on the wired than wireless connection which is expected. Also, you'll notice that the last two lines in each output show the bandwidth from both machines. If these didn't match, then it can be helpful in trouble shooting issues.