![](https://csdnimg.cn/release/download_crawler_static/86146342/bg1.jpg)
INTRODUCTION TO NS
2
AIM
To get familiarised with Network simulator-2
SOFTWARE USED
Linux
THEORY
Network Simulator (Version 2), widely known as NS2, is simply an event driven
simulation tool that has proved useful in studying the dynamic nature of communication
networks. Simulation of wired as well as wireless network functions and protocols (e.g., routing
algorithms, TCP, UDP) can be done using NS2. In general, NS2 provides users with a way of
specifying such network protocols and simulating their corresponding behaviours. NS2 provides
users with executable command ns which take on input argument, the name of a Tcl simulation
scripting file. Users are feeding the name of a Tcl simulation script (which sets up a simulation)
as an input argument of an NS2 executable command ns. In most cases, a simulation trace file is
created, and is used to plot graph and/or to create animation. NS2 consists of two key languages:
C++ and Object-oriented Tool Command Language (OTcl). While the C++ defines the internal
mechanism (i.e., a backend) of the simulation objects, the OTcl sets up simulation by assembling
and configuring the objects as well as scheduling discrete events (i.e., a frontend). The C++ and
the OTcl are linked together using TclCL. There are three steps in defining a simulation scenario
in a NS2.
PROCEDURE
Step 1 - simulation design
The first step in simulating a network is to design the simulation. In this step, the users
should determine the simulation purposes, network configuration and assumptions, the
performance measures, and the type of expected results.
Step 2 - configuring and running simulation
This step implements the design in the first step. It consists of two phases:
1. Network configuration phase: In this phase network components (e.g.,node, TCP and
UDP) are created and configured according to the simulation design. Also, the events
such as data transfer are scheduled to start at a certain time.
2. Simulation Phase: This phase starts the simulation which was configured in the
Network Configuration Phase. It maintains the simulation clock and executes event
chronologically. This phase usually runs until the simulation clock reached a
threshold value specified in the Network Configuration Phase.