Ns2 Projects with source code

Ns2 Projects with source code

Ns2 Projects with source code – NS2, abbreviated as Network Simulator 2, is a fundamental of the network simulation tool. In short, it’s an event network simulator tool that is highly used in research and development.Ns2 is developed at UC Berkeley. Ns2 Projects contains a rich library of network and protocol objects.

Ns2 framework

   In which we are also going to discuss what is the languages to be used in ns2 projects as well as nam, graph details. Reach us, we provide ns2 projects with source code for research scholars from expert team.

Implementation of NS2 Projects with source code

Languages used in ns2

  • TCL:
    • Ns is a Tcl interpreter to run Tcl Scripts.
  • OTCL:
    • OTCL is used to control the simulation as well as to schedule discrete events.
    • Working procedure:
      • Tells traffic sources when to start/stop transmitting packets through the event scheduler
      • Initiates an event scheduler.
      • Sets up the network topology using the network objects.
  • C++:
    • C++ is used for defining the internals of NS2.
    • By using C++, the following program is written and compiled.
      • Basic network component objects.
      • Event scheduler.

   Supporting Tools Utilized in Ns2 Projects: There also two supporting tools also used in ns2 projects for providing output.

  • NAM
  • XGraph

NAM

  • It’s a network animator.
  • Nam is a Tcl/TK based animation tool for viewing network simulation traces and real-world packet traces.
  • The Network Animator (nam) is a completely separate program that is distributed with the NS simulator.
  • It supports topology layout, packet-level animation, and various data inspection tools.

Steps used for creating output file in nam

  • Create an output file.
  • Before running the simulation, activate the NAM trace feature in NS.
  • At the end of the simulation, close the output file.
  • Sample Ns2 Projects with source code of nam are as follows.

# (1) Create the trace file

 set namfile [open out.nam w]

 # (2) Tell NS to write NAM network events to this trace file

 $ns namtrace-all $namfile

 # (3) Close output file at the end of the simulation run

   proc finish {} {

      global ns namfile

      $ns flush-trace ;# flush trace files

      close $namfile ;# close trace file

      exec nam out.nam & ;# OPTIONAL: run NAM from inside the NS simulation  

      exit 0

   }

XGraph

   XGraph is a plotting program that is used to create graphic representations of simulation results. It is important because it allows some basic animation of data sets. The animation only pages through data sets in the order in which they loaded. It is quite crude, but useful if all the data sets in one file in the time order and are put out at uniform intervals.

XGraph includes the following

  • Animation and also derivatives.
  • Interactive plotting and also graphing.

Sample Ns2 Projects with source code for generating XGraph

  • Exec xgraph example.tr –geometry 700×500 

Protocols used in Ns2 Projects with source code

   The following protocols also to the combination of proactive, reactive, hybrid, and clustering protocols,

  • AODV
  • DSR
  • DSDV
  • MAODV
  • AOMDV
  • EGPSR
  • GPSR
  • W-MAC
  • S-MAC
  • T-MAC
  • Z-MAC
  • PEGASIS
  • LEACH
  • TEEN
  • R-MAC
  • Zigbee
  • Bluetooth
  • Bluestar
  • Star
  • TDMA
  • CDMA
  • SDMA
  • IZRP
  • ZRP
  • OLSR
  • HEED
  • BATMAN
  • SOP
  • ODMRP
  • DMRP
  • TORA
  • FL-AODV
  • and also SAFARI.

Attacks handled in ns2

  • DDOS.
  • DOS.
  • Blackhole attack.
  • Warm hole attack.
  • Jellyfish.
  • Grey hole attack.
  • Sybil attack.
  • Misbehaving nodes.
  • Selfish nodes.
  • Phishing attack.
  • False node misbehavior.
  • Man in the middle attack.
  • IP spoofing.
  • Ping of death.
  • Smurf attack.
  • ICMP attack.
  • Distributed attack.
  • Insider attack.
  • Close-in attack.
  • Trojan horse.
  • Viruses.
  • IP fragmentation attack.
  • SQL injection attack.
  • Port scanning.
  • Email spoofing.
  • Network sniffing.
  • DNS sniffing.
  • Social phishing.
  • Eavesdropping.
  • Application-layer attack.
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.