How Much Time Will It Take For A Beginner To Learn NS2 Simulator

How Much Time Will It Take For A Beginner To Learn NS2 Simulator

What is NS2?

NS2 stands for Network Simulator Version 2. The NS2 is one of the open-source event-driven simulator. We will perform the  computer communication networks based research simulation projects by using the nS2 tool. By use the ns2 we can perform the code for protocols like TCP, FTP, UDP, https and DSR in the simulation. We can perform the   both wired and wireless network simulation projects in the simulation tool NS2. For make a simulation we will using TCL , which is one of the scripting language and also use the Otcl as a Object oriented support.

TCL Language

In ns2 we will create a code in the tcl file. The Tcl file have a code for the network configuration details, like the routing protocol details, channel details , number of node and propagation model details and also other configuration details. The tcl file is save with the file extension .tcl.

The sample code for the tcl is

set val(chan)      Channel/WirelessChannel

set val(prop)      Propagation/TwoRayGround

set val(ant)         Antenna/OmniAntenna

set val(ll)             LL

set val(ifq)           Queue/DropTail/PriQueue

set val(ifqlen)     50

set val(netif)       Phy/WirelessPhy

set val(mac)       Mac/802_11

set val(rp)           AODV

set val(nn)           25

set val(x)             1000

set val(y)             1000

set val(stop)       15.0

set val(traffic)        cbr

set pckstr                             1

set val(traffic)        tcp

set ns_                [new Simulator]

set tracefd          [open Wireless_Node.tr w]

set namtrace                     [open Wireless_Node.nam w]

…………

If you familiar in the scripting oriented code area, then you can easily develop the ns2 basic simulation process , with the default code configuration for make a sample SDN network topology  and perform the normal data transmission.

If you not familiar, then don’t fear, you need to just learn about the basic class for the configurations, for example Channel/WirelessChannel for channel allocation , Propagation/TwoRayGround for propagation model and Antenna/OmniAntenna for antenna details. During the configuration you need to create a object for these class and call the objects based on your requirement. After that you easily develop the simulation.

Source file

In the ns2 simulation the source files are the another kind of files, the files are stored with the file extension .cc and .h. in the source files , we will create a source code for make concept oriented process. By use the NS2 source files, we can specify the code for make routing based process, like aodv, dsdv, dsr and other protocols. And also make a code for other process , like the encryption/decryption process, attacker detection process and others. The sample code is,

#include <aodv/aodv.h>

#include <aodv/aodv_packet.h>

#include <random.h>

#include <cmu-trace.h>

#define max(a,b)        ( (a) > (b) ? (a) : (b) )

#define CURRENT_TIME    Scheduler::instance().clock()

static int route_request = 0;

int hdr_aodv::offset_;

static class AODVHeaderClass : public PacketHeaderClass {

public:

    AODVHeaderClass() : PacketHeaderClass(“PacketHeader/AODV”,

                                              sizeof(hdr_all_aodv)) {

                  bind_offset(&hdr_aodv::offset_);

                }

} class_rtProtoAODV_hdr;

The source files are based on the c++ based code structure. By use this files , we can easily import/include the needed other process files. So if you familiar in the familiar in the c++ language oriented code area , then you can easily develop the any kind of network simulation process by using NS2.

Live Tasks
Technology Ph.D MS M.Tech
NS2 75 117 95
NS3 98 119 206
OMNET++ 103 95 87
OPNET 36 64 89
QULANET 30 76 60
MININET 71 62 74
MATLAB 96 185 180
LTESIM 38 32 16
COOJA SIMULATOR 35 67 28
CONTIKI OS 42 36 29
GNS3 35 89 14
NETSIM 35 11 21
EVE-NG 4 8 9
TRANS 9 5 4
PEERSIM 8 8 12
GLOMOSIM 6 10 6
RTOOL 13 15 8
KATHARA SHADOW 9 8 9
VNX and VNUML 8 7 8
WISTAR 9 9 8
CNET 6 8 4
ESCAPE 8 7 9
NETMIRAGE 7 11 7
BOSON NETSIM 6 8 9
VIRL 9 9 8
CISCO PACKET TRACER 7 7 10
SWAN 9 19 5
JAVASIM 40 68 69
SSFNET 7 9 8
TOSSIM 5 7 4
PSIM 7 8 6
PETRI NET 4 6 4
ONESIM 5 10 5
OPTISYSTEM 32 64 24
DIVERT 4 9 8
TINY OS 19 27 17
TRANS 7 8 6
OPENPANA 8 9 9
SECURE CRT 7 8 7
EXTENDSIM 6 7 5
CONSELF 7 19 6
ARENA 5 12 9
VENSIM 8 10 7
MARIONNET 5 7 9
NETKIT 6 8 7
GEOIP 9 17 8
REAL 7 5 5
NEST 5 10 9
PTOLEMY 7 8 4

Workflow

YouTube Channel

Unlimited Network Simulation Results available here.