TCP testing in Linux is an continuous process. These tests are concerned with the behavior and correctness of the TCP protocol in the Linux kernel.
More will be added to this page soon.
Many tools are available for building TCP tests, but some of the basic ones are:
When running TCP experiments over high Bandwidth Delay Product (BDP) you probably want to change the maximum available TCP window size. TCP tuning is done via wikipedia:sysctl parameters documented in Net:Ip-sysctl (or Documentation/networking/ip-sysctl.txt) see for more info. At a minimum increase tcp_rmem[2] for receiver and tcp_wmem[2] for sender to twice the BDP.
If the test involves repeated connections, you should also turn off the route metrics:
sysctl -w net.ipv4.tcp_no_metrics_save=1
Normally Linux will remember the last slow start threshold (ssthresh). This modifies the result of the second test, and causes errors.
The purpose of congestion control tests is to observe how the congestion window changes with different network conditions. These tests have lots of possible variables and there is no one “right answer”.
A basic test would be:
iperf -s
modprobe tcp_probe port=5001 chmod 444 /proc/net/tcpprobe
cat /proc/net/tcpprobe >/tmp/tcpprobe.out & TCPCAP=$!
iperf -i 10 -t 300 -c //receiver//
kill $TCPCAP
The tcp probe capture file will contain one line for each packet sent.
0.073678 10.8.0.54:38644 192.168.1.42:5001 24 0xb6b19bb 0xb6b19bb 2 2147483647 5792 ^ ^ ^ ^ ^ ^ ^ ^ ^ | | | | | | | | +- [9] Send window | | | | | | | +------------ [8] Slow start threshold | | | | | | +-------------- [7] Congestion window | | | | | +------------------------ [6] Unacknowledged sequence # | | | | +---------------------------------- [5] Next send sequence # | | | +------------------------------------- [4] Bytes in packet | | +------------------------------------------------------- [3] Receiver address:port | +----------------------------------------------------------------------- [2] Sender address:port +-------------------------------------------------------------------------------- [1] Time seconds * The value of slow start threshold here is (-1) which means it hasn't been determined yet * Time since Tcp probe was loaded.
This text file can be easily filtered and modified with standard tools such as awk and perl. A common usage is to make a plot of congestion window and slow start threshold over time using gnuplot.
$ gnuplot -persist <<"EOF" set data style linespoints show timestamp set xlabel "time (seconds)" set ylabel "Segments (cwnd, ssthresh)" plot "/tmp/tcpprobe.out" using 1:7 title "snd_cwnd", \ "/tmp/tcpprobe.out" using 1:($8>=2147483647 ? 0 : $8) title "snd_ssthresh" EOF
The result should look something like this:
A set of scripts to run test like this and plot are available [1]
There are many possible factors that can be evaluated in any test. For a good discussion of the issues see the paper:On the effective evaluation of TCP and Experimental evaluation of TCP protocols for high-speed networks.
On Linux TCP should be able to fully saturate the network given a sufficiently fast CPU and bus for a single connection. Some useful tools are:
See also Performance Testing .
There are (expensive) TCP protocol validation suites.
Fuzz testing is a useful way to find unexpected bugs in the TCP processing.ISIC is a suite of utilities to exercise the stability of an IP Stack and its component stacks (TCP, UDP, ICMP et. al.)