How to Start ZRP Protocol Projects Using NS2
To start a Zone Routing Protocol (ZRP) project using Network Simulator 2 (NS2), we will need to replicate a routing protocol, which integrates the proactive routing inside a zone and reactive routing beyond the zone. ZRP is often utilised in mobile ad hoc networks (MANETs) including moderate node density.
NS2 doesn’t directly support for ZRP, but we can be replicated their behavior to utilise integrating proactive and reactive protocols or by prolonging the functionality of NS2.
Following is a stepwise method to get started:
Steps to Start ZRP Protocol Projects in NS2
- Understand ZRP and NS2 Capabilities
- ZRP Overview:
- A hybrid routing protocol, which minimizes the routing overhead.
- Intra-Zone Routing Protocol (IARP): Proactively sustains the routing inside the zone.
- Inter-Zone Routing Protocol (IERP): It reactively determines the paths among the zones.
- NS2 Features:
- It provides proactive protocols such as DSDV and reactive protocols as AODV and DSR.
- Extensible for replicating the behaviour of ZRP.
- Set Up NS2
- We can set up NS2 using below command line:
sudo apt-get install ns2
- Confirm installation by running an example script:
ns example.tcl
- Define the Project Scope
- Objectives:
- Replicate the ZRP within a dynamic or static topology.
- Examine the performance parameters such as packet delivery ratio, routing overhead, and delay.
- Then, equate ZRP including proactive like DSDV and reactive such as AODV protocols.
- Example Scenarios:
- Measure the performance of ZRP in high node mobility.
- Compute the zone radius’ effect on routing performance.
- Design the Network Topology
- Topology Elements:
- Nodes: It denotes MANET devices in network topology.
- Links: Connects wireless links with certain bandwidth and delay.
- Example Topology:
- It has 50 nodes with 1000m x 1000m area in which each node contains a 2-hop zone radius.
- Write the TCL Script
- We can integrate the NS2’s built-in proactive and reactive protocols for simulating ZRP using tcl script.
Example TCL Script for ZRP Simulation:
# Initialize the simulator
set ns [new Simulator]
# Define trace and NAM files
set tracefile [open zrp_trace.tr w]
$ns trace-all $tracefile
set namfile [open zrp_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
# Create nodes
set num_nodes 50
for {set i 0} {$i < $num_nodes} {incr i} {
set node($i) [$ns node]
$node($i) random-motion 1
}
# Set routing protocol (combine proactive and reactive)
proc configure_zrp {node} {
$node set proactive_routing_protocol “DSDV”
$node set reactive_routing_protocol “AODV”
$node set zone_radius 2
}
for {set i 0} {$i < $num_nodes} {incr i} {
configure_zrp $node($i)
}
# Define traffic
set tcp [new Agent/TCP]
set sink [new Agent/TCPSink]
$ns attach-agent $node(0) $tcp
$ns attach-agent $node(49) $sink
$ns connect $tcp $sink
set ftp [new Application/FTP]
$ftp attach-agent $tcp
$ns at 5.0 “$ftp start”
$ns at 15.0 “$ftp stop”
# Terminate simulation
$ns at 20.0 “finish”
proc finish {} {
global ns tracefile namfile
$ns flush-trace
close $tracefile
close $namfile
exec nam zrp_simulation.nam &
exit 0
}
$ns run
- Simulate Network Dynamics
- Node Mobility: Integrate the mobility patterns for analysing the ZRP within dynamic environments.
$node(0) setdest 500 500 20.0
$node(1) setdest 800 300 15.0
- Zone Radius Variations: Experiment various zone radii like1-hop, 2-hop, 3-hop.
- Run the Simulation
- We will need to run the TCL script simulation:
ns zrp_simulation.tcl
- Utilize NAM for envisioning the simulation:
nam zrp_simulation.nam
- Analyze Performance
- Examine the performance parameters by using trace file as zrp_trace.tr:
- Packet Delivery Ratio (PDR): We can measure the rate of packets which are effectively distributed.
- Routing Overhead: Assess the volume of control packets that are swapped for routing overhead.
- End-to-End Delay: Compute the average interval during packet delivery.
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;
}
- Enhance ZRP Functionality
- QoS Extensions: Integrate key aspects for Quality of Service extensions like give precedence to VoIP traffic.
- Security: Execute the encryption or authentication for control packets.
- Energy Optimization: Measure the ZRP within power-constrained networks like IoT.
- Document the Project
- It has complete specifies for this project like:
- Define the project goals and problem statement.
- Make a network topology and set up.
- Visualize the simulation outcomes using graphs, tables.
- Finally, it offers observations and references.
Here, we explained about the ZRP Protocol projects simulation in a step-by-step manner using NS2. Should you have any questions regarding this subject, we can provide supplementary manual.