You were never here, you didn't see anything..

Bandwidth Testing


In an effort to get some details on bandwidth through a device iperf is the perfect tool. It is also very easy to set use.

In the following examples I am using my desktop machine on the local LAN of my firewall and a server in the DMZ, also off the firewall. The topology looks about like this:

Simple Network
Simple Network

iperf has two modes of operation, client and server. The roles are pretty self explanatory. First start the server on a machine:

iperf3 -s

Next start iperf on another machine to act as the client, which will connect to the server and start the test. For this test I started the client on my desktop system specifying the servers IP:

iperf3 -c 10.2.4.200

With no special options the output should look like this on the server side:

-----------------------------------------------------------
Server listening on 5201
-----------------------------------------------------------
Accepted connection from 10.2.2.210, port 51552
[  5] local 10.2.4.200 port 5201 connected to 10.2.2.210 port 51553
[ ID] Interval           Transfer     Bandwidth
[  5]   0.00-1.00   sec   107 MBytes   899 Mbits/sec                  
[  5]   1.00-2.00   sec   112 MBytes   938 Mbits/sec                  
[  5]   2.00-3.00   sec   112 MBytes   938 Mbits/sec                  
[  5]   3.00-4.00   sec   112 MBytes   938 Mbits/sec                  
[  5]   4.00-5.00   sec   112 MBytes   938 Mbits/sec                  
[  5]   5.00-6.00   sec   112 MBytes   938 Mbits/sec                  
[  5]   6.00-7.00   sec   112 MBytes   938 Mbits/sec                  
[  5]   7.00-8.00   sec   112 MBytes   938 Mbits/sec                  
[  5]   8.00-9.00   sec   112 MBytes   938 Mbits/sec                  
[  5]   9.00-10.00  sec   112 MBytes   938 Mbits/sec                  
[  5]  10.00-10.04  sec  4.80 MBytes   936 Mbits/sec                  
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bandwidth       Retr
[  5]   0.00-10.04  sec  1.09 GBytes   937 Mbits/sec   24             sender
[  5]   0.00-10.04  sec  1.09 GBytes   934 Mbits/sec                  receiver
-----------------------------------------------------------
Server listening on 5201
-----------------------------------------------------------

And this is from the client side:

Connecting to host 10.2.4.200, port 5201
[  4] local 10.2.2.210 port 51553 connected to 10.2.4.200 port 5201
[ ID] Interval           Transfer     Bandwidth       Retr  Cwnd
[  4]   0.00-1.00   sec   115 MBytes   964 Mbits/sec    0    691 KBytes       
[  4]   1.00-2.00   sec   111 MBytes   933 Mbits/sec    1    727 KBytes       
[  4]   2.00-3.00   sec   112 MBytes   944 Mbits/sec    1    604 KBytes       
[  4]   3.00-4.00   sec   111 MBytes   933 Mbits/sec    0    734 KBytes       
[  4]   4.00-5.00   sec   111 MBytes   933 Mbits/sec    7    621 KBytes       
[  4]   5.00-6.00   sec   112 MBytes   944 Mbits/sec    0    745 KBytes       
[  4]   6.00-7.00   sec   111 MBytes   933 Mbits/sec   11    634 KBytes       
[  4]   7.00-8.00   sec   112 MBytes   944 Mbits/sec    0    757 KBytes       
[  4]   8.00-9.00   sec   111 MBytes   933 Mbits/sec    4    645 KBytes       
[  4]   9.00-10.00  sec   112 MBytes   944 Mbits/sec    0    768 KBytes       
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bandwidth       Retr
[  4]   0.00-10.00  sec  1.09 GBytes   941 Mbits/sec   24             sender
[  4]   0.00-10.00  sec  1.09 GBytes   938 Mbits/sec                  receiver

iperf Done.

The client will exit once it is complete while the server will continue to run until it is killed. The server also has a daemon mode should you want to run a lot of tests.

To get a better idea of throughput I prefer a longer run. In most of my tests I will use a 60 second test which is done by specifying “-t 60” on the client side.

To make things look fancy the results can be graphed. To accomplish this task I dump the output of iperf into a file while filtering it to remove excess. Then take the resulting file and plot the data points using gnuplot. I am currently working on the plot script, but at present it produces three graphs, one each for Bandwidth, ReTries (TCP retries), and Transfer (amount of data transfered). The three key points of a TCP test.

Server:

iperf3 -s

Client:

iperf3 -t 60 -c 10.2.4.200 | grep KBytes | awk '{ print $3"\t"$5"\t"$7"\t"$9 }' > results.dat

And the out of the gnuplot script (forgive the blur, as it is from the resizing of the images on the fly. Click the image for a full size, clear look):

Bandwidth Graph
Bandwidth Graph

 

Packet Retr
Packet Retr

 

Data Transfer
Data Transfer

iperf can also test UDP as well as multicast. Both items for another post.

My current working gnuplot script can be found here. To generate graphs fromt the data generated using the client command above one would simply:

gnuplot < graph-tcp-data.p

Have any Question or Comment?

Leave a Reply

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

*

This blog is kept spam free by WP-SpamFree.

Most who fail…

Most who fail have yet to really try!