Iperf is a commonly used network testing tool that can create
UDP data streams and measure the throughput of a network.
Iperf allows the user to set various parameters that can be used for testing a network, or alternately for optimizing or tuning a network.
- Measure bandwidth
- Report MSS/MTU size and observed read sizes.
- Support for TCP window size via socket buffers.
- Multi-threaded if pthreads or Win32 threads are available. Client and server can have multiple simultaneous connections.
- Client can create UDP streams of specified bandwidth.
- Measure packet loss
- Measure delay jitter
- Multicast capable
- Multi-threaded if pthreads are available. Client and server can have multiple simultaneous connections. (This doesn’t work in Windows.)
- Where appropriate, options can be specified with K (kilo-) and M (mega-) suffices. So 128K instead of 131072 bytes.
- Can run for specified time, rather than a set amount of data to transfer.
- Picks the best units for the size of data being reported.
- Server handles multiple connections, rather than quitting after a single test.
- Print periodic, intermediate bandwidth, jitter, and loss reports at specified intervals.
- Run the server as a daemon (Check out Nettest for running it as a secure daemon).
- Run the server as a Windows NT Service
- Use representative streams to test out how link layer compression affects your achievable bandwidth.
# yum install iperf -y
Server side: To start
iperf as “server” service, use the “-s” flag.
# iperf -s ————————————— Server listening on TCP port 5001 TCP window size: 85.3 KByte (default) —————————————
To stop the server, send Ctrl+C.
Client side: For client side,
iperf has to be initiated with “-c” option. There are lot of other options, which performs different kind of testing. Few examples are explained below.
Measuring throughput using default
iperf option. This connects to the
iperf server mentioned and finds out the network throughput.
# iperf -c server1IP ————————————— Client connecting to server1, TCP port 5001 TCP window size: 16.0 KByte (default) ————————————— [ 3] local 22.214.171.124 port 41505 connected with 126.96.36.199 port 5001 [ ID] Interval Transfer Bandwidth [ 3] 0.0-12.1 sec 25.4 Mbytes 25.0 Mbits/sec
Measuring multi-thread throughput. Use -P option to specify the number of parallel threads to be started.
# iperf -c server1IP -P 3 ————————————— Client connecting to server1, TCP port 5001 TCP window size: 16.0 KByte (default) ————————————— [ 5] local 188.8.131.52 port 41523 connected with 184.108.40.206 port 5001 [ 4] local 220.127.116.11 port 41522 connected with 18.104.22.168 port 5001 [ 3] local 22.214.171.124 port 41521 connected with 126.96.36.199 port 5001 [ ID] Interval Transfer Bandwidth [ 5] 0.0-10.1 sec 25.9 MBytes 23.3 Mbits/sec [ 4] 0.0-10.1 sec 25.9 MBytes 23.2 Mbits/sec [ 3] 0.0-10.1 sec 25.8 MBytes 23.1 Mbits/sec [SUM] 0.0-10.1 sec 83.6 MBytes 69.5 Mbits/sec
Note: You can even run the client side on regular intervals using cron daemon and plot graphs (using mrtg or rrd) for the throughput.
[Source: linuxarticles.org by Dhaval Soni]