How to Begin Implement a ZRP Protocol in NS3

To start implementing Zone Routing Protocol (ZRP) in NS3, which is a hybrid routing protocol that intended for ad hoc networks to integrate proactive and reactive mechanisms. To execute ZRP within ns3 that needs to incorporate the existing capabilities of NS3 such as proactive protocols like OLSR and reactive protocols like AODV including custom logic for handling zones and choosing when to utilize each protocol.

Overview of ZRP

  1. Intra-Zone Routing Protocol (IARP):
    • It sustains the routing tables proactively in a local zone of nodes.
    • Make use of proactive protocol such as OLSR.
  2. Inter-Zone Routing Protocol (IERP):
    • Reactively determines the routes among zones.
    • We need to utilize a reactive protocol in terms of AODV.
  3. Zone Radius:
    • It describes the zone size like hops.

Steps to Implement ZRP in ns3

  1. Set Up ns3 Environment
  1. Install ns3:
    • We should download and install ns3 on the system.
    • Make sure that we have set up NS3 by executing a simple simulation as ./waf –run hello-simulator.
  2. Include Required Modules:
    • Verify necessary modules such as olsr, aodv, internet, wifi, and mobility are included within ns3 build.
  1. Define the Network Topology
  1. Create Nodes:
    • Describe the nodes in network topology for the ad hoc network.

NodeContainer nodes;

nodes.Create(20); // 20 nodes in the network

  1. Configure Wireless Links:
    • Apply WifiHelper for configuring an ad hoc wireless network.

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:
    • Allow node movement with the support of MobilityHelper.

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=10.0]”),

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

mobility.Install(nodes);

  1. Install the Network Stack:
    • Integrate the internet stack of IP address to the nodes.

InternetStackHelper internet;

internet.Install(nodes);

  1. Implement Zone Logic
  1. Define the Zone Radius:
    • Specify the zone radius within hops.

uint32_t zoneRadius = 2; // Example: 2-hop zone radius

  1. Determine Zone Membership:
    • Sustain data regarding the nodes in the area to leverage neighbor discovery mechanisms or a proactive protocol such as OLSR.
  2. Handle Packets:
    • For packets within the zone:
      • Make use of proactive protocol like OLSR.
    • For packets beyond the zone:
      • Apply the reactive protocol such as AODV for determining routes.
  1. Enable Routing Protocols
  1. Proactive Protocol (IARP):
    • We will need to utilize routing protocol as OLSR for intra-zone routing.

OlsrHelper olsr;

Ipv4ListRoutingHelper list;

list.Add(olsr, 10); // Priority 10 for OLSR

  1. Reactive Protocol (IERP):
    • Exhaust routing protocol such as AODV for inter-zone routing.

AodvHelper aodv;

list.Add(aodv, 20); // Priority 20 for AODV

internet.SetRoutingHelper(list);

  1. Apply Routing to Nodes:
    • Allocate the integrated routing logic to every node.

internet.Install(nodes);

  1. Install Applications
  1. Simulate Traffic:
    • Observe and replicate traffic with the support of applications such as UdpEchoClient and UdpEchoServer.

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.19”), 9);

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

echoClient.SetAttribute(“Interval”, TimeValue(Seconds(1.0))); // Send every second

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:
    • Examine incoming packets with PacketSink for observing traffic.

PacketSinkHelper sinkHelper(“ns3::UdpSocketFactory”,

InetSocketAddress(Ipv4Address::GetAny(), 9));

ApplicationContainer sinkApps = sinkHelper.Install(nodes.Get(19));

sinkApps.Start(Seconds(1.0));

sinkApps.Stop(Seconds(10.0));

  1. Enable Tracing and Logging
  1. Enable Ascii Tracing:
    • Record routing and all packet events.

AsciiTraceHelper ascii;

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

  1. Enable PCAP Tracing:
    • Seize packets in Wireshark tools for detailed analysis.

wifiPhy.EnablePcapAll(“zrp-protocol”);

  1. Enable FlowMonitor:
    • Accumulate performance parameters utilising FlowMonitor.

FlowMonitorHelper flowmon;

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

  1. Run the Simulation
  1. Start the Simulation:
    • Execute the simulation and then monitor the ZRP’s behavior.

Simulator::Run();

Simulator::Destroy();

  1. Export Results:
    • For in-depth analysis, we need to store FlowMonitor data.

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

  1. Analyze and Visualize Results
  1. Traffic Analysis:
    • Measure the metrics like throughput, delay, and routing overhead leveraging PCAP or FlowMonitor data.
  2. NetAnim Visualization:
    • Transfer the simulation data using NetAnim tools for envisioning the behaviour of ZRP.

AnimationInterface anim(“zrp-animation.xml”);

  1. Extend and Optimize
  1. Dynamic Zone Radius:
    • According to the network conditions, execute the dynamic zone radius adjustment.
  2. Energy-Aware Routing:
    • Add energy models for estimating the effectiveness of ZRP within resource-constrained networks.
  3. Large-Scale Topologies:
    • Experiment the scalability of ZRP by maximizing the volume of nodes and zones.
  4. Security Enhancements:
    • Integrate mechanisms for defending the intra-zone and inter-zone interactions.

Example Use Cases

  • Ad Hoc Networks:
    • Enhance routing within Ad Hoc network which is dynamic and decentralized.
  • IoT Networks:
    • Apply ZRP for effective routing within dense IoT deployments.
  • Disaster Recovery:
    • For robust interaction, we can utilize ZRP in disrupted environments.

In this set up, we had thoroughly elucidating the basic implementation techniques that including set up the NS3, execution, visualization and analyse the ZRP Protocol and also we offered sample use cases and sample snippets in NS3 tool. Further details will be added later.