Thursday, April 2, 2009

NS2 - Network Simulator

We got an assignment which required us to write and run a script on NS2, the popular free and open source network simulator. This is what I followed to do it on Ubuntu 8.10.
  1. Download and install NS 2.33 on Ubuntu according to instructions shown here: http://anggriawan.web.id/2008/05/install-ns2-on-ubuntu-804-hardy.html
  2. When you run ns from the terminal you can enter an ns prompt. But I didn't use this prompt to run scripts. I simply ran ns with the script file as the command line argument. (for example ns myscript.tcl)
  3. You write ns scripts using a language called Tcl. This tutorial: http://www.isi.edu/nsnam/ns/tutorial/index.html is really great for learning Tcl scripting from the begining.
The tutorial walks you through creating network topologies, data flows and even drawing graphs with Tcl. See images below.

After runnnig a script, you get this visual simulation where you can analyze in detail what is hapening on the network

A graph drawn using output files and X Graph. Output files are also compatible with GNU Plot

Update

This image shows the same data file drawn using Excel. Two output files were created for two test cases.

.
.

2 comments:

cik favthen said...

Hello..
may I know how you plot the data and make graph in excel?
thank you...

this is my email
favthen@gmail.com

Ravin Perera said...

As I remember, you can directly input NS2 trace files into X-Graph and GNU plot utilities and they will do the job for you.

For drawing in excel, I just opened the trace files in excel and formatted them before plotting graphs. Excel nicely handles csv-like files.

Google