Measure Network Performance: Find Bandwidth, Jitter, Datagram Loss With Iperf

Typically, your user sends network throughput problems reports as they see problem with their applications such as:

[a] FTP Transfer [b] NFS Performance [c] HTTP / SMTP / POP3 etc

As a sys admin you should able confirm the throughput problem. iperf is the tool you are looking to find out:

a) Network throughput problem

b) Packet loss problem

c) Datagram loss

d) Delay jitter

From the man page:

iperf is a tool to measure maximum TCP bandwidth, allowing the tuning of various parameters and UDP characteristics.

iperf works on client / server model. You need to install iperf on both client computer and server computer to measure network performance between two nodes.

So by comparing the reported applications throughput with the measured TCP throughput and the measured available bandwidth, it is possible:
a) To Find out applications problems
b) TCP stack problems
c) Network issues
d) Bandwidth bottleneck problems etc

There is also ttcp program, which is a benchmarking tool for determining TCP and UDP performance between 2 systems.

Taks: Install iperf

If you are using Debian / Ubuntu Linux, enter:
$ sudo apt-get install iperf
If you are using FreeBSD, enter:
# cd /usr/ports/benchmarks/iperf
# make install clean

Source code installation for RHEL / CentOS:
# gunzip -c iperf-.tar.gz | tar -xvf -
# cd iperf-
# make; make install

You can also use the yum command as follows with EPEL repo:
# yum install iperf

Start iperf on server

To start iperf on server, type the following command:
root@freebsd42 # /usr/local/bin/iperf -s
Output:

------------------------------------------------------------
Server listening on TCP port 5001
TCP window size: 64.0 KByte (default)
------------------------------------------------------------

Test iperf from client

Try to connect to your FreeBSD server called freebsd42 using Linux client located in other data center, enter:
$ iperf -c freebsd42
Output (note my freebsd42 server is on slow internet link):

------------------------------------------------------------
Client connecting to freebsdbox, TCP port 5001
TCP window size: 16.0 KByte (default)
------------------------------------------------------------
[  3] local 192.168.1.106 port 40256 connected with 71.zzz.xxx.yyy port 5001
[  3]  0.0-10.7 sec    624 KBytes    480 Kbits/sec

The last line (the red numbers) specifies the speed.

Use UDP rather than TCP

The -u option force to use UDP. The following example run udp test and bandwidth to send at in bits/sec is specified using the -b option:
$ iperf -c rhelbox -u -l 512 -b 10m

Further readings:

  • iperf project home page
  • iperf man page

Other Recommended Bandwidth Measurement Tools

Apart from iperf, you can also use following tools to evaluate the bandwidth between two points in the network:

  1. Bandwidth Test Controller (BWCTL)
  2. ndt (Network Diagnostic Tool)
  3. Netperf (network performance benchmark)
  4. Thrulay (Improved version)
🐧 If you liked this page, please support my work on Patreon or with a donation.
🐧 Get the latest tutorials on SysAdmin, Linux/Unix, Open Source & DevOps topics via:
CategoryList of Unix and Linux commands
File Managementcat
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network Utilitiesdig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
4 comments… add one
  • padma Aug 22, 2012 @ 9:06

    How to compare our test results? I mean what is the standard values for bandwidth,data gram loss, etc….How do i know my test is giving efficient results?

  • Mish Dis Sep 27, 2011 @ 7:52

    Thanks a lot

  • joetke Aug 22, 2010 @ 13:14

    Very concise and useful intro. Thanks a lot.

  • vikas Oct 20, 2009 @ 13:08

    Thanks for such good info sharing

Leave a Reply

Your email address will not be published. Required fields are marked *

Use HTML <pre>...</pre>, <code>...</code> and <kbd>...</kbd> for code samples.