How to Start HWMP Protocol Projects Using NS3

To start Hybrid Wireless Mesh Protocol (HWMP) using NS3 that is a routing protocol created for IEEE 802.11s-based wireless mesh networks. HWMP functions like portion of the Mesh Networking Standard (IEEE 802.11s) to integrate proactive and reactive routing determining the paths within mesh networks. NS3 environment offers for HWMP via their IEEE 802.11s mesh modules that permitting to configure the HWMP-based mesh networks and then test with various sets up.

We will guide you how to configure an HWMP-based mesh network through step-by-step approach in NS3.

Step-by-Step Guide to Setting Up an HWMP Network in NS3

  1. We configure nodes including IEEE 802.11s mesh capabilities to make a wireless mesh network.
  2. For the mesh network, allow HWMP like the routing protocol.
  3. Set and configure a basic application making traffic over the network and then monitor how HWMP transmits packets.

Step 1: Create a New Script for HWMP Simulation

In the NS3’s scratch directory, we can save the below code like hwmp_simulation.cc. This instance configures a basic mesh network to utilise HWMP like the routing protocol.

Example Code for hwmp_simulation.cc

#include “ns3/core-module.h”

#include “ns3/network-module.h”

#include “ns3/internet-module.h”

#include “ns3/mobility-module.h”

#include “ns3/wifi-module.h”

#include “ns3/mesh-module.h”

#include “ns3/applications-module.h”

using namespace ns3;

NS_LOG_COMPONENT_DEFINE(“HwmpSimulation”);

int main(int argc, char *argv[]) {

LogComponentEnable(“HwmpSimulation”, LOG_LEVEL_INFO);

// Create nodes for the mesh network

NodeContainer meshNodes;

meshNodes.Create(5); // Example with 5 mesh nodes

// Configure WiFi for 802.11s mesh

YansWifiChannelHelper wifiChannel = YansWifiChannelHelper::Default();

YansWifiPhyHelper wifiPhy = YansWifiPhyHelper::Default();

wifiPhy.SetChannel(wifiChannel.Create());

WifiHelper wifi;

wifi.SetStandard(WIFI_STANDARD_80211s);

MeshHelper mesh = MeshHelper::Default();

mesh.SetStackInstaller(“ns3::Dot11sStack”);

mesh.SetSpreadInterfaceChannels(MeshHelper::SPREAD_CHANNELS);

mesh.SetMacType(“RandomStart”, TimeValue(Seconds(0.1)));

mesh.SetNumberOfInterfaces(1);

// Install mesh devices on all nodes

NetDeviceContainer meshDevices = mesh.Install(wifiPhy, meshNodes);

// Install Internet stack on the nodes

InternetStackHelper internetStack;

internetStack.Install(meshNodes);

// Assign IP addresses to the mesh devices

Ipv4AddressHelper ipv4;

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

Ipv4InterfaceContainer interfaces = ipv4.Assign(meshDevices);

// Configure mobility for the nodes

MobilityHelper mobility;

mobility.SetPositionAllocator(“ns3::GridPositionAllocator”,

“MinX”, DoubleValue(0.0),

“MinY”, DoubleValue(0.0),

“DeltaX”, DoubleValue(50.0),

“DeltaY”, DoubleValue(50.0),

“GridWidth”, UintegerValue(3),

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

mobility.SetMobilityModel(“ns3::ConstantPositionMobilityModel”);

mobility.Install(meshNodes);

// Set up a UDP echo server on the last node

UdpEchoServerHelper echoServer(9);

ApplicationContainer serverApps = echoServer.Install(meshNodes.Get(4));

serverApps.Start(Seconds(1.0));

serverApps.Stop(Seconds(10.0));

// Set up a UDP echo client on the first node to communicate with the server

UdpEchoClientHelper echoClient(interfaces.GetAddress(4), 9);

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

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

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

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

clientApps.Start(Seconds(2.0));

clientApps.Stop(Seconds(10.0));

// Enable routing table printing for HWMP

Simulator::Schedule(Seconds(5.0), &Ipv4L3Protocol::PrintRoutingTable, meshNodes.Get(0)->GetObject<Ipv4L3Protocol>(), Create<OutputStreamWrapper>(&std::cout));

Simulator::Run();

Simulator::Destroy();

return 0;

}

Explanation of the Code

  • Mesh Network Configuration:
    • We can utilise MeshHelper to set IEEE 802.11s mesh networking, to allow HWMP as per routing protocol.
    • Use SetStackInstaller(“ns3::Dot11sStack”) installs the 802.11s stack that contains HWMP.
    • The mesh utilises the SPREAD_CHANNELS option distributing the interaction over available channels, to improve network resilience.
  • IP Address Assignment:
    • For higher-layer interaction, IP addresses are allocated to each node within the mesh network.
  • Mobility:
    • Use ConstantPositionMobilityModel, nodes are located within a grid layout that denotes nodes are static however it located advantageously.
  • UDP Echo Application:
    • A UDP Echo Server is configured on the last node such as Node 4, and a UDP Echo Client on the first node that is Node 0 transmits the packets to the server. In the mesh network, this application activates route discovery.
  • Routing Table Printing:
    • The routing table is inscribed at 5 seconds for HWMP, confirming that routes are launched in the mesh network.

Step 2: Build and Run the Simulation

  1. In the NS3’s scratch directory, we can save hwmp_simulation.cc.
  2. Go to terminal then pass through to NS3 directory, and make the script:

./ns3 build

  1. Run the simulation:

./ns3 run scratch/hwmp_simulation

Above code will run the simulation and we will be observed the log messages to display packet forwarding and route establishment using HWMP.

Further Experimentation Ideas

To discover further HWMP behavior, we can deliberate the following experiment:

  • Add More Nodes and Configurations: Maximize the number of nodes, making a more wide mesh network and then monitor the path selection of HWMP.
  • Enable Mobility: Replicate node movement with the help of RandomWaypointMobilityModel, to experiment the capability of HWMP adjusting to topology changes.
  • Evaluate Proactive and Reactive Modes: For HWMP, set diverse proactive and reactive intervals to monitor how these settings influence the performance of network.
  • Measure Performance Metrics: Examine packet delivery ratio, latency, and routing overhead using FlowMonitor of NS3 within the mesh network.
  • Enable PCAP Tracing: Allow PCAP tracing to seize the packet-level information and then we examine how HWMP directs traffic.

In this guide, we clearly explained the thorough simulation techniques with relevant example coding for HWMP Protocol projects that were executed and replicated in NS3 simulation tool. Let me know if you would like further details on these projects!

We’ll help you set up an HWMP-based mesh network with easy, step-by-step instructions. We specialize in the Mesh Networking Standard (IEEE 802.11s). At phdprojects.org, we’ll assist you in finding the best project topics and simulation results to kick off your HWMP Protocol Projects using the NS3 tool. You’ll see your project results after team up with us. Let us handle the project performance for you.