How to start OLSR Protocol Projects Using NS2
To stimulate an OLSR (Optimized Link State Routing) protocol is a proactive routing protocol for MANETs (Mobile Ad-hoc Networks) which uses the periodic bring up-to-date for handle the routing tables and employs multipoint relays (MPRs) for decrease overhead. Here’s how to start an OLSR protocol project using NS2.
Steps to start OLSR Protocol Projects Using NS2
- Understand OLSR Protocol
- Key Features:
- Proactive: It handles the up-to-date for at all times in routing tables.
- MPRs: Nodes are choosing the forward control messages and decrease the overhead.
- Uses HELLO and TC (Topology Control) communications for neighbor and topology discovery.
- Appropriate for dense and highly dynamic networks.
- Define Your Project Goals
Select the concentrate for OLSR project:
- Performance Analysis:
- Estimate the parameter metrics such as packet delivery ratio (PDR), delay, and routing overhead.
- Protocol Optimization:
- Alter the OLSR for energy efficiency, scalability, or mobility.
- Comparison:
- Combine the OLSR through further protocols such as AODV, DSR.
- Security:
- Replicate and prevent the attacks such as black hole or wormhole.
- Advanced Scenarios:
- Validate the OLSR in IoT or VANET applications.
- Set up NS2
- Install NS2:
- Use tool like NS2.35 on a Linux-based system for compatibility.
- Verify Installation:
- Process for the simple replication script for assures the NS2 is functioning.
- Enable OLSR in NS2
OLSR is involved the NS2 through default, so we can directly use the replication.
- Create an OLSR Simulation Script
Write a TCL script for replicate OLSR in a network.
Example: Basic OLSR Simulation
- Set Up the Network:
set ns [new Simulator]
# Define trace and animation files
set tracefile [open olsr.tr w]
$ns trace-all $tracefile
set namfile [open olsr.nam w]
$ns namtrace-all $namfile
# Create nodes
set n1 [$ns node]
set n2 [$ns node]
set n3 [$ns node]
set n4 [$ns node]
# Create links between nodes
$ns duplex-link $n1 $n2 2Mb 10ms DropTail
$ns duplex-link $n2 $n3 2Mb 10ms DropTail
$ns duplex-link $n3 $n4 2Mb 10ms DropTail
- Configure OLSR:
- Setting the OLSR as the routing protocol:
set val(rp) OLSR ;# Use OLSR as the routing protocol
- Add Traffic Sources:
- Set-up the congestion data among their nodes:
set udp [new Agent/UDP]
$ns attach-agent $n1 $udp
set null [new Agent/Null]
$ns attach-agent $n4 $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 Node Mobility:
- Enhance the mobility for replicate a dynamic network:
$ns at 5.0 “$n1 setdest 100 200 10.0”
$ns at 10.0 “$n3 setdest 200 100 15.0”
- Run the Simulation:
- State the replication duration and complete the technique:
$ns at 50.0 “finish”
proc finish {} {
global ns tracefile namfile
$ns flush-trace
close $tracefile
close $namfile
exec nam olsr.nam &
exit 0
}
$ns run
- Analyze Results
Use the trace file (olsr.tr) for calculate the protocol’s performance.
Metrics to Analyze:
- Packet Delivery Ratio (PDR):
- Rate of successfully delivered packets:
awk ‘{if ($1 == “r” && $4 == “AGT”) recd++; if ($1 == “s” && $4 == “AGT”) sent++} END {print “PDR:”, recd/sent*100 “%”}’ olsr.tr
- End-to-End Delay:
- Estimate the average of delay for packets from the source to destination.
- Routing Overhead:
- Amount the number of control packets such as HELLO, TC messages:
awk ‘{if ($1 == “s” && $7 == “OLSR”) count++} END {print “Routing Overhead:”, count}’ olsr.tr
- Throughput:
- Calculate the amount of data successfully delivered the over time.
- Visualize Results
- Use NAM (Network Animator):
- Envision for NAM using the packet flow, routing bring up-to-date, and node mobility:
nam olsr.nam
- Plot Metrics:
- Use tools like Python, MATLAB, or Excel to graph metrics like as PDR vs. mobility or overhead vs. node density.
- Extend or Modify OLSR
OLSR’s execution can be encompassing the NS2.
File Structure for OLSR in NS2:
- Protocol Files:
- olsr.h and olsr.cc in the ns-2.35/olsr/ folder.
- Packet Headers:
- State in packet.h.
Example Modifications:
- Energy Efficiency:
- Increase the energy awareness for routing decisions through modifying olsr.cc.
- Custom MPR Selection:
- Modify the logic for choose the MPR it enhance the performance of dense networks.
- Attack Detection:
- Enhance the mechanisms for finding and prevent the black hole or wormhole attacks.
- Advanced Features
- Comparison with Other Protocols:
- Replicate the protocols such as AODV, DSR, and DSDV and associate the performance by OLSR.
- Energy-Efficient OLSR:
- Launch the energy metrics for choose the MPR.
- Security Enhancements:
- Execute the cryptographic methods for secure the OLSR messages.
- OLSR in IoT Networks:
- Validate on OLSR in low-power IoT environments.
- Mobility Analysis:
- Estimate the OLSR’s performance below various speeds of nodes.
- Document Your Project
Include:
- It prepares the objectives and problem definition.
- After the processes based on the problem according to the network topology and simulation parameters.
- Then previous process gives the simulation results for performance metrics.
- In end of the gives the insights and references for enhancements.
Example Project Ideas
- Performance Analysis of OLSR:
- Estimate the OLSR below various network densities and mobility design.
- Energy-Efficient OLSR:
- Alter the OLSR for decrease the energy usage in MANETs.
- Secure OLSR:
- Execute the secure MPR selection or encode for the HELLO messages.
- OLSR in IoT Applications:
- Validate the OLSR’s effectiveness in IoT environment by constrained devices.
- Comparative Study:
- Associate the OLSR by AODV, DSR, and other protocols.
We had entirely got an advanced knowledge about how to setup, configure and enable the Optimized Link State Routing in the tool of ns2 that effectively used to optimize the performance. Additional queries regarding this project will be addressed in another document.