Simulation is widely-used in system modelling for applications ranging from engineering research, business analysis, manufacturing planning, and biological science experimentation. Networking study, implementation, testing and evaluation is not feasible without Network simulation. It is a technique where a code incorporates the behaviour of a network by calculating the interaction between the different network entities (hosts/packets, etc.) using mathematical modelling. Simulators are used for the development of new networking architectures, protocols or to modify the existing protocols in efficient environment. Network simulator provides benefits of time as well as cost saving while implementing and testing any wired or wireless network. Due to growth of communication networks and ever increasing networking speed, the role of efficient Network simulators in research field is important. A network simulator is a piece of software or hardware that predicts the behaviour of a network, without an actual network being present.
A simulation is, more or less, a combination of art and science. That is, while the expertise in computer programming and the applied mathematical tools account for the science part, the very skill in analysis and conceptual model formulation usually represents the art portion. A simulation can be thought of as a flow process of network entities (e.g., nodes, packets). As these entities move through the system, they interact with other entities, join certain activities, trigger events, cause some changes to the state of the system, and leave the process. From time to time, they contend or wait for some type of resources. This implies that there must be a logical execution sequence to cause all these actions to happen in a comprehensible and manageable way. An execution sequence plays an important role in supervising a simulation and is sometimes used to characterize the types of simulation.
NS2 is an open-source simulation tool that runs on Linux. It is a discreet event simulator targeted at networking research and provides substantial support for simulation of routing, multicast protocols and IP protocols, such as UDP, TCP, RTP and SRM over wired and wireless (local and satellite) networks. It has many advantages that make it a useful tool, such as support for multiple protocols and the capability of graphically detailing network traffic. Additionally, NS2 supports several algorithms in routing and queuing. LAN routing and broadcasts are part of routing algorithms. Queuing algorithms include fair queuing, deficit round-robin and FIFO.
NS2 Simulator is a discrete event simulator for networks. It began as ns (Network Simulator) in 1989 with the purpose of general network simulation. The core of core of the simulator and most of the network protocol models are written in C ++, and the rest is in OTcl. In general, C++ is used for implementing protocols and extending the ns-2 library. OTcl is used to create and control the simulation environment itself, including the selection of output data. Simulation is run at the packet level, allowing for detailed results. NS2 Simulator provides OSI layers excluding presentation and session layers. It has a huge pool of available features, offering a large number of external protocols already implemented. Ns-2 does not scale well for sensor networks. This is in part due to its object-oriented design. While this is beneficial in terms of extensibility and organization, it is a hindrance on performance in environments with large numbers of nodes. Another drawback to NS2 Simulator is the lack of customization available. Packet formats, energy models, MAC protocols, and the sensing hardware models all differ from those found in most wireless devices.
Above figure shows the basic architecture of NS2 Simulator. NS2 Simulator supply 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 as an input argument of an NS2 Simulator executable command ns. In mostly cases, a simulation trace file is created, and is used to plot graph and/or to form animation.
NS2 Simulator is basically an Event/Packet based simulator:
Figure 1: Basic Architecture of Network Simulator 2
Above figure shows the basic architecture of NS2 Simulator. NS2 Simulator supply 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 as an input argument of an NS2 Simulator’s executable command ns. In mostly cases, a simulation trace file is created, and is used to plot graph and/or to form animation.
- Smallest entity in NS-2 is a packet, which is modelled as an event that is performed in definite point of time. Other events change the state of the nodes (movement, wake up, destroy)
- All events are strictly ordered by time, ordered in a list.
- Sequential execution:
- event is on top of event list
- (Change state of node or) decide if packet can be communicated from A to B:
- Compute transmission power received by B from A.
- The transmission succeeds if and only if propagation power > threshold value.
 Ibrahim F. Haddad and David Gordon, “Network Simulator 2: a Simulation Tool for Linux”, available online at: http://www.linuxjournal.com/article/5929
 Mehta, S., Sulatan Najnin, and K. S. Kwak, “Network and system simulation tools for next generation networks: a case study”, 2011.
 Vidhi and Ashish Malik, “Network Simulators: A Comparative Survey”, IOSR Journal of Electronics and Communication Engineering (IOSR-JECE), PP. 52-56