Iperf

From ConShell
Jump to navigation Jump to search

iperf is a fantastic tool to measure TCP throughput across a network or even the Internet

Quick Start

$ sudo apt-get install iperf

Install iperf on the two hosts you want to measure from. We'll call them "client" and "server"

On the server run iperf in server mode

$ sudo iperf -s
.------------------------------------------------------------
Server listening on TCP port 5001
TCP window size: 85.3 KByte (default)
------------------------------------------------------------

On the client, run iperf in client mode

$ sudo iperf -c <server>
------------------------------------------------------------
Client connecting to server, TCP port 5001
TCP window size: 2.50 MByte (default)
------------------------------------------------------------
[  3] local 127.0.0.1 port 39600 connected with 127.0.0.1 port 5001
[ ID] Interval       Transfer     Bandwidth
[  3]  0.0-10.0 sec  35.0 GBytes  30.1 Gbits/sec

If you get "connect failed: Connection refused" there is likely a firewall in the way.

Do NOT believe the #s above. 30Gb/s is what I get connecting to localhost.


Advanced usage

There are many options to iperf. Here are some of my favorites. Use -w to adjust the TCP window size. A reasonable value is 512K, which will be adjusted by iperf to the actual size.

-w windowsize