Network simulator – 2 installation steps in Ubuntu


Step 1: To connect internet in Terminal

Open the terminal (Press CTRL + ALT + T) and issue this command: sudo gedit /etc/apt/apt.conf

It will open a file, in this file, add this line and replace your own proxy details:

Acquire::http::Proxy “http://username:[email protected]_server:proxy_port”;  (if you are not using a proxy server then it is not required)

Replace all details marked in colors with your own proxy server access details. Then save the file and exit

Step 2: write the following command for necessary updates: 

sudo apt-get update

Step 3: After installing updates , you have to install some essential softwares for installing ns2. Execute following commands on opened terminal for necessary updates 

1. sudo apt-get install tcl8.5-dev tk8.5-dev

2. sudo apt-get install build-essential autoconf automake

3. sudo apt-get install perl xgraph libxt-dev libx11-dev libxmu-dev


use a single command instead of above 2 & 3 as:

sudo apt-get install build-essential autoconf automake libxmu-dev

Step 4: Download NS2 source file named as “ns-allinone-2.35.tar.gz” 

from following Link:


(There are particular versions of ns2 that are compatible with some specific areas. You will have to download that particular version of ns2. e.g. Cognitive radio (ns-allinone-2.31.tar.gz), Vehicular Networks (ns-allinone-2.34.tar.gz), Wireless sensor networks (ns-allinone-2.35.tar.gz)).

For implementing general Routing or MAC layer protocols, I will recommend you to go for ns-allinone-2.35.tar.gz

Step 5: Put “ns-allinone-2.35.tar.gz” in home directory and Unpack 

Step 6: Go to extracted directory ns-allinone-2.35 using following command:

cd /home/ns-allinone-2.35

sudo ./install

(In this step many errors will come in installation process. That I will cover in next blogs. Related links to error free ns-allinone-2.35.tar.gz will also be provided)

Step 7: Setting the NS path execute following command through terminal 

gedit ~/.bashrc

It will open a file that consist of some information. Go to the last line and add the scripts below:

export PATH=$PATH:/home/PC-NAME/ns-allinone-2.35/bin:/home/PC-NAME/ns-allinone-


export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/PC-NAME/ns-allinone-2.35/otcl-


export TCL_LIBRARY=$TCL_LIBRARY:/home/PC-NAME/ns-allinone-2.35/tcl8.5.10/library

Save the file and close.

Step 8: Enable the path setting:

Go to: 

cd /home/ns-allinone-2.35

cd ns-2.35

sudo ./validate

Step 9: Give command:

sudo apt-get install ns2

This step will complete your installation of ns2

Step 10: Verification of NS 

On Terminal execute command as:


if it returns % then your installation is complete.


Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.