How to Deploy a Node in NS2!

Dhanu R
2 min readSep 7, 2019


This Writeup is Very useful for the beginners to start working with NS2 and Projects on the Domain of Computer Networks and Network Security! integrated with VANET,MANET and WSN ,etc.


Tools Required: NS2 , NAM ,NSG2.1.jar , Linux-Terminal or Cygwin.

1)Fire up your Terminal:

2)Install NSG2.1.jar:


3)Install NS2 and NAM:

Type $sudo apt-get install ns2

Network Simulator version:2 (NS2)

wait for it to complete then type $sudo apt-get install nam

The Network Animator (nam)

4)Run NSG2.1:

Locate the jar file and type $java -jar NSG2.1.jar to execute the Network Script Generator NSG2.1 in GUI Console!

5)Working on NSG2.1:

Click on Scenario and Select New wireless Scenario / new Wired scenario based on you wish!

6)Automatic TCL script Genration:

then Click Node Button Once, In GUI and then click on the environment wherever you want and click TCL which open ups window with source code as Save and Save as Buttons, by Default NSG saves source code as a .tcl file extension!

“Click Anywhere in the Environment to Deploy!”



type the command $ns <fileame>.tcl ,The output execute with the NAM GUI Console with Deployed Nodes and with Files such as out.nam and

That’s All Folks!!!



Dhanu R

it’s not $whoami, but what i do that defines me!