Bandwidth Testing with Iperf

When troubleshooting network related issues and suspect the network at fault it can be challenging at times to finding supporting evidence. One great tool for on-the-spot testing of network bandwidth is Iperf. It’s a simple, yet powerful tool that can provide visibility on network performance metrics such as bandwidth, latency (delay), jitter, and packet loss. While I prefer using the program via the command prompt be aware there is a GUI version called Jperf too.

Today we’ll be using Iperf to measure network performance in terms of bandwidth, but before we get started its worth noting the unit of measurement for file size and transfer rate are different. Files are typically stated in bytes, while transfer speeds are expressed in bits!

When testing bandwidth performance with Iperf, what we’re actually testing is maximum TCP bandwidth at the transport layer (L4). Lots of applications use TCP as the transport protocol, include HTTP, SMTP, FTP, etc. Unlike UDP (another commonly used L4 protocol) TCP is a reliable, connection-oriented protocol with built-in mechanisms for connection established, acknowledgement, and termination. This connection management is why TCP is used (and not UDP) to test bandwidth. If UDP was being used, any lost packet(s) would go missing from the traffic flow and not be resent. Simply put, TCP has a means to detect and retransmit any lost segments.

The following examples use a combination of Microsoft Windows 7 (64-bit) and XP (32-bit). Also, the default TCP window size is used but keep in mind you can adjust window size and effect bandwidth results. To use the program, open the command prompt and navigate to the directory where Iperf.exe is located (Start>Run and type cmd, then press enter). Once in the command prompt you can change directories via the cd command. As you can see I am using Iperf version 1.7.0.

null

Before we get started I want to quickly discuss Iperf’s architecture. It uses a client/server model, where traffic is initiated from the client and traverses the network (LAN and/or WAN) to the server. So when testing bandwidth in both directions we’ll need to run the test twice, once in each direction. Also, by default the server will listen for the client on TCP port 5001 but like most options this can be changed. Note the ability to change TCP ports in Iperf opens avenues to use it for testing open TCP ports. Thus if a firewall or filtering device is blocking port(s) on a segment of your network you can use Iperf to verify this.

To get started we’ll setup the server side first, entering iperf -s -i 1. The -s command designates this workstation as the “server” and the -i 1 command sets the console output interval to one second.

null

Now to start a test, go onto the client and enter iperf -c -i 1. The -c command designates this workstation as the “client” and the IP address of the server. By default, the test runs for 10 secs but can be changed with the -t option. As you can see below a test was run (from client to server) displaying the transfer rate (MB) and bandwidth (Mb) performance every second.

null

Now if we look back at the server you’ll also see similar output as the client. The test output shows Iperf was able to transfer 110MBytes of data at a rate of 92.3Mbits, from client to server.

null

Now to run the test in the opposite direction simply reverse the commands on the client and server. To stop Iperf on the server or client side enter Ctrl+C.

A key point to remender when testing bandwith with Iperf is that it consumes all bandwidth available between clinet/server via TCP, regardless of LAN, WAN, or VPN connection. Thus if traversing a WAN link you can quickly saturate the link, potentially effecting user/application experience!

Below is another Iperf test in the same environment as above but this time the client is wirelessly connected to the LAN. As you can see below, the wireless media has a big impact on bandwidth performace.

null

One last example is of a test performed over a VPN connection. As you might imagine, the bandwidth performace is considerably slower which is attributable to factors such as encryption and Internet speed.

null

Also, you can use a protocol analyzer such as WireShark on the client/server to verify various aspects of the test, such as L4 protocol, Src/Dst ports, packet size, etc.

null

As you can see, Iperf is a simple to use tool that can quickly provide bandwidth performance metrics over a given link. Instead of guessing or suspecting network performance is the issue, with Iperf you can now know!

Lastly, the examples above use the basic options but keep in mind you can change or add numerous options to your testing. Below is the output of the help command to show you the various things you can change.

null

About Jonathan Skerlick

Hi, my name is Jon Skerlick and I'm a network engineer who works on voice and data networks in multivendor environments. This usually makes life interesting as manufactures often implement the same technology but do it in their own way… meaning configuration requires specific knowledge of a given device. This underscores the importance of understanding the concepts FIRST before heading out on the road. While this may not always be practical this mindset can definitely make for a better experience!
This entry was posted in Bandwidth. Bookmark the permalink.

11 Responses to Bandwidth Testing with Iperf

  1. ??????? says:

    This is a nice post!

  2. Informative article, just what I was looking for.

  3. Lolly says:

    Thanks for the post I really appreciate it it was very useful

  4. very good and cool,thank you for your sharing.

  5. vps says:

    I think your blog is amazing. You write about very interesting things. Thanks for all the tips and information.

  6. akb48 dvd says:

    I was reading some of your posts on this website and I believe this site is rattling instructive! Keep posting.

  7. it is a very good weblog and that i like it greatly!

  8. Mario says:

    good post. Very useful

  9. Adding this to twitter great info.

  10. This is one awesome article post.Really looking forward to read more. Great.

Leave a Reply to longchamp tote Cancel reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>