How to Begin Implement a HWMP Protocol in NS3
To implement the Hybrid Wireless Mesh Protocol (HWMP) using NS3 which is a routing protocol that are described for IEEE 802.11s wireless mesh networks. It integrates on-demand (reactive) and proactive routing mechanisms to create it which is appropriated for dynamic mesh topologies. While HWMP is directly supported within ns3 since it is a portion of their mesh networking module, we will need to utilize inherent functionality for replicating the HWMP networks.
Below are sequential steps to executing HWMP in ns3:
Steps to Begin Implement a HWMP Protocol in NS3
- Understand HWMP
- Key Features:
- Hybrid routing: It integrates the on-demand that is reactive and proactive routing.
- It is intended for IEEE 802.11s wireless mesh networks.
- For route discovery and maintenance, utilizes Path Requests (PREQ), Path Replies (PREP), and Path Errors (PERR).
- Two Modes:
- Proactive Mode: Root node periodically propagates the routing data.
- Reactive Mode: Routes are determined on-demand.
- Set Up ns3 Environment
- Install ns3:
git clone https://gitlab.com/nsnam/ns-3-dev.git
cd ns-3-dev
./build.py
- Confirm the installation:
./ns3 run hello-simulator
- Plan the Mesh Network
- Components:
- Mesh points (MPs): It has basic units within the mesh network.
- Mesh portals (MPPs): MPs, which offer access to external networks.
- Root nodes: It performs like proactive routing sources.
- Topology:
- In the network, describe the MPs, MPPs, and root nodes placement.
- Set Up the HWMP Mesh in ns3
- Include Necessary Headers
#include “ns3/core-module.h”
#include “ns3/network-module.h”
#include “ns3/internet-module.h”
#include “ns3/mesh-module.h”
#include “ns3/mobility-module.h”
#include “ns3/applications-module.h”
- Define Nodes
ns3::NodeContainer meshNodes;
meshNodes.Create(10); // Create 10 mesh nodes
- Set Up Mobility
- Static Placement (Optional):
ns3::MobilityHelper mobility;
mobility.SetPositionAllocator(“ns3::GridPositionAllocator”,
“MinX”, ns3::DoubleValue(0.0),
“MinY”, ns3::DoubleValue(0.0),
“DeltaX”, ns3::DoubleValue(20.0),
“DeltaY”, ns3::DoubleValue(20.0),
“GridWidth”, ns3::UintegerValue(5),
“LayoutType”, ns3::StringValue(“RowFirst”));
mobility.SetMobilityModel(“ns3::ConstantPositionMobilityModel”);
mobility.Install(meshNodes);
- Dynamic Placement (Optional):
ns3::MobilityHelper mobility;
mobility.SetPositionAllocator(“ns3::RandomRectanglePositionAllocator”,
“X”, ns3::StringValue(“ns3::UniformRandomVariable[Min=0.0|Max=100.0]”),
“Y”, ns3::StringValue(“ns3::UniformRandomVariable[Min=0.0|Max=100.0]”));
mobility.SetMobilityModel(“ns3::RandomWaypointMobilityModel”);
mobility.Install(meshNodes);
- Configure the Mesh
- Set Up the Mesh Helper:
ns3::MeshHelper mesh;
mesh = ns3::MeshHelper::Default();
mesh.SetStackInstaller(“ns3::Dot11sStack”);
mesh.SetMacType(“RandomStart”, ns3::TimeValue(ns3::Seconds(0.1)));
mesh.SetNumberOfInterfaces(1);
- Install Mesh Devices:
ns3::NetDeviceContainer meshDevices = mesh.Install(meshNodes);
- Set Root Node (for proactive mode):
mesh.SetRoot(“00:00:00:00:00:01”); // Set MAC address of root node
- Set Up the Internet Protocol Stack
- Install the network stack:
ns3::InternetStackHelper internetStack;
internetStack.Install(meshNodes);
- Allocate an IP addresses:
ns3::Ipv4AddressHelper address;
address.SetBase(“10.1.1.0”, “255.255.255.0”);
ns3::Ipv4InterfaceContainer interfaces = address.Assign(meshDevices);
- Generate Traffic
- Install Applications
- UDP Echo Server:
ns3::UdpEchoServerHelper echoServer(9);
ns3::ApplicationContainer serverApp = echoServer.Install(meshNodes.Get(9)); // Server on node 9
serverApp.Start(ns3::Seconds(1.0));
serverApp.Stop(ns3::Seconds(20.0));
- UDP Echo Client:
ns3::UdpEchoClientHelper echoClient(interfaces.GetAddress(9), 9);
echoClient.SetAttribute(“MaxPackets”, ns3::UintegerValue(10));
echoClient.SetAttribute(“Interval”, ns3::TimeValue(ns3::Seconds(1.0)));
echoClient.SetAttribute(“PacketSize”, ns3::UintegerValue(512));
ns3::ApplicationContainer clientApp = echoClient.Install(meshNodes.Get(0)); // Client on node 0
clientApp.Start(ns3::Seconds(2.0));
clientApp.Stop(ns3::Seconds(20.0));
- Run the Simulation
ns3::Simulator::Run();
ns3::Simulator::Destroy();
- Analyze Results
Metrics:
- Packet Delivery Ratio (PDR):
- Estimate the percentage of packets that are effectively distributed.
- Latency:
- Compute the average delay for packet delivery.
- Routing Overhead:
- Measure the volume of control packets such as PREQ, PREP, PERR.
Tracing and Visualization:
- Allow .pcap tracing for packet analysis:
ns3::AsciiTraceHelper ascii;
mesh.EnableAsciiAll(ascii.CreateFileStream(“hwmp.tr”));
mesh.EnablePcapAll(“hwmp”);
- To envision the simulation outcomes using NetAnim:
./waf –run “hwmp-simulation –vis”
- Iterate and Enhance
- Advanced Scenarios:
- Replicate the node mobility or failures to experiment the robustness of protocol.
- Experiment scalability by maximizing the volume of nodes.
- Protocol Comparison:
- Equate the performance of HWMP including AODV, DSR, or other MANET routing protocols.
- Optimization:
- Integrate indicators such as energy utilization or link quality for improving the routing decisions.
These simple procedures in NS3 were used to implement the HWMP Protocol and analyse their outcomes. More specific insights will be included in upcoming manual.