Iperf is a very versatile open source program that can be used for network performance testing. It can generate TCP or UDP data streams for measuring network throughput and can also be used for testing network latency and jitter. There are some older versions of iperf compiled for Windows available on the web but I couldn’t find a working link for iperf version 2.0.5 so I decided to try compiling it using Cygwin and it worked!
You can download iperf version 2.0.5 for Windows that I compiled from source or continue reading if you want to learn how to compile your own copy. You’ll need to copy iperf.exe and also the 3 cygwin DLL files included in the zip archive into your system in order for it to work.
1. Setting up Cygwin
Cygwin is basically a Linux emulation environment for Windows. Although your Linux apps will have to be recompiled from source before they will run in the Cygwin environment. To get started you will need to download and run setup.exe from the Cygwin site. You can use the default install options but when you reach the package selection screen click on ‘Devel’ so that ‘Default’ changes to ‘Install’ , this will install all of the development tools you will need.
You should have a shortcut to Cygwin on your desktop when the installation is finished.
2. Download the iperf source code
Next download and extract the iperf source code to C:\cygwin\iperf-2.0.5 , 7-zip works well for extracting tar and gzip files in Windows.
3. Configure the compiler
Start the Cygwin shell from the start menu or the shortcut on your desktop.
Enter the directory where you extracted the iperf source
cd /iperf-2.0.5
Configure the compiler (this might take a couple minutes)
./configure
If everything went well your output should look something like this.
4. Compile the source
To get the compile process started just type make and hit enter. It shouldn’t take very long for the compile to finish.
5. Make install
Assuming your build completed without errors your going to want to run ‘make install’, to do this just type make install in the shell and hit enter. As you can see from the output below iperf.exe was copied to /usr/local/bin/
6. Running iperf
You can run iperf directly from the Cygwin environment but you will have to specify the full path to the executable eg: /usr/local/bin/iperf. If you prefer to run iperf directly from a Windows command prompt or from another machine you can copy the iperf binary and the nessasary DLL files out of the cygwin environment.
If you installed Cygwin to the default location then iperf.exe will be located in C:\cygwin\usr\local\bin
You will also need the following DLL files found in C:\cygwin\bin.
- cygwin1.dll
- cyggcc_s-1.dll
- cygstdc++-6.dll
Copy the three DLL files and iperf.exe somewhere on your system that is in your path like c:\windows\system32 for example. You can then run iperf directly from a command prompt.
Enjoy!
I’m working on a separate post with some sample uses for iperf which should be completed in the near future.
I haven’t tried it yet, but thanks for this tutorial!
No problem! I hope you find iperf on windows to be useful.
Thanks for the work. I’ve been trying to find an updated version for Windows for awhile. I have a question though. The documentation page references a option -S, which allows you to set the type-of-service on the outgoing packets. It does not appear that this version supports that flag. Could you confirm please? Thanks again!
I don’t believe any of the newer releases of iperf allow you to set the type of service field.
You might consider looking into a program called mgen which is supported on Windows and Linux. It’s an open source utility which allows you to generate traffic with the TOS bits set.
http://cs.itd.nrl.navy.mil/work/mgen/index.php
I also noticed it will not install as a service. Example: iperf -s -D
Iperf 3 has this issue on Windows as well. It’s somewhat annoying to deal with but I haven’t been able to produce a solution to the problem.
Thank you for putting this up. Working from Sourceforge and other places that Google searches show, it seems unnecessarily obtuse for a plain old Windows user to run an iperf test. Do I really need to figure out how to compile an executable??? Sheesh. With your files I got it going in a matter of minutes. Simple. THANK YOU.
thanks a lot, if it is not your article, I would not be able to cope with this
Hi sam,
i use iperf-3.0b4 in window 7 and i also use cygwin tool
i follow all procedure as you write above but i couldn’t compile
i have successfully run configure file after that make hit enter than show command not found
so i have problem for compile please help me bro……..
Thanks
Hey Mukesh,
I didn’t have any luck trying to compile iperf-3.0b4 in cygwin either.
It turns out someone has already accomplished it though, you can download the precompiled version from the link below. It runs fine on my Win7 X64 box.
http://code.google.com/p/iperf3-cygwin/
Just make sure you extract iperf3.exe along with all of the cygwin dll files to the same directory.
Let me know if that works for you.
ok bro it’s great bolog thanks for help me…
hey sam ,
Thanks for reply
i was wrong because i didn’t add make pkg in my cygwin so i trouble, after read your blog very carefully i have add make pkg than it’s work well i have got iperf3.exe.
Hey sam,
i want to run this exe on other system without .dll files
can i do if yes than how
Thanks
In order to run without the cygwin dll files you need a version of iperf compiled for native win32. Below is a link to version 2.0.4 which has been patched and compiled to run without any cygwin dll files.
http://www.ivaturi.org/home/iperfv204pre-compiledbinaryforwin32
Hey sam,
Thanks for reply
But i have already iperf2 i want iperf3 for windows without .dll files
if you have any idea than share with me
Thanks
Hi Sam…
Do have any procedure to uninstalled this iperf via unix cmd?
Appreciate your help, bro
Thanks
Tnx for the artice.
I’d like to share some expirience with some modern builds, mb it will help someone.
I’v faced with some problems building iperf modern versions with current head commit.
Ok, I decided to build some stable version so choosed 03eb163 commit this is 3.0.2 stable.
git checkout 03eb163t
First i made some function name replacement with:
cd ./src
find ./ -iname "*.[ch]" |xargs -n1 sed -i s'#iprintf#newprintf#g'
because there were some func name “redifinition” in iperf_api.h iprintf function – name collisiosn with cygwin stdio.h definition.
Ok next errors appeared during make process. I’v researched a bit and found that generated libtool script seemed to be broken in my enviroment. There were no usefull code inside, just enviroment variables set and nothing. Its size was about 600 lines, when at the same time it should be much greater and with some code logic. As a result all calls to
/bin/sh ../libtool --tag=CC --mode=compile gcc
produced NO output files. So build process was stuck.
I am not an autoconf guru, so I decided to use not generated libtool but cygwin installed libtool script.(in my case it was in /bin/libtool)
I’v reseted all generated files with(or you can dele all the dir with iperf and clone it again then checkout to correct commit version)
git reset --hard HEAD
echo > ./.gitignore
git clean -f -d
Gitignore cleaned to make it easy to clean all builded already object files and other generated.
then durty fix to function redifinition again(cause wi did reset –hard) with
cd ./src
find ./ -iname "*.[ch]" |xargs -n1 sed -i s'#iprintf#newprintf#g'
then launched configuration script again but this time setting system libtool
export LIBTOOL=/bin/libtool ./configure
And voila, while make process there was system libtool script used and everything went ok.
I understand that its ugly hack, but in my case it worth it and i have no time to deeply investigate cygwin generation nuances caosing libtool to be broken.
good luck everyone!
I didn’t have any trouble with libtool, but ran into the same iprintf signature mismatch. Smiley’s sed command line worked perfectly (this one):
find ./ -iname "*.[ch]" |xargs -n1 sed -i s'#iprintf#newprintf#g'
When .configure is given in Cygwin it shows ./configure: No such file or directory, please help me
Configure scripts are usually included inside the source tarball of a package. Can you provide a link to the package you are trying to compile?
$ make install
Making install in src
make[1]: Entering directory ‘/iperf-3.0.3/iperf-3.0.3/src’
/bin/sh ../libtool –tag=CC –mode=compile gcc -DHAVE_CONFIG_H -I. -g -O2
-MT iperf_api.lo -MD -MP -MF .deps/iperf_api.Tpo -c -o iperf_api.lo iperf_api.c
libtool: compile: gcc -DHAVE_CONFIG_H -I. -g -O2 -MT iperf_api.lo -MD -MP -MF .
deps/iperf_api.Tpo -c iperf_api.c -DDLL_EXPORT -DPIC -o .libs/iperf_api.o
In file included from iperf_api.c:40:0:
iperf_api.h:220:5: error: conflicting types for ‘iprintf’
int iprintf(struct iperf_test *test, const char *format, …) __attribute__ ((f
ormat(printf,2,3)));
^
In file included from /usr/include/stdio.h:29:0,
from iperf_api.c:13:
/usr/include/stdio.h:259:5: note: previous declaration of ‘iprintf’ was here
int _EXFUN(iprintf, (const char *, …)
^
iperf_api.c:2464:1: error: conflicting types for ‘iprintf’
iprintf(struct iperf_test *test, const char* format, …)
^
In file included from /usr/include/stdio.h:29:0,
from iperf_api.c:13:
/usr/include/stdio.h:259:5: note: previous declaration of ‘iprintf’ was here
int _EXFUN(iprintf, (const char *, …)
^
Makefile:541: recipe for target ‘iperf_api.lo’ failed
make[1]: *** [iperf_api.lo] Error 1
make[1]: Leaving directory ‘/iperf-3.0.3/iperf-3.0.3/src’
Makefile:270: recipe for target ‘install-recursive’ failed
make: *** [install-recursive] Error 1
For iperf-2.0.9 compile with cygwin, need to copy “cygstdc++-6.dll” from “C:\cygwin64\usr\local\lib” to “C:\cygwin64\usr\local\bin”
It’s a great article.
I am developing one Android APP where i need to integrate iperf for Android.
Could you help me to compile iperf for android in cygwin? What are the procedures?
Hi folks. Thanks for the tuto by the way.
heres what i get when I try to configure it:
$ ./configure
checking for a BSD-compatible install… /usr/bin/install -c
checking whether build environment is sane… yes
checking for gawk… gawk
checking whether make sets $(MAKE)… yes
checking for g++… no
checking for c++… no
checking for gpp… no
checking for aCC… no
checking for CC… CC
checking whether the C++ compiler works… no
configure: error: in `/iperf-2.0.5′:
configure: error: C++ compiler cannot create executables
See `config.log’ for more details.
any clues ? thank you
that’s what I have now.. :/
checking whether to enable maintainer-specific portions of Makefiles… no
checking for dpkg-architecture… no
configure: error: The dpkg development files (dpkg-dev) must be installed to build this package.
Hi, Thanks for the tuto.
i have a question for you.
when i run make cmd, i found a warning:
“/bin/sh ../libtool –tag=CC –mode=link gcc -g -O2 -Wall -o libiperf.la -rpath /usr/local/lib cjson.lo iperf_api.lo iperf_error.lo iperf_auth.lo iperf_client_api.lo iperf_locale.lo iperf_server_api.lo iperf_tcp.lo iperf_udp.lo iperf_sctp.lo iperf_util.lo iperf_time.lo dscp.lo net.lo tcp_info.lo timer.lo units.lo -lssl -lcrypto
libtool: warning: undefined symbols not allowed in x86_64-unknown-cygwin shared libraries; building static only”
can you explain this warning? how can i fix it.
Thanks you
Hello,
i have a problem with newest iPerf 3.1.3 where there are only two files (cygwin1.dll and iperf3 as an app).
It should be compiled with cygwin but when i type proper folder to this iperf with cd command and then i type ./configure there is answer ./configure: No such file or directory.
Can someone help me with this problem?