How to Begin Implement a AOMDV protocol in NS3

To start executing the Ad hoc On-Demand Multipath Distance Vector (AOMDV) routing protocol using NS3, we have to make or replicate their behavior. While NS3 doesn’t have direct support for AOMDV, it can be executed by prolonging the existing AODV protocol.

Overview of AOMDV

AOMDV is a reactive routing protocol, during the route discovery process which constructs numerous disjoint or partly disjoint paths. It is specifically used in mobile ad hoc networks (MANETs) by reason of their fault tolerance and minimized latency for route recovery.

Key Components:

  1. Route Discovery:
    • Builds numerous loop-free and disjoint routes.
  2. Route Maintenance:
    • Modernizes or invalidates routes if failures exist.
  3. Route Selection:
    • It supports to select the optimal route according to the parameters such as hop count or delay.

Steps to Begin Implementing AOMDV 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 by executing a simple example simulation as ./waf –run hello-simulator.
  2. Include Required Modules:
    • Verify necessary components such as internet, wifi, mobility, and aodv are contained.
  1. Understand AOMDV Protocol Logic
  • AOMDV vs. AODV:
    • AOMDV prolongs AODV by supporting several routes among the source and destination node.
    • AOMDV accumulates alternate routes during route discovery.
    • Routes are proactively sustained to confirm reliability.
  1. Extend AODV to Support AOMDV
  2. Modify AODV Source Files
  1. Create a Custom Protocol:
    • Replicate the existing aodv module for instance name again it to aomdv.
    • Fine-tune the duplicated files for executing AOMDV logic.
  2. Modify Route Discovery:
    • Permit numerous routes to be saved for a destination within the routing table.
    • Modernize the AodvRoutingProtocol::RecvRequest() and RecvReply() functions for managing the alternate paths.
  3. Add Alternate Paths:
    • Prolong the RoutingTableEntry class to save several routes.

class RoutingTableEntry {

public:

std::vector<Ipv4Address> alternatePaths; // Store multiple next hops

};

  1. Route Maintenance:
    • Modernize route error handling (RecvError) to invalidate only the failed route and not the whole path.
  1. Integrate with ns3
  1. Register the Protocol:
    • Modernize the module to make sure that AOMDV is handled by detached routing protocol.

NS_OBJECT_ENSURE_REGISTERED(AomdvRoutingProtocol);

  1. Custom Packet Header:
    • Fine-tune the packet headers with data regarding numerous routes as required.
  1. Set Up Network Topology
  1. Create Nodes:
    • Describe the nodes for the ad hoc network.

NodeContainer nodes;

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

  1. Configure Wireless Links:
    • Replicate the wireless interaction with 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:
    • Mimic node mobility to leverage 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=20.0]”),

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

mobility.Install(nodes);

  1. Install Network Stack:
    • Integrate the network stack and the custom AOMDV protocol to each node.

InternetStackHelper internet;

AomdvHelper aomdv;

internet.SetRoutingHelper(aomdv);

internet.Install(nodes);

  1. Assign IP Addresses:
    • Allocate an unique IP addresses with Ipv4AddressHelper.

Ipv4AddressHelper ipv4;

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

ipv4.Assign(devices);

  1. Simulate Traffic
  1. Install Applications:
    • Make use of UDP or TCP applications to make traffic.

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(20));

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

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

ApplicationContainer clientApps = echoClient.Install(nodes.Get(0));

clientApps.Start(Seconds(2.0));

clientApps.Stop(Seconds(10.0));

  1. Monitor Traffic:
    • Examine the received packets to utilize PacketSink.

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 PCAP:
    • Seize packet-level insights for debugging.

wifiPhy.EnablePcapAll(“aomdv-simulation”);

  1. Enable ASCII Logging:
    • Record all routing and protocol events.

AsciiTraceHelper ascii;

wifiPhy.EnableAsciiAll(ascii.CreateFileStream(“aomdv-simulation.tr”));

  1. FlowMonitor:
    • Observe the traffic parameters like latency, throughput, and packet delivery ratio in FlowMonitor.

FlowMonitorHelper flowmon;

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

  1. Run the Simulation
  1. Start the Simulator:

Simulator::Run();

Simulator::Destroy();

  1. Export Results:
    • We will need to store FlowMonitor outcomes for in-depth analysis.

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

  1. Analyze and Visualize Results
  1. Traffic Analysis:
    • To estimate the performance of protocol using PCAP or FlowMonitor data.
  2. NetAnim Visualization:
    • Envision AOMDV routing behavior and numerous routes with NetAnim for visualization.

AnimationInterface anim(“aomdv-simulation.xml”);

  1. Extend and Optimize
  1. Dynamic Metrics:
    • Add dynamic indicators such as link reliability or bandwidth to route selection.
  2. Energy-Aware Routing:
    • Integrate the energy patterns for replicating the AOMDV within energy-constrained networks.
  3. Scalability:
    • Maximize the volume of nodes and also estimate the performance of protocol within large-scale scenarios.

Example Use Cases

  • MANETs:
    • Experiment the fault tolerance of AOMDV within dynamic topologies.
  • Disaster Recovery:
    • In infrastructure-less networks, we need to leverage AOMDV for robust interaction.
  • IoT Networks:
    • Make use of AOMDV within low-power, lossy networks including often network topology changes.

Through NS3 environment, we achieved detailed implementation method for AOMDV Protocol that was executed and analysed. We are equipped to expand it with any additional requirements.