Tuesday, August 5, 2014

iperf as a daemon to test the bandwidth (in RHEL6)

Update: Check the Jason's comments to discover new updates for iperf v3.

Do you need to check the connectivity between your server and your customers? Do you have different customers with different OS? Take a look to iperf.

From https://iperf.fr/:

Iperf features

  • TCP
    • 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.
  • UDP
    • 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.
  • Run the server as a Windows NT Service
  • Use representative streams to test out how link layer compression affects your achievable bandwidth.

There are pre-compiled binaries for a lot of platforms.

Perhaps you want to leave a daemon running in your server. Great!.
RHEL6 Installation:

  • EPEL repository installed.
  • yum install iperf
  • Open a port in your firewall.
  • Save this init script in /etc/init.d:



  • chmod 755 /etc/init.d/iperfd
  • chkconfig add iperfd 
  • chkconfig --on iperfd
  • And you don't forget to change the port variable in the script ;)



3 comments:

  1. Great writeup! A quick update given the changing times:
    * "chkconfig add iperfd" should be "--add"
    * "chkconfig --on iperfd" is now obsolete. Using --add is enough.

    ReplyDelete
    Replies
    1. Replacing "iperf" with "$prog" so one can use iperf3 instead of the older iperf more easily. As-is, the -D flag for daemon mode doesn't seem to log to $logfile. Upgrading to iperf 3.1 will allow starting with "-D --logfile=$logfile" to start in daemon mode and log to the specified logfile without using a ">".

      https://iperf.fr/iperf-download.php

      Delete
    2. Hey Jason, thanks for writing... I am sure it will be useful to someone in advance. I have added a Update tag in the beginning pointing to your comments. Thx!

      Delete