How to Begin Implement a Fisheye Protocol in NS3

To execute the Fisheye State Routing (FSR) protocol in ns3, we will want to replicate a behavior through either altering the existing routing protocols such as OLSR or creating a custom protocol. FSR is a proactive routing protocol planned for mobile ad hoc networks (MANETs). It enhances the overhead through decrease the frequency of bring up-to-date for distant nodes, mimicking a fisheye lens’s approach: accurate specifics for close nodes and coarse details for distant nodes.

Here’s how to begin implementing FSR in ns-3:

Steps to Begin Implement a Fisheye Protocol in NS3

Overview of FSR

  1. Key Features:
    • It handles the routing tables by progressively bring up-to-date decrease the frequency for farther nodes.
    • Decreases the control message overhead for large networks.
    • Scalable for dense and dynamic networks.
  2. Challenges:
    • It needs a custom logic to handle bring up-to-date for frequencies and prioritize close nodes.

Steps to Implement FSR in ns-3

  1. Set Up ns-3 Environment
  1. Install ns-3:
    • Download and install ns-3 from the official site.
    • Validate the installation through processing a sample script: ./waf –run hello-simulator.
  2. Enable Required Modules:
    • Assure the components such as internet, wifi, mobility, and olsr for included the reference.
  1. Understand FSR Protocol Logic
  1. Routing Table Maintenance:
    • Periodically has replaced the routing bring up-to-date by neighbor.
    • Rate of bring up-to-date reduced by distance:
      • High frequency aimed at nearby nodes.
      • Low frequency designed for distant nodes.
  2. Routing Updates:
    • It forwarding the link-state information by sequence numbers to ensure freshness.
    • Prioritize bring up-to-date for nearer nodes.
  1. Extend or Create FSR in ns-3
  2. Custom Protocol Design
  1. Duplicate an Existing Protocol:
    • Matching a same proactive protocol such as OLSR and rename it to FSR.
  2. Modify Routing Table Logic:
    • Encompass the RoutingTable organization to embrace bring up-to-date a frequencies for different regions.

class FsrRoutingTableEntry {

public:

uint32_t sequenceNumber;  // Sequence number for freshness

Time updateFrequency;     // Update frequency for this node

};

  1. Set Update Intervals:
    • Divide nodes into zones based on hop counts and assign update intervals:
      • Zone 1 (1-hop neighbors): Many updates for instance 1 second.
      • Zone 2 (2–3 hops): Medium updates for sample 5 seconds.
      • Zone 3 (>3 hops): Irregular updates such as 15 seconds.
  2. Routing Table Updates:
    • Apply the function to periodically exchange bring up-to-date according to their zones.

void FsrRoutingProtocol::SendPeriodicUpdates() {

for (auto entry : m_routingTable) {

if (IsTimeToUpdate(entry)) {

BroadcastUpdate(entry);

}

}

}

  1. Packet Header:
    • Express the custom header to contain routing bring up-to-date.

class FsrHeader : public Header {

public:

void Serialize(Buffer::Iterator start) const override {

// Serialize routing update details

}

uint32_t Deserialize(Buffer::Iterator start) override {

// Deserialize routing update details

}

void Print(std::ostream &os) const override {

os << “FSR Update Header”;

}

};

  1. Set Up Network Topology
  1. Create Nodes:
    • Describe the nodes in the MANET.

NodeContainer nodes;

nodes.Create(20); // Create 20 nodes

  1. Configure Wireless Links:
    • We build a wireless ad hoc network use WifiHelper.

WifiHelper wifi;

wifi.SetStandard(WIFI_PHY_STANDARD_80211b);

YansWifiPhyHelper wifiPhy = YansWifiPhyHelper::Default();

YansWifiChannelHelper wifiChannel = YansWifiChannelHelper::Default();

wifiPhy.SetChannel(wifiChannel.Create());

WifiMacHelper wifiMac;

wifiMac.SetType(“ns3::AdhocWifiMac”);

NetDeviceContainer devices = wifi.Install(wifiPhy, wifiMac, nodes);

  1. Set Mobility:
    • Use MobilityHelper to simulate node movement.

