NS (Network Simulator)
NS is a great tool for simulating network agents. It allows a
user to easily specify an arbitrary network with assigned attributes to
network elements (e.g., link speed). The main NS site is here.
-
Steps for using NS:
-
Download the "allinone" copy from the main site.
This contains a tarred/compressed version of everything (TCL, NS, TK,
...).
- Decompress/untar it in your home directory. I suggest changing the
directory name from ns-allionone... to ns.
- Change to the ns directory and run "./install". This should
compile everything for you.
- Make sure you set your LD_LIBRARY_PATH variable to point to the otcl shared
library. If your ns installation is at /home/bob/ns, you need to
set the variable to /home/bob/ns/otcl. Also make sure that /home/bob/ns/bin
is in your path. This directory will hold links to all of the vital
binaries.
- The ns directory contains everything (NS, TCL, ...). Change to
the ns distribution directory (e.g., ns-2.26) and run "./validate" to
confirm your version works.
-
There is a good NS tutorial.
-
Another good way to learn NS is to play with the example TCL files in /home/bob/ns/ns-2/tcl/ex.
Try the simple.tcl file in that directory by typing "ns simple.tcl" in
the "ex" directory. These TCL files show how to create a network,
use existing NS agents to perform a simulation, and create a nam (Network
Animator) animation of the simulation. Note that tcl is interpreted
so you do not need to compile the scripts. Just write the script
in a file (e.g., foo.tcl) and type "ns foo.tcl" to execute it.
-
The main site also contains a manual
on using NS.
- I have created an FEC agent. You can download the code
and installation instruction from here.
- You can now search
the NS mailing list archives.
- I maintain a BU FAQ where I try to log
answers that I found to various questions.
- A good way to learn about using existing agents to build
simulations is looking over the example files (e.g., simple.tcl) in the
ns/ns-version/tcl/ex directory. You can interpret these files by using the
man page for ns (command: man ns).