Saturday, May 10, 2008

Phil Dykstra's nuttcp quick start guide

Phil Dykstra's nuttcp quick start guide

nuttcp is a TCP/UDP network testing tool, much like iperf. I think it's the best such tool available, for its simplicity, ease of use, and feature set.

Getting nuttcp

Official Site: http://www.lcp.nrl.navy.mil/nuttcp/ (html)
Official Site: ftp://ftp.lcp.nrl.navy.mil/pub/nuttcp/ (ftp)
Local copies: http://www.wcisd.hpc.mil/nuttcp/

Compiling/Installing nuttcp

Compiling nuttcp for unix/linux should be easy:
  cc -O3 -o nuttcp nuttcp-5.5.5.c
I copy it to /usr/local/bin/nuttcp but you could put it anywhere. It does NOT need any special permissions to run.

To run nuttcp manually

On one system (or both), run nuttcp -S. This starts a server that will wait for connections. On the other system, try commands like:
  nuttcp hostname        (transmits to hostname)
nuttcp -r hostname (receives from hostname)
type "nuttcp" to see lots of options. Most useful:
  -i1       to watch tests run (1 second intervals)
-w8m to set socket buffers ("window") to 8 MBytes
-u for UDP tests
-R10m for a 10 Mbps UDP test (or TCP rate limit)
-l512 to set UDP packet length (or TCP write size)

With servers running on remote machines you can also do third party tests:

  nuttcp host1 host2

To start nuttcp from xinetd

  1. Copy nuttcp4 and nuttcp6 to /etc/xinetd.d/ (these are in the xinetd.d subdirectory on this server)
  2. Make sure "nuttcp" is in your /etc/services file:
       nuttcp          5000/tcp
    nuttcp-data 5001/tcp
    This tells xinetd what port to listen on for the "nuttcp" service.
  3. Enable the services:
       chkconfig nuttcp4 on
    chkconfig nuttcp6 on
    If you don't have or don't want IPv6, only enable nuttcp4.
  4. Reload xinetd killall -HUP xinetd

Note on IPv6 and old xinetd's:

Modern xinetd's can listen for IPv4 and IPv6 services on the same port. Old ones (e.g. Redhat 8.0) can't. I'm not sure when this changed. For old systems just use the nuttcp file for xinetd.d. If you also want IPv6 you will have to start another service on a different port.

Optional nuttcp server access control

You can use /etc/hosts.allow and /etc/hosts.deny if you are starting nuttcp from xinetd. And/or you can use iptables to restrict access to the control port (default 5000).

nuttcp on Windows

Try one of the zip files. Unzip it and run nuttcp from that directory. These were compiled with cygwin. A cygwin dll is included in the zip file. If you get IPv6 errors, try the version that says "noipv6".

Example Run

host1$ nuttcp -i1 -w8m host2
83.1246 MB / 1.00 sec = 699.7341 Mbps
118.0095 MB / 1.00 sec = 990.0559 Mbps
118.0095 MB / 1.00 sec = 990.0886 Mbps
118.0009 MB / 1.00 sec = 989.9823 Mbps
118.0095 MB / 1.00 sec = 990.0718 Mbps
118.0095 MB / 1.00 sec = 990.0757 Mbps
118.0009 MB / 1.00 sec = 989.9744 Mbps
118.0095 MB / 1.00 sec = 990.0807 Mbps
118.0095 MB / 1.00 sec = 990.0896 Mbps
118.0009 MB / 1.00 sec = 989.9893 Mbps

1157.4375 MB / 10.10 sec = 961.4075 Mbps 16 %TX 10 %RX

This shows a 10 second TCP test from host1 to host2 with a window size of 8 MBytes. It ran at 990 Mbps (GigE with 9000 byte jumbo frames) most of the time. The first second or two is often slower due to TCP slow start. The average for the entire test was 961 Mbps. During each second it sent ~118 MBytes. The percentages at the end mean that nuttcp consumed 16% of the CPU on the transmitter (host1) and 10% of the CPU on the receiver (host2). They are useful for telling if you were CPU limited and should not be confused as packet loss or retransmits.


Phil Dykstra
April 2007

No comments: