I have had a couple of occasions now to use the iperf utility in network testing and have come to love it enough that I decided it warranted a post. While there are more powerful tools such as wireshark, this one is nice because it is so lightweight.
The first time I used it was to test the bandwidth capabilities of my switches. I discovered that my standard computers were unable to generate enough data fast enough to put a load on a gigabit switch. By starting up a server to consume the data I was able to start up multiple clients feeding it to get me pretty close to the limit.
# starts the server in listening mode
(server): iperf -s
#runes the client for 1200 seconds which is 1 hr to the servers ip
(client): iperf.exe -c 192.168.xxx.xxx -t 1200
The second time I needed this handy utility was when troubleshooting a voip phone network. I was not getting any dropped packets from the ping tests I had done, so I turned to this utility to see if perhaps UDP packets were having issues.
-c is client ip, -b is bandwidth size to be tested which adjusts how
large of packets are being sent., -t is the number of seconds to run the
(client): iperf -c 192.168.xxx.xxx -b .5mb -t 180
-s initiates the instance as a listening server, -u specifies it
will be a UDP test, -i specifies the reporting interval in seconds.
(server): iperf -s -u -i 1