University of California at Berkeley
Dept of Electrical Engineering
& Computer Sciences
Network Simulations Using NS2
Network simulation software enable us to predict behavior of a large-scale
and complex network system such as Internet at low cost under different
configurations of interest and over long period. Many network simulators,
such as NS2, Openet, Qualnet, etc., are widely available. We'll use NS2
for this project. NS2 is a discrete event simulator written in C++, with
an OTcl interpreter shell as the user interface that allows the input model
files (Tcl scripts) to be executed. Most network elements in NS2 simulator
are developed as classes, in object-oriented fashion. The simulator supports
a class hierarchy in C++, and a very similar class hierarchy in OTcl.
The root of this class hierarchy is the TclObject in OTcl. Users create
new simulator objects through the OTcl interpreter, and then these objects
are mirrored by corresponding objects in the class hierarchy in C++. NS2
provides substantial support for simulation of TCP, routing algorithms,
queueing algorithms, and multicast protocols over wired and wireless (local
and satellite) networks, etc. It is freely distributed, and all source
code is available.
Developing new networking protocols and creating simulation scripts
are complex tasks, which requires understanding of the NS2 class hierarchy,
C++, and Tcl programming. However, in this project, you only need to design
and run simulations in Tcl scripts using the simulator objects without
changing NS2 core components such as class hierarchy, event schedulers,
and other network building blocks. You should put all your results in the
files with given names. For your report, you do not need to rewrite the
assumptions given in this document, but should provide any information
not already given to you.
There is only 1 deadline for this project, but you are strongly urged to
finish task 1 before email@example.comPM.
This project is out 10/19/2005. The final deadline for all tasks is firstname.lastname@example.orgPM.
After the project is submitted, EACH person in the class (not each
group) will need to set up a meeting time with Jana or Rowena in order
to answer some oral questions on the project itself. Details on what
times are available will be posted later.
You must submit the relevant Tcl programs, Awk/Gnuplot scripts, and reports
for each problem.
Be aware that you don't have any slip day for homeworks and projects, for
more information click
You are going to work on your own for this project.
Read the latest specifications carefully. Check periodically for updates.
If you have any doubts, do not hesitate to contact your TAs.
The following files are needed:
You are to submit the following files (please don't tar them):
No other files need to be submitted.
To submit your files, create a directory, first copy the relevant files
into that directory, making sure that the header files go into the corresponding
directory. Then go into that directory and then enter:
task1.pdf, task1_b.tcl, task1_c.tcl, task1_d.tcl, task1_d_total.awk
Please make sure that you submit the version you intend to submit. To
be fair to everyone else we cannot accept cases where earlier versions
were submitted in error. Note that you can submit as many times as
you want, as long as the submissions are before the deadlines. We will
grade the latest version (i.e.. the one closest to and before the deadlines).
Project 2 News and Modification to Project Specs
Hints & Tips
CMU TOM Conversion
How to get pdf file from ps file: www.ps2pdf.com
How to generate postscript files: http://www.cs.dal.ca/~smedley/veu/postscript.html
The internal identifier numbers of node 1, node 2, node 3, and node 4 in
NS2 are 0, 1, 2, and 3 respectively, as shown in the figure visualized
by nam. This will help you to understand the Awk scripts.
Each of Awk scripts provided for Project 2 has its own executable file.
You don't need to type them or paste them. But you have to make sure they
are executable. If they are not, please change their attribute by typing:
chmod ug+x *.*
Please read the specs carefully.
NS2 is hard to the beginner! The official NS2 documentation is the Ns Manual.
However, the tutorial for the Network Simulator provides an easy introduction
and basic usage to NS2.
If you think there are problems please give all information you can obtain,
although providing possible causes of error can sometimes be of help, it
can also be misleading and confusing. It is important to provide as much
information as possible. The reason is that what you think is wrong may
not be the actual cause of the problem.
We will test your implementation on the instructional machines. If you
implement your scripts on Windows, you have to port your implementation
and make it work on the instructional machines
Nam, a Tcl/TK based visualization
tool for viewing NS2 network simulation traces and real world packet traces
Tcl/Tk Manual Pages
OTcl, an extension
to Tcl/Tk for object-oriented programming.
text-processing programming language
Gnuplot, a command-line driven program
for producing 2D and 3D plots (tutorial)
XGraph, a fairly straightforward
program that plots graphs
Reference for Task 2
K. Fall and S. Floyd. Simulation-based Comparisons of Tahoe,
Reno, and SACK TCP. Computer Communication Review, 1996. (ps,
V. Jacobson and M. J. Karels. Congestion Avoidance and Control. Proc. of
SIGCOMM, 1988. (ps, pdf)
D. Chiu and R. Jain. Analysis
of the Increase and Decrease Algorithms for Congestion Avoidance in Computer
Networks. Computer Networks and ISDN Systems, 1989.
Comparative Analysis of TCP Tahoe, Reno, New-Reno, SACK and Vegas (student
- Part (a) (total 0.5 pt)
- What is the packet loss rate of the two TCP flows? What is the ratio of throughput between the two packets?
- Part (b) (total 2 pts)
- task1_b.tcl (1 pt)
- Give the packet loss rate of the two TCP/FTP flows (0.5 pt)
- Which flow uses more bandwidth in the bottleneck link from node 3 to node 4? (0.5 pt)
- Part (c) (total 3.5 pts)
- task1_c.tcl (1 pt)
- Give the total bytes of traffic for each flow. (0.5 pt)
- How does the packet loss rate change? (0.5 pt)
- Do both flows receive a "fair share" of the available bandwidth of the bottleneck link? (0.5 pt)
- What is the reason? (1 pt)
- Part (d) (total 4 pts)
- task1_d.tcl (1 pt)
- Give the total bytes of TCP for each flow (1 pt)
- task1_d_total.awk (Awk script to compute the total bytes of traffic for part d) (1 pt)
- Do all TCP/FTP flows receive a "fair share" of the available bandwidth of the bottleneck link? Why or why not? (1 pt)
Task 2 (total 30 pts)
Part (a) (total 6 pts)
Which one is TCP Tahoe (2 pt)
Which one is TCP Reno (2 pt)
Which one is TCP SACK (2 pt)
Part (b) (total 3 pts)
Part (c) (total 6 pts)
- (2 pts each question)
For the blackbox corresponding to TCP Tahoe: At what
time is additive increase invoked for the second time? What is the approximate
beginning time that multiplicative decrease is invoked for the third time? What
is the approximate beginning time that fast retransmit is invoked for the first
Part (d) (total 4 pts)
- 2pts For the blackbox for TCP Reno: What is the approximate
beginning time that fast recovery is invoked for the first time?
- 2pts What is the
approximate time interval that additive increase is invoked for the second
Part (e) (total 3 pts) answer + reason
Part (f) (total 4 pts) answer + reason
Part (g) (total 4 pts) answer + reason