iperf Network Performance Measuring

Iperf is a great little command line utility used to measure tcp and udp performance from one node to another. It can be a great help in finding bottlenecks in network performance, troubleshooting wifi issues and more. It’s very simple to use, and is available in the EPEL repo for CentOS.

Install iperf

First we must have the EPEL repo available in yum, if it’s not already on your system, install this RPM.

rpm -ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

Now we can install the package.

yum -y install iperf

We have two nodes, on one we run iperf as a server, and on the other we’ll run iperf as a client with some arguments to connect to the server and run the tests.

Start iperf on server

iperf -s

You should see output that looks like this.

# iperf -s
Server listening on TCP port 5001
TCP window size: 85.3 KByte (default)

Notice it’s running on port 5001, if you want to run it on an alternate port you would specify it with the -p flag.

iperf -s -p 6666

Run iperf test from client

Basic test with defaults.

iperf -c ip.of.ser.ver

If alternate port was specified for the server, you must also do that on the client side.

iperf -c ip.of.ser.ver -p 6666

By default, iperf runs a test from the client to the server, if you wish to measure the bandwidth in both directions we will add the “-d” flag. Here is an example measuring bi-directional bandwidth against a server running on port 6666.

iperf -c ip.of.ser.ver -p 6666 -d

This test will perform multiple iterations of the test for a better picture of sustained bandwidth, and present the output in MBytes/sec instead of Mbits/sec.

iperf -c ip.of.ser.ver -fM -m -i5 -t25

Iperf is a great little command line utility, but for a nice GUI you can also checkout jperf.