Network Simulator 2 Installation Procedure

Network Simulator 2 (NS2) is a program designed to enable the simulation of networking scenarios without having the actual hardware. It can be used to test many aspects of a networking environment including the development of new protocols.

The program it self is notoriously difficult to install and runs on either windows (using Cygwin or the native windows version) or Linux. For the purpose and functionality of NS2, Cygwin is the preferred method of running NS2 within windows.

Cygwin Install

1. Go to http://www.cygwin.com/ and download the latest version (Latest Cygwin DLL release version is 1.5.22-1)

2. Run setup.exe

3. Select “Install from Internet” then click next

4. Leave the all the default entries including the install directory as this makes things a little easier when browsing the computer via XWindows.

5. Install local package (This is the default install directory where files are stored and extracted for later use… This is not essential as all programs can be retrieved from the internet so this folder can be deleted to save space but is good to keep)

6. Select the connection method

7.  Select a mirror (a UK mirror is best for the UK)

8.  Select packages

Accept all the defaults but you need to add all 9 of these extra packages

Automake

Make

Patch

Perl

X86 libraries

Window Maker

All GCC components

Nano Text editor (Optional… If you are not used to VI or other UNIX editors)

Xgraph (optional, but needed for test suites)

9.  Click next and accept any dependencies and next again…

Cygwin will now download

This may take a while depending on the speed of your Internet connection and the speed of your system as this stage will extract and finalize the install.

NS2 Install

Firstly run up Cygwin and make sure that all is ok. Run XWindows and some application that works within, try xclock.

Try running a windows manager, I selected Windows Maker during the install selection as this I my preferred method.

Now go to http://www.isi.edu/nsnam/dist/ns-allinone-2.29.2.tar.gz and download the file (Direct link to the file)

Copy this to C:\cygwin\home\%USERNAME%

Then go to Cygwin and go to the directory where you just downloaded the file and type the command between the parenthesis including the space and hyphen at the end.

( gzip -d -c ns-allinone-2.29.2.tar.gz | tar xvf - )

Once this has finished (can take a long time depending on system speed)

cd in to the directory just created “/home/%USERNAME%/ns-allinone-2.29”

Now type the command (./install) dot slash install.

Let NS2 run the course, this can also take a while.

Environmental Variables

The next step is to add the Environmental Variables

To do this you have to go to your home directory and locate the file .bashrc

The .bashrc in this directory is your login script. You can change shells, set bash scripts and add environmental variables.

I use the UNIX file editor VI if you are not familiar with VI I advises you to use the NANO editor as this is an easier interface to use.

You can also use a windows editor if you browse to the path c:\cygwin\home\%USERNAME% and edit the .bashrc files

The add these lines but be sure to change the directories to the same as your systems set up and be sure to change any version numbers.

export NS_HOME=/home/%USERNAME%/ns-allinone-2.29

export PATH=$NS_HOME/tcl8.4.11/unix:$NS_HOME/tk8.4.11/unix:$NS_HOME/bin:$PATH

export LD_LIBRARY_PATH=$NS_HOME/tcl8.4.11/unix:$NS_HOME/tk8.4.11/unix:\$NS_HOME/otcl-1.11:$NS_HOME/lib:$LD_LIBRARY_PATH

export TCL_LIBRARY=$NS_HOME/tcl8.4.11/library

Reload Cygwin, and then type “which NS” and “which NAM”. If you get a path shown then you are ok if not you will have to check your paths again.

Good luck!

Document and content created by Edward Mitchell. This document cannot be reproduced, copied or distributed without the explicit permission of the Author.