Network
Simulator is a piece of hardware or software that simulates and predicates the
behavior of a network without the presence of an actual network. Network
Simulator Version 2 (NS2) is an event driven network simulator, developed by UC
Berkely in 1995. It supports several algorithms for the routing and queuing of
network packets. Similar to internet it can set up packet traffic and measure
various network parameters. Simulators are heavily used in the ad-hoc
networking research and support several network protocols, offering simulation
results for wired as well as wireless networks.
NS2
is based on two languages, an object oriented simulator written in C++ and an
OTCL interpreter. NS2 has a rich library network and protocol objects. It can
be implemented in most UNIX systems as well as Windows. Most of the NS2 code is
in C++ and uses TCL as its scripting language. OTCL adds object orientation to
TCL.
In
NS2, the events are scheduled in a global event queue according to their time
of execution. When a simulation is run, the simulator removes events from the
head of the queue, moves the simulator time to that of the currently removed
events and executes it. When done, it continues to the next and so on. Each
simulation is defined by a scenario that contains a number of predefined events
that define the scenario. NS 2 scenarios are implemented in TCL scripts that
contain the command to initialize the simulator and to create the nodes and
their configuration. Each simulation run generates a trace file containing all
the data packets that are sent between the nodes during the course of the
scenario. By analyzing this trace file, it is possible to determine the
performance effect of parameter variations, various routing protocols, etc. A
simulation can be very useful since it is possible to scale the networks easily
and therefore to eliminate the need for time consuming and costly real world
examples. While the simulator is a powerful tool, it is important to remember
that the ability to do predictions in the real world is dependent on the
accuracy of the models in the simulator.
One
of the major problems that anyone faces while dealing with NS-2 is its
installation. The following section provides you with the installation guides:
Installing ns-2.35 in Ubuntu 12.04 LTS
As you know Ubuntu 12.04 launched on 26th April 2012 and it is a
Long Term Support OS. To install ns2 in Ubuntu 12.04, it refers the same step
as done in 11.10 OS. For new users, here
are the steps to install ns2.35:
Step 1: Download NS-2.35 from http://www.isi.edu/nsnam/ns/
Step 2: Go to terminal (Alt + t) and install the necessary
updates using the command
“sudo apt-get update”
(without Quotes)
Step 3: Install the ns2 required libraries using the command
“sudo apt-get install build-essential autoconf automake
libxmu-dev” (without quotes)
Step 4: Untar the downloaded ns-allinone-2.35.tar.gz file using
the command
“tar zxvf ns-allinone-2.35.tar.gz”
Step 5: Execute the commands one by one as given below
cd ns-allinone-2.35
./install
(You get the PATH information if the installation was
successful, upon succeeding set the PATH
in the relevant file .bashrc)
in the relevant file .bashrc)
Step 6: To set environment variables: (add the following lines
in .bashrc file)
export PATH=$PATH:/home/username*/ns-allinone-2.35/bin:/home/username*/
ns-allinone-2.35/tcl8.5.10/unix:/home/username*/ns-allinone-2.35/tk8.5.10/unix
ns-allinone-2.35/tcl8.5.10/unix:/home/username*/ns-allinone-2.35/tk8.5.10/unix
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/username*/
ns-allinone-2.35/otcl-1.14
ns-allinone-2.35/otcl-1.14
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/username*/
ns-allinone-2.35/lib
ns-allinone-2.35/lib
export TCL_LIBRARY_PATH=$TCL_LIBRARY_PATH:/home/username*/
ns-allinone-2.35/tcl8.5.10/library
ns-allinone-2.35/tcl8.5.10/library
(Notes*: Replace the username with your own)
Step 7: Finally execute the command:
source .bashrc
===================================================
Notes: Type ns and see a
% symbol indicates that the installation of ns2 is successful and also
try the command nam so that a network
animator will be opened. If you try to install ns2 which comes along with the synaptic
package manager, you cannot write new modules and recompile it. In that case,
you need to use the above method of installation.