MobilityHelper mobility;

mobility.SetPositionAllocator(“ns3::RandomRectanglePositionAllocator”,

“X”, StringValue(“ns3::UniformRandomVariable[Min=0.0|Max=100.0]”),

“Y”, StringValue(“ns3::UniformRandomVariable[Min=0.0|Max=100.0]”));

mobility.SetMobilityModel(“ns3::RandomWaypointMobilityModel”,

“Speed”, StringValue(“ns3::UniformRandomVariable[Min=1.0|Max=20.0]”),

“Pause”, StringValue(“ns3::ConstantRandomVariable[Constant=2.0]”));

mobility.Install(nodes);

  1. Install Network Stack:
    • Enhance the internet stack and execute for FSR.

InternetStackHelper internet;

FsrHelper fsr;

internet.SetRoutingHelper(fsr);

internet.Install(nodes);

  1. Assign IP Addresses:
    • It allocate the IP addresses to all nodes.

Ipv4AddressHelper ipv4;

ipv4.SetBase(“10.1.1.0”, “255.255.255.0”);

ipv4.Assign(devices);

  1. Simulate Traffic
  1. Install Applications:
    • We create the congestion to use UDP or TCP applications.

UdpEchoServerHelper echoServer(9);

ApplicationContainer serverApps = echoServer.Install(nodes.Get(19)); // Server at node 19

serverApps.Start(Seconds(1.0));

serverApps.Stop(Seconds(10.0));

UdpEchoClientHelper echoClient(Ipv4Address(“10.1.1.20”), 9);

echoClient.SetAttribute(“MaxPackets”, UintegerValue(10));

echoClient.SetAttribute(“Interval”, TimeValue(Seconds(1.0)));

echoClient.SetAttribute(“PacketSize”, UintegerValue(1024));

ApplicationContainer clientApps = echoClient.Install(nodes.Get(0)); // Client at node 0

clientApps.Start(Seconds(2.0));

clientApps.Stop(Seconds(10.0));

  1. Monitor Traffic:
    • Use PacketSink to gather and analyze the established packets.
  1. Enable Tracing
  1. Enable PCAP:
    • Seizure the packets for debugging.

wifiPhy.EnablePcapAll(“fisheye-protocol”);

  1. Enable ASCII Logging:
    • Log routing table bring up-to-date and protocol actions.

AsciiTraceHelper ascii;

wifiPhy.EnableAsciiAll(ascii.CreateFileStream(“fisheye-protocol.tr”));

  1. FlowMonitor:
    • Gather the performance metrics such as latency, throughput, and routing overhead.

FlowMonitorHelper flowmon;

Ptr<FlowMonitor> monitor = flowmon.InstallAll();

  1. Run the Simulation
  1. Start the Simulation:

Simulator::Run();

Simulator::Destroy();

  1. Export Results:
    • Store the outcomes for complete analysis.

monitor->SerializeToXmlFile(“fisheye-results.xml”, true, true);

  1. Analyze and Visualize Results
  1. Traffic Analysis:
    • Uses investigate for PCAP or FlowMonitor data to implement protocol efficiency.
  2. NetAnim Visualization:
    • Envision for FSR’s routing behavior.

AnimationInterface anim(“fisheye-protocol.xml”);

  1. Extend and Optimize
  1. Scalability:
    • Validate the FSR in large-scale networks by dense nodes.
  2. Dynamic Topology:
    • Replicate in a frequent topology variations to estimate protocol stability.
  3. Energy Awareness:
    • Improve energy design to allocate the FSR in energy-constrained surroundings.

Example Use Cases

  • MANETs:
    • Use FSR for scalable and effective routing in mobile networks.
  • IoT Networks:
    • Enhance the FSR for low-power, large-scale IoT deployments.
  • Disaster Recovery:
    • Estimate the FSR for robust communication in interrupted networks.

We demonstrated the basic process with detailed explanation for Fisheye State Routing protocols simulated and evaluated the results using the tool of ns3 tool and the additional details concerning this process will be added later.