Installing Network Simulator 2 on Debian GNU/Linux

Posted on: August 15, 2010

Pre-Requisite: Install Debian GNU/Linux

STEP  1: Download Network Simulator Setup.

Download NS2 All In One Package from following link:


Official Website:


STEP 2: Place the file in your home directory and extract the tar file

$ tar -xzvf ns-allinone-2.31.tar.gz

Note: This tutorial was designed using 2.31 version.
Please don't forget to replace 2.31 to 2.34 in following commands

STEP 3: Go to folder where tar file is extracted.

$ cd ns-allinone-2.31

STEP 4: Insert Debian DVD for dependency components.

$ sudo apt-get install build-essential autoconf automake libxmu-dev
$ sudo apt-get install -f build-essential
libxt-dev libxt6 libsm-dev libsm6 libice-dev libice6 libxmu-dev

STEP 5: Install NS2 using following command.

Note: This process will take some time.

STEP 6: Set environment variables

$ gedit ~/.bashrc

Add the following lines to the end of it.

Dont forget to replace "/home/bharat with your directory path.

Example: /home/yourname/




STEP 7: Make changes

$ source ~/.bashrc

STEP 8: Check Installation Success

$ ns

If you type ns command on shell, then a "%" will appear on the screen.
That means NS2 is successfully installed.

STEP 9: Exit to Linux prompt


Type "exit" to quit the mode and back to "$"

STEP 10: Validation of NS2 Installation.

Go to network simulator directory inside the all in one
package and execute following command.

$ cd ns-2.31
$ ./validate

Note: Be patient till validation gets successful.


6 Responses to "Installing Network Simulator 2 on Debian GNU/Linux"

[…] About Installing Network Simulator 2 on Debian GNU/Linux […]

Done till
source ~/.bashrc
but after trying to execute the command ‘ns’
it says command not found..any solution(suggestion)

command not found-error indicates that ns is not installed, check whether dependencies packages were installed properly, or check bashrc file in which you edited /home/hostname and most important, while editing the file, make sure you changed ns-allinone-2.31 to 2.34

@Uddhav & Bharat
try the commands
$ cd ns-2.31
$ ./validate just after gedit ~./bashrc and make sure you gives enough space and new lines as in the given text for bashrc.
You can only run command ‘ns’ succefully after validation is succeffully completed.

thank God
and thank you a lot Bharat
finally the installation finished successfully certainly with your ordered steps
Beast Regards

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 50 other followers

What I am Upto Now

Follow Me On Twitter

Blog Stats

  • 75,314 hits

Live Traffic

My Paintings

%d bloggers like this: