Installing Network Simulator 2 on Ubuntu 14.04

by June 29, 2015 0 comments

Network simulators are tools used to simulate discrete events in a network which helps to predict the behavior of a computer network

Generally the simulated networks have entities like links, switches, hubs, applications, etc. NS2 is a name for series of discrete event network simulators like ns-1, ns-2, and ns-3. All of them are discrete-event network simulators, primarily used in research and teaching. ns2 is free software, publicly available under the GNU GPLv2 license for research, development and use.

STEP 1: Download and Extract ns2 using terminal by using given commands:
cd ~/
sudo wget http://softlayer-sng.dl.sourceforge.net/project/nsnam/allinone/ns-allinone-2.35/ns-allinone-2.35.tar.gz
tar -xvzf ns-allinone-2.35.tar.gz

STEP 2: Ns2 requires some packages including GCC- version 4.4 to work correctly. So install all of them by using the following command:
sudo apt-get install build-essential autoconf automake libxmu-dev
sudo apt-get install gcc-4.4

STEP 3: After installation of packages, we have to make a change in the “ls.h” file. Navigate to the folder “linkstate” which is assumed be in the ns folder extracted and is in the home folder of your system.
cd ~/ns-allinone-2.35/ns-2.35/linkstate

STEP 4: Open the file named “ls.h” by using given command and scroll to the 137th line. You will find the word “error”; change that to “this->error”. To open the file use the following command:
gedit ls.h

1ns

STEP 5: Now, we need to inform ns which version of GCC will be used. To do so, go to your ns folder and type the following command. Here, change CC= @CC@ to CC=gcc-4.4, as shown in the image below, then save
and exit.
Sudo gedit ns-allinone-2.34/otcl-1.13/Makefile.in

STEP 6: Now we are ready to install ns2. Run the install script using the following commands:
sudo su cd ~/ns-allinone-2.35/./install

STEP 7: The final step is to tell the system, where the files for ns2 are installed or present. Open the .bashrc file using the given command. Add the given lines but be sure that the path you are giving is the same where the folder ns is present. For example, if you have installed it in a folder “/home/abc”, then replace “/home/pcquest/ns-allinone-2.35/otcl-1.14” with “/home/abc/ns-allinone-2.35/otcl-1.14”.
sudo gedit ~/.bashrc

2ns

Lines to be added:
# LD_LIBRARY_PATH
OTCL_LIB=/home/pcquest/ns-allinone-2.35/otcl-1.14
NS2_LIB=/home/pcquest/ns-allinone-2.35/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/pcquest/ns-allinone-2.35/tcl8.5.10/library
USR_LIB=/usr/lib
export TCL_LIBRARY=$TCL_LIB:$USR_LIB
# PATH
XGRAPH=/home/pcquest/ns-allinone-2.35/bin:/home/pcquest/ns-allinone-2.35/tcl8.5.10/unix:/home/pcquest/ns-allinone-2.35/tk8.5.10/unix
#the above two lines beginning from xgraph and ending with unix should come on the same line
NS=/home/pcquest/ns-allinone-2.35/ns-2.35/
NAM=/home/pcquest/ns-allinone-2.35/nam-1.15/
PATH=$PATH:$XGRAPH:$NS:$NAM
Once the changes have been made, save the file and restart the system.

STEP 8: Once the system has restarted, open a terminal and start ns2 by using the command ns.

No Comments so far

Jump into a conversation

No Comments Yet!

You can be the one to start a conversation.

<