You are on page 1of 2

NS2 stands for Network Simulator Version 2.

It is an open-source event-driven simulator designed specifically for research in


Computer Communication Networks

This tutorial is about NS2 Installation on Ubuntu 20.04.


Step 1:
Install the basic libraries like
$ sudo apt install build-essential autoconf automake libxmu-dev

Step 2:
install gcc-4.8 and g++-4.8
open the file using sudo mode
$ sudo nano /etc/apt/sources.list
Include the following line
deb http://in.archive.ubuntu.com/ubuntu bionic main universe

Step 3:
$ sudo apt update

Step 4:
$ sudo apt install gcc-4.8 g++-4.8

Step 5:
Extract the ns2 package to HOME folder
$ cd ns-allinone-2.35/ns-2.35

Step 6:
Modify the following in Makefile.in:
Change @CC@ to gcc-4.8
change @CXX@ to g++-4.8

ns-allinone-2.35/ns-2.35/Makefile.in
ns-allinone-2.35/nam-1.15/Makefile.in
ns-allinone-2.35/xgraph-12.2/Makefile.in
ns-allinone-2.35/otcl-1.14/Makefile.in

Step 7:
Open the file:
ns-allinone-2.35/ns-2.35/linkstate/ls.h
Change at Line no 137 as shown in the below line
void eraseAll(){this->erase(baseMap::begin(),baseMap::end());}

Step 8:
Open a new terminal
$ cd ns-allinone-2.35/
$ ./install

Step 9:
Now, Set the PATH:
Open a new Terminal,
$ gedit .bashrc
(Here, do the PATH settings) as shown below:
export PATH=$PATH:/home/mca-26/ns-allinone-2.35/bin:/home/mca-26/ns-allinone-2.35/tcl8.5.10/
unix:/home/mca-26/ns-allinone-2.35/tk8.5.10/unix

export LD_LIBRARY_PATH=/home/mca-26/ns-allinone-2.35/otcl-1.14:/home/mca-26/ns-allinone-
2.35/lib

Step 10:
Logout and Login back
or
$ source .bashrc

Now, run ns and nam commands to verify it.


The Installation of NS2 is over.

You might also like