CS625, Fall 2003, Assignment-1
Instructions
- Please read the assignment in full before you start out.
- Expect the details of the questions to change in the first week
-- I will make these finer changes as I get feedback. But this
should not stop you from proceeding with the assignment.
- The assignment will be due Sat, 20 Sep 2003 11:59:59 (you get a
day extra since I'm a few hours late in assigning you this :-)
- Assignments have to be done individually and NOT in
groups.
- You can take the help of the TAs or me (not your fellow
students) for the following auxiliary tools: UNIX, bash, perl,
gnuplot, gimp, etc. But most of you probably have sufficient
knowledge of these anyway -- at least as much is required for
this assignment.
- Any reference (including google search) is allowed except
consulting your fellow students in any way.
- You will submit this assignment electronically. Please
submit a neatly typed out document (text only please)
answering the questions in the various parts. Please follow the
format below for ease of correction:
- Create a directory
"assignment1-xyzabc", where "xyzabc" is your roll number.
- Submit your main file as "answers.txt" (text only please,
and please use a UNIX editor).
- For each of the parts in the assignment, you will be
submitting various files. You will have to put these
files in a subdirectory "part-x" where "x" is the part
number. The files to submit will be specified in each
part.
- Submit the whole thing as a single tar-gzipped file, as
"assignment1-xyzabc.tar.gz"
- Please email your submission to
- You may consider your submission complete ONLY after you get a
confirmation response. I will stick around in my office around
the mid-night before the submission deadline, so that you can
approach me if there are any problems with the submission at the
last minute.
Brief Overview and Background
In this assignment you will be studying the performance behaviour
of TCP, first on wired links, and then on lossy/wireless links. You
will use the ns-2 Network
Simulator. It has been installed in the cs625 account. To use ns,
set your shell PATH variable to include
"/3u3/course/cs625/ns-allinone-2.26/bin".
You can look at an NS tutorial on the web, such as this one here. You can download some
example script, view some animations and have fun to begin with. I
suggest you go through the explanation of the example script since it
will help you in the exercise below.
The NS documentation is available at
"/3u3/course/cs625/ns_doc.pdf". I will be referring to this copy of
the documentation in guiding you through the various steps below. You
can also go through the introduction chapter of this documentation.
Part 1 (warm up)
For your exercises, you will be creating the following simple
topology, where you have a source node, a destination node, and an
intermediate router (marked "S", "D", and "R" respectively).
The part between node "S" and node "R" is marked as link-1, and the
part between node "R" and node "D" is marked as link-2. Link-1 is
supposed to be the wired part of the network, with high bandwidth, and
(almost) no errors. Link-2 is supposed to be the wireless hop of the
network, with lower bandwidth, and high error probability (although
you will introduce wireless errors only in a later part of the
assignment).
Here are the steps in this part:
- In this part, you are supposed to create in ns-2, the above
topology, with the following parameters:
- Link-1: 100Mbps, 50ms latency
- Link-2: 100Kbps, 1ms latency
- In addition, create a TCP connection with an FTP flow running on
top of it, with the TCP source at node "S", and the TCP
destination at node "D".
- Make sure that the TCP source you create is the Reno variant.
This you will do for example by having the line "set tcp [new
Agent/TCP/Reno]" when you create the TCP source object in your
TCL code.
- Have the simulation run from time 0 to 51 seconds, and the FTP
run from 0.5 to 50.5 seconds (for a duration of 50 seconds).
- Have the ns-2 code generate a trace-file under the name
"out.tr". You will use the command "$ns trace-all $f" for
this.
- Also animate the above using NAM (it should be easy to do this,
if you had gone through the example in the ns-2 tutorial). You
will use the command "$ns namtrace-all $nf" for this. Create
the nam output under the name "out.nam".
- You can refer to the ns_doc.pdf file, the introduction chapter,
for information on trace-all and namtrace-all commands.
- Answer the following question in your main file
(answers.txt). Look at the last few lines of out.tr you
generated. Look for a line containing the word "ack". The
last-but-one column gives the sequence number. As you can see
from any of the lines containing the word "tcp", the packet size
is "1040 bytes". The last (ack) sequence number should give you
the number of packets successfully received in the 50 seconds of
simulation (do not care about plus-minus-1 here). From the
packet size information, what in the number of bytes transmitted in
50 seconds? What is the throughput achieved? How does this
compare with the bottleneck bandwidth in your topology? (Beware
of the 1024 vs. 1000 notation difference while checking your
numbers here).
Here's what to submit for this part (in sub-dir "part-1"):
- The ns-2 TCL script for the above topology creation.
- A screen-shot of the NAM animation, somewhere in the middle of
the FTP flow, after at least 5 seconds (you can fast-forward,
pause NAM, and then use "gimp" to capture the window). The
screen-shot may be in JPG or GIF format.
Part 2 (TCP slow-start and congestion avoidance)
From here on, you will just have to make minor modifications to the
ns-2 TCL code you have written above. First, you are going to make
the following modifications:
- First, you will have the TCP source collect trace information by
using the following commands:
# Open the TCP trace file
set par [open param.tr w]
...
# Create the TCP source object
set tcp [new Agent/TCP/Reno]
...
#trace the tcp parameters
$tcp attach $par
$tcp trace cwnd_
$tcp trace maxseq_
$tcp trace rtt_
$tcp trace dupacks_
$tcp trace ack_
$tcp trace ndatabytes_
$tcp trace ndatapack_
$tcp trace nrexmit_
$tcp trace nrexmitpack_
Make sure to also close the "param.tr" trace file in the
"finish" procedure, just like you close the "out.tr" and
"out.nam" files.
- Next, you will limit the queue size in the bottleneck link
(link-2) between node "R" and node "D" by using the command
"queue-limit". (See section 7.4 of ns_doc.pdf). Set the limit
to be 10 packets.
- Now you can run the simulation as earlier. You will now have an
extra trace file "param.tr" with the TCP parameters, as seen at
the sender "S". The file "param.tr" will have time in the first
column, and the value of the parameter in the last column.
- Next, separate out each of the parameters into separate files,
for instance by
"grep cwnd_ param.tr > cwnd.tr"
The first set of values in "param.tr" will have invalid values
for the various parameters, at time 0 -- this should not really
matter, but be aware of this while looking at any traces. I
will call these individual files as cwnd.tr, maxseq.tr, rtt.tr,
etc.
- Use gnuplot to plot three different files:
- The congestion window (cwnd) as a function time (can you
identify the slow-start and congestion-avoidance phases)?
- The maximum sequence number sent (maxseq) as a function of
time
- The round trip time (rtt) as a function of time
- Answer the following questions in your main file
(answers.txt):
- Just as in part-1, calculate the throughput achieved in
this case? How does it compare with the throughput you
saw in part-1?
- Look for lines starting with a "d" in "out.tr". These
represent packet drops. Can you find the first packet
drop? What is its sequence number? (Look at the
last-but-one column for the sequence number). What is the
time when this drop occurs? (Time is given in the first
column).
- Look at the cwnd.tr file and determine the time when
slow-start ends and congestion avoidance begins.
- Explain in words, the shape of each of the three plots.
What to submit for this part (in sub-dir part-2):
- The ns-2 TCL code
- The three plots that you generated above (any UNIX-viewable
format is fine, png is preferred).
Part 3 (TCP and wireless losses)
In this part, you will be studying the behaviour of TCP under
wireless losses. See section 13.4 of ns_doc.pdf for this. In fact,
you will use the last few lines of page 127, and the "link-lossmodel"
command in the subsequent page.
- Introduce errors in the wireless link (link-2). Start with an
error probability of 0.01 (1 percent), and increase in steps of
0.01, upto 0.10 (10 percent). Also include the 0 percent error
case for comparison. In each case, run the simulation, and
compute the throughput achieved. Plot a graph (probably using
gnuplot) of the throughput achieved (in Kbps) versus the error
probability.
What to submit for this part (in sub-dir part-3):
- Submit the plot that you generated above (any UNIX readable
format acceptable, png is preferred).
Checklist before submission
In answers.txt, you should have answers for one question in
part-1, and four questions in part-2.
The tree of files/directories should be:
assignment1-xyzabc/
answers.txt
part-1/
code.tcl
screenshot.jpg
part-2/
code.tcl
cwnd.png
maxseq.png
rtt.png
part-3/
throughput-plot.png
Bhaskaran Raman
Last modified: Wed Sep 10 16:21:38 IST 2003