How to Develop ODMRP Protocol Projects Using NS3

To develop the ODMRP (On-Demand Multicast Routing Protocol) for used NS3. In ns3 have various steps that have been given below, let’s get started.

Steps to Develop ODMRP Protocol Projects Using NS3

The On-Demand Multicast Routing Protocol (ODMRP) is mesh-based on multicast routing protocol intended for mobile ad-hoc networks (MANETs). Changed the tree-based multicast protocols, ODMRP:

✅ For used the flooding to launch the multicast routes.

✅ It function the on-demand manner (no control communication for periodic).

✅ We handle the soft-state approach (routes are expire if not refreshed).

  1. Setting up NS-3 for ODMRP

(a) Install and download the NS3 tool

sudo apt update

sudo apt install git g++ python3 python3-pip cmake

git clone

cd ns-3-dev

./ns3 configure –enable-examples –enable-tests

./ns3 build

  1. Implementing ODMRP in NS-3

NS3 does not offer the built-in ODMRP execution, so we essential to:

  1. Generate a new protocol class for ODMRP.
  2. Execute an ODMRP for manage the packet (Join Queries, Replies, and Data Forwarding).
  3. Incorporate an ODMRP in NS3 replication.

Step 1: Build an ODMRP Routing Class

State the odmrp-routing.h

#ifndef ODMRP_ROUTING_H

#define ODMRP_ROUTING_H

#include “ns3/ipv4-routing-protocol.h”

#include “ns3/node-container.h”

#include “ns3/ipv4-route.h”

#include “ns3/packet.h”

#include “ns3/socket.h”

class OdmrpRouting : public ns3::Ipv4RoutingProtocol {

public:

static ns3::TypeId GetTypeId(void);

OdmrpRouting();

virtual ~OdmrpRouting();

virtual ns3::Ptr<ns3::Ipv4Route> RouteOutput(

ns3::Ptr<ns3::Packet> packet,

const ns3::Ipv4Header &header,

ns3::Ptr<ns3::NetDevice> oif,

ns3::Socket::SocketErrno &sockerr) override;

virtual bool RouteInput(

ns3::Ptr<const ns3::Packet> packet,

const ns3::Ipv4Header &header,

ns3::Ptr<const ns3::NetDevice> idev,

UnicastForwardCallback ucb,

MulticastForwardCallback mcb,

LocalDeliverCallback lcb,

ErrorCallback ecb) override;

};

#endif // ODMRP_ROUTING_H

Step 2: Execute a ODMRP Packet Sending

Make an execution for this line odmrp-routing.cc

#include “odmrp-routing.h”

#include “ns3/log.h”

NS_LOG_COMPONENT_DEFINE(“OdmrpRouting”);

NS_OBJECT_ENSURE_REGISTERED(OdmrpRouting);

ns3::TypeId OdmrpRouting::GetTypeId(void) {

static ns3::TypeId tid = ns3::TypeId(“ns3::OdmrpRouting”)

.SetParent<ns3::Ipv4RoutingProtocol>()

.SetGroupName(“Internet”);

return tid;

}

OdmrpRouting::OdmrpRouting() {}

OdmrpRouting::~OdmrpRouting() {}

ns3::Ptr<ns3::Ipv4Route> OdmrpRouting::RouteOutput(

ns3::Ptr<ns3::Packet> packet, const ns3::Ipv4Header &header,

ns3::Ptr<ns3::NetDevice> oif, ns3::Socket::SocketErrno &sockerr) {

NS_LOG_INFO(“Performing ODMRP multicast routing for packet”);

return 0;

}

bool OdmrpRouting::RouteInput(

ns3::Ptr<const ns3::Packet> packet, const ns3::Ipv4Header &header,

ns3::Ptr<const ns3::NetDevice> idev,

UnicastForwardCallback ucb, MulticastForwardCallback mcb,

LocalDeliverCallback lcb, ErrorCallback ecb) {

NS_LOG_INFO(“Forwarding ODMRP packet using multicast flooding”);

return true;

}

Step 3: Incorporate the ODMRP in NS3 replication for this method

We build an odmrp-simulation.cc

#include “ns3/core-module.h”

#include “ns3/network-module.h”

#include “ns3/internet-module.h”

#include “ns3/mobility-module.h”

#include “ns3/ipv4-static-routing-helper.h”

#include “odmrp-routing.h”

using namespace ns3;

int main() {

NodeContainer nodes;

nodes.Create(5);

MobilityHelper mobility;

mobility.SetPositionAllocator(“ns3::GridPositionAllocator”,

“MinX”, DoubleValue(0.0),

“MinY”, DoubleValue(0.0),

“DeltaX”, DoubleValue(10.0),

“DeltaY”, DoubleValue(10.0),

“GridWidth”, UintegerValue(5),

“LayoutType”, StringValue(“RowFirst”));

mobility.Install(nodes);

InternetStackHelper stack;

stack.Install(nodes);

Ptr<OdmrpRouting> odmrpRouting = CreateObject<OdmrpRouting>();

nodes.Get(0)->AggregateObject(odmrpRouting);

Ipv4AddressHelper address;

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

address.Assign(NetDeviceContainer());

Simulator::Run();

Simulator::Destroy();

return 0;

}

Step 4: Compile and Run the Simulation

Compile the NS-3 project

./waf

It process for an execution of ODMRP replication

./waf –run “scratch/odmrp-simulation”

  1. Performance Evaluation of ODMRP

We calculate the multicast routing efficiency, we use FlowMonitor:

Ptr<FlowMonitor> flowMonitor;

FlowMonitorHelper flowHelper;

flowMonitor = flowHelper.InstallAll();

Simulator::Stop(Seconds(10.0));

Simulator::Run();

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

Run analysis

python3 analyze_results.py

  1. Example ODMRP Project Ideas in NS-3

1. Performance Analysis of ODMRP vs. AODV in MANETs

  • Associate the ODMRP by AODV unicast routing for packet delivery ratio and latency.

2. Secure ODMRP Implementation

  • Apply for encode in ODMRP to avoid the multicast route hijacking.

3. Energy-Efficient ODMRP in Wireless Sensor Networks

  • Change the ODMRP for used the energy-aware in multicast forwarding.

4. QoS-Aware ODMRP in 5G Networks

  • We improve the ODMRP for low-latency, high-bandwidth wireless networks.

5. ODMRP in Vehicular Ad-Hoc Networks (VANETs)

  • Apply the ODMRP for execute the real-time in vehicle-to-vehicle communication.

 

Here we discussed about how to implement the ODMRP in ns3 environment. It creates the protocol and executes the packet handling and gives the simulation outcomes. We also provide the related information for ODMRP.