Simulation of TCP connections

Feabruary 10-11, 2003

These tests are aimed at practicing with the basics of the 'ns' simulator. You can find tutorials, examples and manuals at the ns official site.

  1. One TCP connection is routed over one link. The link bandwidth and delay can be inspected using a sample nam file. The link is the bottleneck. Referring to the 'ns' input file tcp1.tcl:
    • run a simulation using the connection set-ups provided in the input file you were given: measure the connection throughput, including the transient (i.e., from time 0);
    • find the smallest maximum congestion window to assign to the TCP connection such that the bottleneck link is fully utilized; running 'ns' and then 'nam', verify that, eventually, there's a sustained, seamless flow of packets on the bottleneck link;
    • compute the time it takes for the TCP source to reach the full window computed in the previous subtask; this period of time is called the transient; run a simulation measuring the connection throughput without the transient (i.e., after the connection has reached the full window). Is the measured throughput higher than before? Why?
  2. Two TCP connections are routed over a common link (see the sample nam file for further details). Referring to the 'ns' input file tcp2.tcl;
    • run a simulation using the setups provided: measure the overall throughput, as well as the throughput of single connections;
    • find the smallest maximum congestion window for both connections such that the bottleneck link reaches full utilization (check using 'nam').
    • identify the transient and repeat the measure without the transient
    • repeat the simulation with a slower bottleneck link (0.05 Mb/s). You should observe losses (use nam). Why? Dimension the buffer at the intermediate node so that losses disappear, without changing the TCP window size (i.e, find the smallest possible buffer size so that no TCP packet is lost). Notice that the throughput will be increased.
  3. The third task does not provide a sample input file, but requires that you write one, following the guideline of the two scripts provided above.
    Build a scenario where there are 4 TCP connections, following the scenario depicted in the figure on the right. TCP connection 0 is attached to node n0 and has its 'sink' (receiver) at node n6. Similarly, TCP 1 goes from n1 to n7, TCP 2 goes from n2 to n8 and TCP 3 goes from n3 to n9. Dimension each connections' congestion window as well as the bottleneck buffer so that you observe no losses (again, find the smallest possible window as well as the smallest possible buffer that do not lead to losses).
    • measure the throughput of single connections; are the throughputs different? Provide an explanation;
    • attach the Tcl script with your answer.


Answers should be emailed to rossano@di.unito.it by a yet unknown date to be graded.