Using Iperf for Network Bandwidth Measuring/Testing – I

Day to day network troubleshooting involves huge amount of bandwidth testing. And It gets really difficult considering the fact that none of the network device incorporate any tool which can test the end to end bandwidth and print the results. Also while you are training to be a network admin or network engineer no institute or trainer tell you how to perform a reliable bandwidth testing between two ends of the network. This is the reason that most of the network engineers are confused when it comes to knowing how much bandwidth they have between point 1 and point 2 in the network. The confusion is genuine also because you need to keep too many things in mind when calculating the bandwidth between the two points in the network for example capacity of each link, throughput of each device, average utilization on those devices, supported MTU/MSS etc . This list grows even bigger when you try to check the bandwidth at the time of issue because one degrading link can change the overall resultant bandwidth in big time.

My personal favorite to test the available bandwidth between two points in the  network is no doubt Iperf and its Java UI version Jperf . In this blog post I am going to demonstrate a simple bandwidth testing with Jperf. Following is the network which I have configured.

Ipef Jperf Cisco bandwidth testing
Topology

We are performing a test to understand how much bandwidth we have available between the two devices when we are using HTTP to communicate. Also we need to take QOS configuration on the router in account before testing this. Lets see what do we have  on router.

C2921#sh run int gi 0/0 -----------> Connects to HTTP Server
!
interface GigabitEthernet0/0
 bandwidth 2048
 ip address 192.168.10.1 255.255.255.0
 service-policy output Parent ------> Policy Map Applied

C2921#sh run policy-map Parent
Building configuration...

Current configuration : 96 bytes
!
policy-map Parent
 class class-default
 shape average 2000000 ----------> Shaping at 2 Mbps
 service-policy TEST
!
end

C2921#sh run po
C2921#sh run policy-map TEST
Building configuration...

Current configuration : 78 bytes
!
policy-map TEST
 class child1 ---------> Classifies HTTP traffic 
 bandwidth percent 70 ----------> 70% of 2 Mbps(1.4Mbps)
!
end


C2921-2#sh policy-map interface gigabitEthernet 0/0
 GigabitEthernet0/0

Service-policy output: Parent

Class-map: class-default (match-any)
 11880 packets, 10835030 bytes
 5 minute offered rate 68000 bps, drop rate 0000 bps
 Match: any
 Queueing
 queue limit 64 packets
 (queue depth/total drops/no-buffer drops) 0/0/0
 (pkts output/bytes output) 11669/10568830
 shape (average) cir 2000000, bc 8000, be 8000
 target shape rate 2000000

Service-policy : TEST

Class-map: child1 (match-all)
 7114 packets, 10075388 bytes
 5 minute offered rate 68000 bps, drop rate 0000 bps
 Match: access-group name TEST
 Queueing
 queue limit 64 packets
 (queue depth/total drops/no-buffer drops) 0/0/0
 (pkts output/bytes output) 7114/10075388
 bandwidth 70% (1400 kbps)  ------> This is what we should get 

 

Now looking at the qos configuration on the device we see that the we have CIR of 2Mbps on which we are shaping our overall communication. On top of that we have provided 70% of 2Mbps to our HTTP traffic in child class. However when we use bandwidth command then in case there is no utilization in other classes the traffic can go on utilizing the other class’s available bandwidth hence if we consider ideal case here .i.e no traffic in any other class we should see 2Mbps available bandwidth between the HTTP Client and HTTP Server. Now lets see if we are actually having this much amount of bandwidth. We will use Jperf to test this…

First we configure HTTP server on the widows 7 PC (192.168.10.2). Following is how Jperf looks:

Jperf Iperf HTTP Server
HTTP Server on 192.168.10.2

 

Just looking at it you can figure out what settings you need to configure. I have configured the HTTP port number 80 and the output format. Rest of the things are auto configured and I do not want to change it. Now lets see what do we need to configure on client side.

 

Jperf Iperf HTTP Client
HTTP Client on 192.168.20.2

After the configurations are done we can start the server. Once the server is started Iperf application enables the host 192.168.10.2(HTTP Server) to start listening on port 80. Now we can enable client to connect to port 80. In the output section of the tool you would see the Jperf sending bunch of bytes sent  every second and will tell us the exact bandwidth that was calculated while sending that amount of traffic. Jperf tracks this by tracking the ACK of the TCP data sent.

We have seen following output on our client :

Iperf Result
Jperf result

 

See that last line in the output in the above picture summarizes 10 streams and tell us that we have sent 2.3MB of data and have received around 1.92 Mbps of the  resultant bandwidth from the underlying network.

Isn’t it neat!!

The beauty is that the setup is very easy to build. You just need to download Iperf/Jperf from internet and install it on two systems in case you want to have client and server setup. Else in server field you can also mention some internet sever like facebook.com’s IP address for instance and run the test.

I will try to cover more about the working of Iperf in my upcoming blogs. For your reference below is the packet capture  on client device when it started the session with the server :

Iperf Packet capture
Iperf Packet Capture

 

Thanks for visiting my blog. Please let me know your thoughts in comment section.

Stay tuned for more.

 

One thought on “Using Iperf for Network Bandwidth Measuring/Testing – I

Leave a Reply