# Lab Exercises

## Lab 2

Much research has been done recently attempting to characterize the performance of TCP. This research has largely been centered around mathematical models for the bandwidth which TCP can achieve under various conditions, especially random packet loss.

In this lab, we wish to perform some experiments and collect data on TCP performance. I have laid out three experiments below; course participants are also welcome to design an experiment of their own along the same lines.

Course participants should break up into groups of 2 or 3. Each group should choose one of the experiments below to work on during this lab. If possible, results from the experiment should be graphed to show to the class during the lecture. The experiments are arranged in order from easiest to hardest.

Important lessons from this lab include a better understanding of TCP performance, and development of experimental skills for networking research.

1. Performance vs. Window size: Configure dummynet with a fixed bandwidth delay product for this experiment. Compute the bandwidth delay product BD for your network. Make sure the queue length in the network (using the dummynet parameter "queue") is at least as large as BD. Using ttcp, measure the performance which TCP obtains using window sizes over a range of values, including some which are smaller than BD, and some which are much larger. In order to vary the window in ttcp, use the "-b" option on both the sender and the receiver.

Plot the results on a graph showing ttcp performance (bandwidth) vs. the window size used.

2. Performance under Random Packet Loss: Configure dummynet with a fixed bandwidth (5 Mb/s might be good). Using the dummynet parameter "plr", vary the packet loss rate on your link from 1% to 10%. Use ttcp to measure the performance which TCP obtains for each of these different packet loss rates. (Make sure that you have enough window available to TCP to fill the bandwidth-delay product of the pipe).

Plot the results on a graph showing ttcp performance (bandwidth) vs. the packet loss rate.

3. Packet loss rate under parallel connections: Configure dummynet in a low bandwidth configuration. (bw 200 kb/s, delay 40 msec, queue 6 might be good). Start off by running a single ttcp connection over this link. Record the performance of this connection. Using the dummynet pipe statistics, also record the packet loss percentage. Repeat this experiment, this time starting up two ttcp connections in parallel. (Have each ttcp send half as much data, so the total amount of data transmitted during the test stays the same). Record the same data. Repeat this for as many parallel connections as possible, up to at least 5.

Plot the results on a graph showing average bandwidth obtained per connection vs. packet loss rate.

Some reminders on useful commands:

```    ttcp -r -s -p NNNN
```

```    ttcp -t -s -p NNNN b-20
```
starts up a ttcpsender. The last argument is the hostname or IP address you wish to connect to.

In order to configure dummynet, log into the router of your cluster. Use a command such as:

```sudo ipfw pipe show 1
```

to see the configuration of a pipe. This includes the statistics on the pipe.

```sudo ipfw pipe delete 1
```

will remove the pipe (and also clear the statistics, very important for lab #3).

```sudo ipfw pipe 1 config bw 5000000bit/s delay 40msec queue 90 plr 0.01
```

will configure the pipe to have a bandwidth of 5 Mb/s, a delay of 40 msec, a queue of 90 packets, and a random packet loss rate of 1%.

If you are not familiar with unix graphing tools, a file of the form:

```x1 y1
x2 y2
x3 y3
```

can be run through
`xgraph -M filename`
to quickly generate a simple plot of your data.