How to Start AODV Protocol Projects Using NS2

To start Ad-hoc On-demand Distance Vector (AODV) protocol projects using NS2 that has contains to configure a simulation for examining, altering or prolong the AODV protocol that is a reactive routing protocol utilised for MANETs (Mobile Ad-hoc Networks). Following is a sequential guidance to get started AODV protocol projects in NS2.

Steps to Start AODV Protocol Projects in NS2

  1. Understand AODV Protocol
  • AODV Characteristics:
    • Reactive (on-demand) protocol: These routes are generated only if required.
    • It helps to utilise the route discovery and maintenance processes.
    • Make use of sequence numbers for confirming the routes’ freshness.
    • Nodes don’t sustain the routing tables for all nodes, which supports to minimize the overhead.
  1. Define Your Project Goals

Focus on the certain project objective like:

  1. Performance Analysis:
    • We need to estimate the performance parameters such as packet delivery ratio, throughput, routing overhead, and delay for analysis.
  2. Protocol Optimization:
    • Fine-tune AODV protocol for enhancing their performance such as minimizes overhead, refines the energy efficiency.
  3. Attack Simulation:
    • Replicate and protect versus the simulation attacks like blackhole, wormhole.
  4. Real-World Scenarios:
    • Experiment the real-world AODV scenarios within urban mobility or IoT settings.
  1. Set Up NS2
  1. Install NS2:
    • We can set up NS2 using NS2.35 based on the OS like Linux for the best outcomes.
  2. Verify Installation:
    • We need to execute an example simulation script for verifying the NS2 environment is properly working.
  1. Create an AODV Simulation Script

While AODV is already contained within NS2 then we need to utilise it directly by means of setting it up in the TCL script.

Example: Basic AODV Simulation

  1. Set Up the Network Topology:
    • Make a network topology that contains nodes, links, and AODV which is routing protocol.

set ns [new Simulator]

# Define trace and animation files

set tracefile [open aodv.tr w]

$ns trace-all $tracefile

set namfile [open aodv.nam w]

$ns namtrace-all $namfile

# Create nodes

set n1 [$ns node]

set n2 [$ns node]

set n3 [$ns node]

  1. Configure AODV:
    • Set AODV which is a routing protocol:

set val(rp) AODV ;# AODV protocol

  1. Add Traffic Sources:
    • Integrate the UDP or TCP traffic sources for replicating data transfer.

set udp [new Agent/UDP]

$ns attach-agent $n1 $udp

set null [new Agent/Null]

$ns attach-agent $n3 $null

$ns connect $udp $null

set cbr [new Application/Traffic/CBR]

$cbr set packetSize_ 512

$cbr set interval_ 0.1

$cbr attach-agent $udp

  1. Define Mobility Patterns:
    • Replicate node movement for analysing the AODV mobility models within dynamic conditions.

$ns at 5.0 “$n1 setdest 100 200 10.0”

$ns at 10.0 “$n2 setdest 200 100 15.0”

  1. Run the Simulation:
    • Execute the simulation duration and compile it:

$ns at 50.0 “finish”

proc finish {} {

global ns tracefile namfile

$ns flush-trace

close $tracefile

close $namfile

exec nam aodv.nam &

exit 0

}

$ns run

  1. Analyze Results

Examine the outcomes using trace file (aodv.tr) for estimating the performance of the protocol.

Metrics to Evaluate:

  1. Packet Delivery Ratio (PDR):
    • Measure the rate of packets that are effectively distributed to the destination node.

awk ‘{if ($1 == “r” && $4 == “AGT”) recd++; if ($1 == “s” && $4 == “AGT”) sent++} END {print “PDR:”, recd/sent*100 “%”}’ aodv.tr

  1. End-to-End Delay:
    • Assess the average duration to move packets from source to destination node for packets.
  2. Routing Overhead:
    • We estimate the volume of control packets (e.g., RREQ, RREP) that are transmitting in the course of simulation.

awk ‘{if ($1 == “s” && $7 == “AODV”) print $0}’ aodv.tr | wc -l

  1. Throughput:
    • Compute the volume of data which are effectively sent over time.
  1. Visualize Results
  1. Use NAM (Network Animator):
    • We will need to envision the packet flow and node mobility applying NAM:

nam aodv.nam

  1. Plot Metrics:
    • Visualize the indicators such as PDR vs. mobility, delay vs. node density with the support of external tools like Python, MATLAB, or Excel.
  1. Extend or Modify AODV

We will change their C++ implementation using NS2 for tailoring the AODV protocol.

File Structure for AODV in NS2:

  • Protocol Definition:
    • We can define the protocol utilising aodv.h and aodv.cc in ns-2.35/adhoc/ folder.
  • Packet Header:
    • Fine-tune packet.h, integrating the fields for advanced aspects.
  • Route Logic:
    • Refine the route discovery or route maintenance logic within aodv.cc.

Example: Adding Energy Awareness

  1. Integrate a field within aodv.h for power levels:

double remaining_energy;

  1. Change the route selection logic choosing the nodes including higher energy using aodv.cc:

if (rt->remaining_energy > threshold) {

// Prefer this route

}

  1. Recompile NS2:

make clean

make

  1. Advanced Features
  1. Attack Simulation:
    • Replicate the attacks like blackhole, grayhole, or wormhole attacks and then estimate the resilience of AODV.
  2. Energy-Efficient AODV:
    • Alter the AODV protocol to represent the power levels of node.
  3. Scalability Analysis:
    • Experiment the AODV including high mobility within large networks for analysing the scalability.
  4. QoS-Aware AODV:
    • Improve AODV that supports to examine the Quality of Service parameters such as bandwidth and delay.
  5. Secure AODV:
    • Combine cryptographic mechanisms for defending the AODV route discovery.
  1. Compare AODV with Other Protocols

We will need to replicate the other protocols such as DSDV, DSR, and AOMDV, and also equate its performance with AODV in same circumstances.

  1. Document the Project

This project provides:

  1. Define the clear project goals and problem definition.
  2. Make a network topology and measure the simulation metrics.
  3. Estimate the performance parameters and its outcomes.
  4. Analysis and conclusions.
  5. Potential enhancements.

Example Project Ideas

  1. Performance Analysis of AODV:
    • We can estimate the AODV performance in diverse node mobility and density for analysis.
  2. Energy-Efficient AODV:
    • Launch an energy-aware route selection for AODV protocol.
  3. Attack Resilient AODV:
    • Replicate the attacks such as blackhole and intend countermeasures for resilience of AODV.
  4. IoT Applications:
    • Execute the AODV within an IoT applications scenario and experiment their performance.
  5. AODV in VANETs:
    • We will want to experiment the AODV for vehicular ad-hoc networks.

Here, we demonstrated a basic simulation approach with example coding for replicating and analysing the AODV Protocol projects through NS2 tools. More specific details will be included later.