You are on page 1of 8

Iperf Commands for Network Troubleshooting

! May 30, 2011 (https://www.samkear.com/networking/iperf-commands-network-troubleshooting)


" Sam Kear (https://www.samkear.com/author/sam) # Networking
(https://www.samkear.com/category/networking)

(https://www.samkear.com/wpcontent/uploads/2011/05/iPerf-NetworkUtilization.jpg)Iperf is a very useful utility


for network troubleshooting. In this post
Ill share my list of Iperf commands that I
have found useful.
What is Iperf?
Iperf is a network performance utility that
can generate both TCP and UDP trac
for testing bandwidth, latency, and packet
loss. Iperf is very powerful and can easily
generate enough trac to saturate a
1Gb, or 10Gb connection. Iperf is included with
most Linux distributions but you can compile
Iperf for windows
(https://www.samkear.com/how-to-guides/howto-compile-iperf-for-windows-using-cygwin) if
needed.
In order to use Iperf youll need to setup an Iperf
server, Iperf clients can then connect to the
server in order to run tests. By default Iperf is
uni-directional and sends data from the client to
the server.
In my examples Im using 192.168.1.1 as the
address of my Iperf server.
Running iperf -s will setup a basic Iperf server, you can also run Iperf in daemon mode by
running iperf -D.

Basic TCP Unicast Test


The simplest test you can do with Iperf is a basic TCP test. By default the server will use a TCP
window size of 85.3KB. The client will connect to the server on port 5001 using a TCP window
size of 16KB. The -t option instructs the client to run the test for 30 seconds instead of the
default of 10 seconds.
[Server] iperf -s -i 1
[Client] iperf -c 192.168.1.1 -t 30
Parallel TCP connections
Parallel connections can be useful if you need to saturate the bandwidth of a link. The
bandwidth of a single TCP session can be greatly aected by the size of the receive window
and the latency of the link.
To enable parallel connections add the -P ag to the Iperf client parameters followed by the
number of connections you want. Make sure to use a capital P, lowercase p will specify a
dierent port number to connect on.
[Server] iperf -s -i 1
[Client] iperf -c 192.168.1.1 -t 30 -P 10

(https://www.samkear.com/wp-

content/uploads/2011/05/iperf-client-test1.jpg)
UDP Mode
Testing with UDP packets requires the -u ag on both the client and server. The cool thing
about UDP mode is that you dont have to use a server. Instead you can use the interface
counters on your switches. You can also specify the destination address to be a multicast
group, the default TTL for multicast is 1 (be careful). To set a dierent TTL use the -T option on
the client.
If you want to test for jitter and packet loss then you should use UDP mode.
[Server] iperf -s -i 1
[Client] iperf -c 192.168.1.1 -t 30 -u
In UDP mode iperf defaults to 1Mb/s, you can tell it to use more bandwidth by using the -b ag
followed by the number of bits/sec to send. For example, iperf -c 192.168.1.1 -u -b 100000000
would send at a rate of 100Mb/s.

Bidirectional testing
If you want to test throughput both to
and from the server at the same time you
can use the -d option to run a
bidirectional test. This will send data to
the server, and receive data from the
server simultaneously.
[Server] iperf -s -i 1
[Client] iperf -c 192.168.1.1 -t 30 -d
Bandwidth limiting
If you need to test for packet loss or
other problems at a specic rate of bandwidth you can use the -b ag to specify the maximum
throughput in bits/second.
[Server] iperf -s -i 1
[Client] iperf -c 192.168.1.1 -t 30 -b 100000
Transfer 1GB of data then stop
Instead of running the test for a specic period of you can instruct Iperf to stop running after
trasfering a certain amound of data. The example below will send 1GB (1024) of data to the
server and then stop
[Server] iperf -s -i 1
[Client] iperf -c 192.168.1.1 -n 1073741824
Stop the iPerf server
To kill the iperf server just press CTRL+C in your terminal and it will interrupt the process.
If you are running iPerf in daemon mode youll need to nd the process ID rst
ps -ef | grep iperf
root

16186

1 0 22:00 ?

00:00:00 iperf -s -D

Then kill it
kill 16186
Useful References
Energy Sciences Network Host Tuning Guide (http://fasterdata.es.net/fasterdata/host-tuning/)
Using Iperf Guide by Jon Dugan
(http://www.nanog.org/meetings/nanog43/presentations/Dugan_Iperf_N43.pdf)

Share this:

Facebook (https://www.samkear.com/networking/iperf-commands-network-troubleshooting?
share=facebook&nb=1&nb=1)

Twitter (https://www.samkear.com/networking/iperf-commands-network-troubleshooting?
share=twitter&nb=1&nb=1)

Reddit (https://www.samkear.com/networking/iperf-commands-network-troubleshooting?
share=reddit&nb=1&nb=1)

SAM KEAR (HTTPS://WWW.SAMKEAR.COM/AUTHOR/SAM)


Sam graduated from the University of Missouri - Kansas City with a bachelors
degree in Information Technology. Currently he works as a network analyst for an
algorithmic trading rm. Sam enjoys the challenge of troubleshooting complex
problems and is constantly experimenting with new technologies.

6 thoughts on Iperf Commands for Network


Troubleshooting
YAP CHIN HOONG - (HTTP://WWW.YAPCHINHOONG.COM/)
July 4, 2011 at 11:04 am (https://www.samkear.com/networking/iperf-commands-networktroubleshooting#comment-375)

Thanks for the eort of the 2 iperf blogs. I will spend some time reading and
testing them out.
REPLY (HTTPS://WWW.SAMKEAR.COM/NETWORKING/IPERF-COMMANDS-NETWORK-TROUBLESHOOTING?REPLYTOCOM=375#RESPOND)

SAM (HTTP://WWW.SAMKEAR.COM)
July 4, 2011 at 10:38 pm (https://www.samkear.com/networking/iperf-commands-networktroubleshooting#comment-377)

Thanks for your comment! I hope that you nd iperf to be as useful of a tool as I
have.
REPLY (HTTPS://WWW.SAMKEAR.COM/NETWORKING/IPERF-COMMANDS-NETWORK-TROUBLESHOOTING?REPLYTOCOM=377#RESPOND)

RA J
June 22, 2015 at 10:22 pm (https://www.samkear.com/networking/iperf-commands-networktroubleshooting#comment-40633)

hi my name raj i having a problem with iperf.actualy i using 10gb copper cable
to testing that bandwidth but i cannot getif i type 100m i get 100mb
bandwidth but when i type 10000 i get 562mb bandwidth it wont go more than
that so can u help me..i trying this two days but still like that.tq
(HTTPS://WWW.SAMKEAR.COM/NETWORKING/IPERF-COMMANDS-NETWORK-TROUBLESHOOTING?REPLYTOCOM=40633#RESPOND)

DEEPAK
April 2, 2014 at 10:16 am (https://www.samkear.com/networking/iperf-commands-networktroubleshooting#comment-19066)

I have ran parallel TCP streams to saturate my switch. How can I nd if the switch is
saturated or not?
REPLY (HTTPS://WWW.SAMKEAR.COM/NETWORKING/IPERF-COMMANDS-NETWORK-TROUBLESHOOTING?REPLYTOCOM=19066#RESPOND)

SAM KEAR (HTTP://WWW.SAMKEAR.COM/ABOUT)


April 3, 2014 at 9:04 am (https://www.samkear.com/networking/iperf-commands-networktroubleshooting#comment-19093)

If you have a managed switch you can check the interface counters to view the
port utilization and also check for queue drops.
For example on Cisco switches you can run show interface X, replacing x with the
port in question (Gi1/1, etc). You can also run show interface counters errors to
get a summary of errors and output discards across the switch. Turning on
Netow (if supported) can provide some great real time data on switch utilization.
If youre not running Cisco equipment but you still have a managed switch then
check the documentation for your specic model to see what commands are
available.
REPLY (HTTPS://WWW.SAMKEAR.COM/NETWORKING/IPERF-COMMANDS-NETWORK-TROUBLESHOOTING?REPLYTOCOM=19093#RESPOND)

NETHRA
October 15, 2015 at 5:17 am (https://www.samkear.com/networking/iperf-commands-networktroubleshooting#comment-40707)

i am getting Connect failed : Connection timeout message as error in client


side. i am giving simple server side cmd as iperf -s and client cmd as iperf -c
.
i am using 2 PCs for this connection
can anybody help me how i can make it to connect plz?
(HTTPS://WWW.SAMKEAR.COM/NETWORKING/IPERF-COMMANDS-NETWORK-TROUBLESHOOTING?REPLYTOCOM=40707#RESPOND)

LEAVE A REPLY
Your email address will not be published. Required elds are marked *
Name *

Email *

Website

Comment

POST COMMENT

Notify me of follow-up comments by email.


Notify me of new posts by email.

$ Installing FreeNAS on VirtualBox (https://www.samkear.com/freenas/installing-freenas-virtualbox)

How to Make the Google Plus Button One Show Up % (https://www.samkear.com/wordpress/google-button-show)

Search

FOLLOW SAM ON TWITTER


Tweets
Sam Kear
@SamKear

Follow
3 Nov

#Bitcoin to be major reserve currency by 2030: Research cnb.cx/1MuUJoY


Show Summary
Sam Kear
@SamKear

23 Oct

Drug with rage-inducing >5,000% price-hike now has $1/pill competitor


arstechnica.com/science/2015/1
Show Summary
Sam Kear
@SamKear

20 Oct

Federal agent gets six years in prison for extorting #bitcoin from Silk Road creator
theverge.com/2015/10/20/957 via @verge
Show Summary

Tweet to @SamKear

RECENT POSTS
Fixing Palo Alto Firewall Support in RANCID Version 3.2
(https://www.samkear.com/software/linux/xing-palo-alto-rewall-support-in-rancid-version3-2)
Building a Raspberry Pi ADS-B Ground Station (https://www.samkear.com/raspberrypi/building-a-raspberry-pi-ads-b-ground-station)
Time Warners New Enhanced DVR the Arris DCX3600-M
(https://www.samkear.com/hardware/time-warners-new-enhanced-dvr-the-arris-dcx3600-m)
How to Enable SPDY on Nginx Using Ubuntu 14.04
(https://www.samkear.com/software/linux/how-to-enable-spdy-on-nginx-using-ubuntu-1404)

How to Control Power Outlets Wirelessly Using the Raspberry Pi


(https://www.samkear.com/hardware/control-power-outlets-wirelessly-raspberry-pi)

LIKE US ON FACEBOOK

RECENT COMMENTS
Will on How to Control Power Outlets Wirelessly Using the Raspberry Pi
(https://www.samkear.com/hardware/control-power-outlets-wirelessly-raspberry-pi#comment-40722)
Brad on How to Control Power Outlets Wirelessly Using the Raspberry Pi
(https://www.samkear.com/hardware/control-power-outlets-wirelessly-raspberry-pi#comment-40721)
Dan McGee (https://www.tooshes.net/) on How to Control Power Outlets Wirelessly Using the
Raspberry Pi (https://www.samkear.com/hardware/control-power-outlets-wirelessly-raspberrypi#comment-40720)
Brad on How to Control Power Outlets Wirelessly Using the Raspberry Pi
(https://www.samkear.com/hardware/control-power-outlets-wirelessly-raspberry-pi#comment-40719)
Dan McGee (https://www.tooshes.net/) on How to Control Power Outlets Wirelessly Using the
Raspberry Pi (https://www.samkear.com/hardware/control-power-outlets-wirelessly-raspberrypi#comment-40718)
CATEGORIES
Hardware (https://www.samkear.com/category/hardware)
FreeNAS (https://www.samkear.com/category/freenas)
Networking (https://www.samkear.com/category/networking)

Sam Kear Dot Com (http://samkear.com/) All rights reserved. Theme by Colorlib (http://colorlib.com/) Powered by
WordPress (http://wordpress.org/)

You might also like