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
- 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.
- Define Your Project Goals
Focus on the certain project objective like:
- Performance Analysis:
- We need to estimate the performance parameters such as packet delivery ratio, throughput, routing overhead, and delay for analysis.
- Protocol Optimization:
- Fine-tune AODV protocol for enhancing their performance such as minimizes overhead, refines the energy efficiency.
- Attack Simulation:
- Replicate and protect versus the simulation attacks like blackhole, wormhole.
- Real-World Scenarios:
- Experiment the real-world AODV scenarios within urban mobility or IoT settings.
- Set Up NS2
- Install NS2:
- We can set up NS2 using NS2.35 based on the OS like Linux for the best outcomes.
- Verify Installation:
- We need to execute an example simulation script for verifying the NS2 environment is properly working.
- 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
- 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]
- Configure AODV:
- Set AODV which is a routing protocol:
set val(rp) AODV ;# AODV protocol
- 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
- 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”
- 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
- Analyze Results
Examine the outcomes using trace file (aodv.tr) for estimating the performance of the protocol.
Metrics to Evaluate:
- 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
- End-to-End Delay:
- Assess the average duration to move packets from source to destination node for packets.
- 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
- Throughput:
- Compute the volume of data which are effectively sent over time.
- Visualize Results
- Use NAM (Network Animator):
- We will need to envision the packet flow and node mobility applying NAM:
nam aodv.nam
- 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.
- 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
- Integrate a field within aodv.h for power levels:
double remaining_energy;
- Change the route selection logic choosing the nodes including higher energy using aodv.cc:
if (rt->remaining_energy > threshold) {
// Prefer this route
}
- Recompile NS2:
make clean
make
- Advanced Features
- Attack Simulation:
- Replicate the attacks like blackhole, grayhole, or wormhole attacks and then estimate the resilience of AODV.
- Energy-Efficient AODV:
- Alter the AODV protocol to represent the power levels of node.
- Scalability Analysis:
- Experiment the AODV including high mobility within large networks for analysing the scalability.
- QoS-Aware AODV:
- Improve AODV that supports to examine the Quality of Service parameters such as bandwidth and delay.
- Secure AODV:
- Combine cryptographic mechanisms for defending the AODV route discovery.
- 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.
- Document the Project
This project provides:
- Define the clear project goals and problem definition.
- Make a network topology and measure the simulation metrics.
- Estimate the performance parameters and its outcomes.
- Analysis and conclusions.
- Potential enhancements.
Example Project Ideas
- Performance Analysis of AODV:
- We can estimate the AODV performance in diverse node mobility and density for analysis.
- Energy-Efficient AODV:
- Launch an energy-aware route selection for AODV protocol.
- Attack Resilient AODV:
- Replicate the attacks such as blackhole and intend countermeasures for resilience of AODV.
- IoT Applications:
- Execute the AODV within an IoT applications scenario and experiment their performance.
- 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.