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
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


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/

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


Lines to be added:
#the above two lines beginning from xgraph and ending with unix should come on the same line
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.