Testing network performance: iperf3

Tools like ping and traceroute are good to see if a connection is up, and tcpdump can help diagnose packet issues, but how can you test the raw speed of a network?

Well, you could just dump /dev/zero over netcat and monitor the speed.

[root@localhost ~]# cat /dev/zero | pv -r | nc 192.168.0.120 5201
[ 223MiB/s]

But this is fairly limited in what it can test and doesn’t provide a lot of options. That’s where iperf comes to the rescue! Just install from epel on both sides and then start up one side as a server.

# # iperf3 -s 
-----------------------------------------------------------
Server listening on 5201
-----------------------------------------------------------

Then go fire up a client with a couple threads and test the speed. (these numbers are between two Virtual Box VMs).

# iperf3 -c 192.168.0.120 -t 60 -P 2 -i0
Connecting to host 192.168.0.120, port 5201
[ 4] local 192.168.0.150 port 51074 connected to 192.168.0.120 port 5201
[ 6] local 192.168.0.150 port 51076 connected to 192.168.0.120 port 5201
[ ID] Interval Transfer Bandwidth Retr Cwnd
[ 4] 0.00-60.00 sec 6.60 GBytes 945 Mbits/sec 26338 188 KBytes 
[ 6] 0.00-60.00 sec 3.53 GBytes 506 Mbits/sec 34629 1.41 KBytes 
[SUM] 0.00-60.00 sec 10.1 GBytes 1.45 Gbits/sec 60967 
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval Transfer Bandwidth Retr
[ 4] 0.00-60.00 sec 6.60 GBytes 945 Mbits/sec 26338 sender
[ 4] 0.00-60.00 sec 6.60 GBytes 945 Mbits/sec receiver
[ 6] 0.00-60.00 sec 3.53 GBytes 506 Mbits/sec 34629 sender
[ 6] 0.00-60.00 sec 3.53 GBytes 506 Mbits/sec receiver
[SUM] 0.00-60.00 sec 10.1 GBytes 1.45 Gbits/sec 60967 sender
[SUM] 0.00-60.00 sec 10.1 GBytes 1.45 Gbits/sec receiver

iperf Done.

So what are all them thar options for?

-c run as a client
-t 60 run the test for 60 seconds
-P 2 run two parallel threads. Generally this should equal your CPU count or less
-i 0 don’t show per second data, I just want a summary

Bonus feature! iperf can be installed on all major OS platforms allowing testing between OSs. No more “its just slow because Linux” from them silly Windows guys!

There is also a good article on CertDepot on using iperf.

Advertisements