Saturday, May 7, 2011

Install Network Simulator 2.34.

Network Simulator is an awesome discrete event simulator targeted at network  research.NS provides support for simulation of TCP, routing, and multicast protocols over wired and wireless (local and satellite) networks.However, installation of this piece of software is always a bit of hassle. I will try and make it as simple as possible.

I will be using the "traditional" way to install the application on Ubuntu 10.10. The package ns-allinone-2.34 is a complete package, it contains Network AniMator (NAM), Xgraph and NS.

First download the package ns-allinone-2.34.tar.gz from here.

Copy the ns-allinone-2.34.tar.gz package to your home folder(In my case /home/neo). Extract the contents in your home folder.

Now install the dependencies. Goto terminal, and type in "$ sudo apt-get install build-essential autoconf automake libxmu-dev gcc-4.3" (without quotes) P.S : We are downgrading the gcc version to 4.3. NS2 works well with gcc 4.3.

Launch terminal, and access the ns-allinone-2.34 folder through "cd ns-allinone-2.34/".

Next edit the makefile.ini file. It is found in otcl-1.13 folder inside the ns-allinone-2.34 folder. Open the makefile.ini file, and look for a line which says CC= @CC@ and change it to CC= gcc-4.3. Save and close the makefile.

Begin the installation.Launch terminal. Access the ns-allinone-2.34 in your home folder and type in "./install" (without quotes).

Look for error messages. (If any, send them to my email id nitinclix@gmail.com")
If step 6 does not return any errors, then we need to add the path in .bashrc file located in your home folder. Navigate to your home folder, hit Ctrl and H simultaneously, look for the file .bashrc. Open it and append the following lines.

# LD_LIBRARY_PATH
OTCL_LIB=/home/neo/ns-allinone-2.34/otcl-1.13
NS2_LIB=/home/neo/ns-allinone-2.34/lib
X11_LIB=/usr/X11R6/lib
USR_LOCAL_LIB=/usr/local/lib
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$OTCL_LIB:$NS2_LIB:$X11_LIB:$USR_LOCAL_LIB
# TCL_LIBRARY
TCL_LIB=/home/neo/ns-allinone-2.34/tcl8.4.18/library
USR_LIB=/usr/lib
export TCL_LIBRARY=$TCL_LIB:$USR_LIB
# PATH
XGRAPH=/home/neo/ns-allinone-2.34/bin:/home/nao/ns-allinone-2.34/tcl8.4.18/unix:/home/neo/ns-allinone2.3/tk8.4.18/unix
NS=/home/neo/ns-allinone-2.34/ns-2.34/
NAM=/home/neo/ns-allinone-2.34/nam-1.14/
PATH=$PATH:$XGRAPH:$NS:$NAM

Here replace /home/neo with the path to your home folder.
 Type this command in terminal for the changes to take place instantly. "source ~/.bashrc"(without quotes)

That is it. Type in "ns" (without quotes) in the terminal, and if you see a % prompt, then ns2 is installed. Type in "nam" (without quotes), if the nam window shows up, then Network AniMator is installed.
Enjoy using NS2. Post your concerns here or email them to me: nitinclix@gmail.com.
And if you like my blog, you can choose to follow it.