How to Start TORA Protocol Projects Using NS2

To start a Temporally Ordered Routing Algorithm (TORA) project using NS2 (Network Simulator 2) which encompasses to replicate the TORA, a reactive and distributed routing protocol which are utilised for mobile ad hoc networks (MANETs). NS2 has built-in support for TORA, but it needs to allow the protocol within simulation script and set up the network topology for analysing their aspects like route discovery and maintenance.

We will guide you through following steps how to start and simulate the TORA Protocol projects using NS2:

Steps to Start TORA Protocol Projects in NS2

  1. Understand TORA and NS2 Capabilities
  • TORA Overview:
    • It is a highly adaptive routing protocol intended for dynamic networks.
    • It only sustains routes since they are required.
    • Consumes the directed acyclic graphs (DAGs) concept for routing.
  • NS2 Support:
    • TORA is directly supported within NS2.
    • It has configuring wireless nodes and indicating the TORA which is a routing protocol.
  1. Set Up NS2
  • Install NS2:

sudo apt-get install ns2

  • Confirm NS2 installation including sample script:

ns example.tcl

  1. Define the Project Scope
  • Objectives:
    • Replicate the TORA within a dynamic topology.
    • Estimate the performance parameters such as packet delivery ratio, routing overhead, and delay.
    • Then, we can equate the performance of TORA with other reactive protocols such as AODV or DSR.
  • Example Scenarios:
    • Replicate the TORA within a highly mobile environment.
    • Launch link failures and then examine the route recovery.
  1. Design the Network Topology
  • Topology Elements:
    • Nodes: It has movable wireless nodes.
    • Links: Wireless links including certain bandwidth and delay metrics.
  • Example Topology:
    • It has network containing 20 nodes within a 1000m x 1000m area that arbitrarily transferring moving randomly.
  1. Write the TCL Script
  • Set the simulation in tcl script with TORA which is a routing protocol.

Example TCL Script for TORA Simulation:

# Initialize the simulator

set ns [new Simulator]

# Define trace and NAM files

set tracefile [open tora_trace.tr w]

$ns trace-all $tracefile

set namfile [open tora_simulation.nam w]

$ns namtrace-all-wireless $namfile 1000 1000

# Configure wireless topology

set val(chan)           Channel/WirelessChannel

set val(prop)           Propagation/TwoRayGround

set val(netif)          Phy/WirelessPhy

set val(mac)            Mac/802_11

set val(ifq)            Queue/DropTail/PriQueue

set val(ll)             LL

set val(ant)            Antenna/OmniAntenna

set val(x)              1000

set val(y)              1000

set val(ifqlen)         50

set val(seed)           1.0

# Create nodes

set num_nodes 20

for {set i 0} {$i < $num_nodes} {incr i} {

set node($i) [$ns node]

$node($i) random-motion 1

}

# Set routing protocol to TORA

$ns rtproto TORA

# Configure mobility

$ns at 0.0 “$node(0) setdest 500 500 10.0”

$ns at 0.5 “$node(1) setdest 700 300 15.0”

$ns at 1.0 “$node(2) setdest 300 600 20.0”

# Define traffic

set tcp [new Agent/TCP]

set sink [new Agent/TCPSink]

$ns attach-agent $node(0) $tcp

$ns attach-agent $node(19) $sink

$ns connect $tcp $sink

set ftp [new Application/FTP]

$ftp attach-agent $tcp

$ns at 2.0 “$ftp start”

$ns at 12.0 “$ftp stop”

# Terminate simulation

$ns at 15.0 “finish”

proc finish {} {

global ns tracefile namfile

$ns flush-trace

close $tracefile

close $namfile

exec nam tora_simulation.nam &

exit 0

}

$ns run

  1. Simulate Network Dynamics
  • Node Mobility: Describe the movement models for analysing the flexibility of TORA.

$node(3) setdest 800 200 12.0

$node(4) setdest 100 400 15.0

  • Link Failures: Replicate link failures to experiment the route maintenance of TORA.

$ns rtmodel-at 5.0 down $node(2) $node(3)

$ns rtmodel-at 7.0 up $node(2) $node(3)

  1. Run the Simulation
  • Now, we can run the TCL script simulation in NS2:

ns tora_simulation.tcl

  • We need to apply NAM for envisioning the network:

nam tora_simulation.nam

  1. Analyze Performance
  • From the trace file as tora_trace.tr, we can obtain performance parameters:
    • Packet Delivery Ratio (PDR): Estimate the rate of packets which are efficiently distributed.
    • Routing Overhead: Count the volume of control packets that are swapped for routing overhead.
    • End-to-End Delay: Measure the average delay, attaining the destination nodes for packets.

Example AWK Script for PDR:

BEGIN {sent=0; received=0;}

{

if ($1 == “s” && $4 == “TCP”) {

sent++;

} else if ($1 == “r” && $4 == “TCP”) {

received++;

}

}

END {

print “Packet Delivery Ratio:”, received/sent;

}

  1. Enhance TORA Functionality
  • Security Enhancements: Integrate the encryption or authentication for enhancing the routing messages.
  • Energy Optimization: Experiment TORA within power-constrained networks like IoT.
  • QoS Support: Prolong TORA give precedence to particular traffic types such as VoIP.
  1. Document the Project
  • It has detailed insights such as:
    • Clear problem statement and objectives.
    • Define network topology and sets up.
    • Envision the simulation outcomes using graphs, tables.
    • Observations and references.

In this simulation, NS2 environment provided a comprehensive simulation process for TORA Protocol projects, allowing us to fulfill project requirements and we can extend it as additional needs arise.