To simulate Fisheye State Routing (FSR) using NS2 that has needs to contain several steps using NS2, which is a proactive, link-state routing protocol created for mobile ad-hoc networks (MANETs). This protocol minimizes overhead by periodically swapping partial link-state data among neighbouring nodes that utilizing a “fisheye” view to maintain more precise routing information for nearby nodes even though progressively less accurate information is stored for distant nodes.
Now, we offer step-by-step instruction to replicate Fisheye State Routing (FSR) protocol projects using NS2:
Steps to Simulate Fisheye Protocol Projects in NS2
- Install NS2
Make certain that NS2 is installed on the computer. We can download NS2 from the official NS2 website.
- FSR Protocol in NS2
FSR protocol is not a default protocol within NS2, however there are extensions and patches obtainable, which execute FSR. If we need to discover an FSR patch for NS2 then we can install it as follows:
Steps to Apply an FSR Patch (If Available):
- Download the FSR patch.
- Apply the patch to the NS2 installation:
cd ns-allinone-2.35/ns-2.35/
patch -p1 < fsr-patch.diff
- Rebuild NS2:
./configure
make clean
make
If no patch is obtainable then we can be replicated the simple behaviour of FSR using a manual approach in which routing updates are transmitted with a “fisheye” view principle, where nodes handle more accurate state information for nearby nodes.
- Set Up FSR Network Topology
FSR is specifically helpful in MANETs, so we will be required to make a mobile network with nodes, which can communicate with each other. The following is an instances to configure for a mobile ad-hoc network in NS2.
Example TCL Script for Basic FSR Topology:
# Create a new simulator instance
set ns [new Simulator]
# Define trace and nam files for logging and visualization
set tracefile [open fsr_simulation.tr w]
$ns trace-all $tracefile
set namfile [open fsr_simulation.nam w]
$ns namtrace-all $namfile
# Set up network parameters (wireless channel, propagation, MAC, etc.)
set val(chan) Channel/WirelessChannel ;# Channel type
set val(prop) Propagation/TwoRayGround ;# Propagation model
set val(netif) Phy/WirelessPhy ;# Network interface type
set val(mac) Mac/802_11 ;# MAC type
set val(ifq) Queue/DropTail/PriQueue ;# Interface queue type
set val(ll) LL ;# Link layer type
set val(ant) Antenna/OmniAntenna ;# Antenna type
set val(x) 1000 ;# X dimension (in meters)
set val(y) 1000 ;# Y dimension (in meters)
# Configure nodes to use FSR (or simulate FSR behavior manually)
$ns node-config -adhocRouting FSR \
-llType $val(ll) \
-macType $val(mac) \
-ifqType $val(ifq) \
-ifqLen 50 \
-antType $val(ant) \
-propType $val(prop) \
-phyType $val(netif) \
-channelType $val(chan)
# Create nodes (nodes for a mobile ad-hoc network)
set n0 [$ns node]
set n1 [$ns node]
set n2 [$ns node]
set n3 [$ns node]
set n4 [$ns node]
# Set initial positions for nodes
$n0 set X_ 50; $n0 set Y_ 50; $n0 set Z_ 0.0
$n1 set X_ 200; $n1 set Y_ 100; $n1 set Z_ 0.0
$n2 set X_ 300; $n2 set Y_ 300; $n2 set Z_ 0.0
$n3 set X_ 500; $n3 set Y_ 400; $n3 set Z_ 0.0
$n4 set X_ 700; $n4 set Y_ 500; $n4 set Z_ 0.0
# Optionally, enable mobility for the nodes (if required for MANET)
$ns at 5.0 “$n0 setdest 400 300 15.0” ;# Move node n0 to a new destination at 15 m/s
$ns at 7.0 “$n1 setdest 500 350 10.0” ;# Move node n1 to a new destination at 10 m/s
- Set Up Traffic Between Nodes
We can mimic TCP or UDP traffic among the nodes to monitor how FSR routes packets over the network. Here’s an instance to configure both TCP and UDP traffic flows.
Example for TCP Traffic:
# Set up TCP connection between node 0 and node 4
set tcp0 [new Agent/TCP]
set sink0 [new Agent/TCPSink]
$ns attach-agent $n0 $tcp0
$ns attach-agent $n4 $sink0
$ns connect $tcp0 $sink0
# Create FTP traffic over TCP
set ftp0 [new Application/FTP]
$ftp0 attach-agent $tcp0
$ns at 2.0 “$ftp0 start”
$ns at 10.0 “$ftp0 stop”
Example for UDP Traffic (CBR):
# Set up UDP communication between node 1 and node 3
set udp0 [new Agent/UDP]
set null0 [new Agent/Null]
$ns attach-agent $n1 $udp0
$ns attach-agent $n3 $null0
# Generate CBR traffic over UDP
set cbr0 [new Application/Traffic/CBR]
$cbr0 set packetSize_ 512
$cbr0 set rate_ 100kb
$cbr0 attach-agent $udp0
$ns at 3.0 “$cbr0 start”
$ns at 12.0 “$cbr0 stop”
- Run the Simulation
When we have described the FSR network and traffic configuration, we need to save the TCL script (e.g., fsr_simulation.tcl) and execute it using NS2:
ns fsr_simulation.tcl
It will generate a trace file (.tr) and a NAM file (.nam) for envisioning the simulation utilizing Network Animator (NAM).
- Analyze the Simulation Results
We can utilize AWK or Python scripts to examine the outcomes that concentrating on performance parameters like packet delivery ratio (PDR), end-to-end delay, and routing overhead.
Example AWK Script for Packet Delivery Ratio:
BEGIN { sent = 0; received = 0; }
{
if ($1 == “s” && $4 == “AGT”) { sent++; }
if ($1 == “r” && $4 == “AGT”) { received++; }
}
END { print “Packet Delivery Ratio = “, received/sent*100, “%”; }
We can also envision the routing of packets within NAM to monitor how FSR executes based on route maintenance and updates.
- Example Project Ideas for FSR Simulation
- Performance Comparison of FSR vs. OLSR:
- Replicate both FSR and OLSR in the similar network and relate their performance such as packet delivery, end-to-end delay, and routing overhead.
- Impact of Node Density on FSR Performance:
- Investigate how FSR’s performance modifies as we maximize or minimize the amount of nodes in the network.
- FSR in Mobile Networks:
- Mimic a highly mobile network using FSR and then examine how it manages route changes because of node movement.
- FSR Scalability Study:
- Replicate large-scale networks utilizing FSR and compute its scalability such as routing overhead and convergence time.
The network simulator NS2 enabled the simulation process and sample projects ideas for Fisheye Protocol, replicated and analysed its outcomes. More informations available for a deeper exploration on this topic, if necessary. phdprime.com provide complete guidelines to assist you in replicating Fisheye Protocol Projects utilizing NS2, tailored to your specific requirements.