How to Start TORA Protocol Projects Using NS3

To start Temporally-Ordered Routing Algorithm (TORA) using NS3 that is a highly adaptive, loop-free, and distributed routing protocol used for mobile ad hoc networks (MANETs). But, NS3 environment does not directly support a built-in execution for TORA. In NS3, replicate the TORA-like behavior, we should normally require to make a custom module to execute TORA’s complex route discovery, maintenance, and failure handling processes.

On the other hand, if we need to discover NS3 including same reactive or on-demand routing protocols then AODV (Ad hoc On-Demand Distance Vector) and DSR (Dynamic Source Routing) are available and it can utilise depends on the initial points enhancing a custom TORA protocol.

Following is a step-by-step approach that helps how to configure a TORA-like project in NS3, either by estimating TORA including existing protocols or making a custom routing module.

Steps to Start TORA Protocol Projects in NS3

Option 1: Simulating TORA-Like Behavior Using AODV or DSR

If we require to focus on the TORA-like concepts deprived of making a custom TORA execution then we can be replicated the network including AODV or DSR, both reactive protocols obtainable within NS3. Although they vary from TORA such as design then also they utilize on-demand route discovery that is a TORA’s fundamental feature.

Steps to Set Up AODV or DSR for TORA-Like Behavior

  1. We install NS3 as it already doesn’t install (assuming a Linux environment):

sudo apt update

sudo apt install -y gcc g++ python3 python3-dev cmake libgsl-dev libsqlite3-dev

# Clone the NS-3 repository

git clone https://gitlab.com/nsnam/ns-3-dev.git ns-3

cd ns-3

# Configure and build NS-3

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

./ns3 build

  1. In the NS3’s scratch directory, we make a New Simulation Script then name it like tora_simulation_approximation.cc.
  2. Utilize AODV or DSR to configure the Network:

#include “ns3/core-module.h”

#include “ns3/network-module.h”

#include “ns3/internet-module.h”

#include “ns3/aodv-helper.h”

#include “ns3/dsr-helper.h”

#include “ns3/mobility-module.h”

#include “ns3/wifi-module.h”

#include “ns3/applications-module.h”

using namespace ns3;

NS_LOG_COMPONENT_DEFINE(“ToraSimulationApproximation”);

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

// Enable logging

LogComponentEnable(“UdpEchoClientApplication”, LOG_LEVEL_INFO);

LogComponentEnable(“UdpEchoServerApplication”, LOG_LEVEL_INFO);

// Create nodes

NodeContainer nodes;

nodes.Create(10); // Example with 10 nodes

// Set up mobility model for the nodes

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

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

mobility.Install(nodes);

// Configure WiFi for ad hoc network

WifiHelper wifi;

wifi.SetStandard(WIFI_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);

// Install Internet stack and set up a reactive routing protocol

InternetStackHelper internet;

// Uncomment one of the following lines to select a routing protocol similar to TORA

AodvHelper aodv;

internet.SetRoutingHelper(aodv);  // Use AODV as the routing protocol

// DsrMainHelper dsrMain;

// DsrHelper dsr;

// internet.Install(nodes);

// dsrMain.Install(dsr, nodes);

internet.Install(nodes);

// Assign IP addresses to devices

Ipv4AddressHelper ipv4;

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

Ipv4InterfaceContainer interfaces = ipv4.Assign(devices);

// Set up a UDP echo server on one node to test connectivity

UdpEchoServerHelper echoServer(9);

ApplicationContainer serverApps = echoServer.Install(nodes.Get(0));

serverApps.Start(Seconds(1.0));

serverApps.Stop(Seconds(10.0));

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

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

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

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

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

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

clientApps.Start(Seconds(2.0));

clientApps.Stop(Seconds(10.0));

// Run the simulation

Simulator::Stop(Seconds(10.0));

Simulator::Run();

Simulator::Destroy();

return 0;

}

Explanation of the Code

  • Node Setup: We make 10 nodes to signify the network topology.
  • Mobility Model: We can utilise RandomWaypointMobilityModel to replicate the node movement that is necessary for ad hoc networks.
  • WiFi Ad Hoc Mode: WiFi is configured in ad hoc mode to permit direct interaction among the nodes.
  • Routing Protocols:
    • AODV (Ad hoc On-Demand Distance Vector): It is utilised as per TORA’s estimation for route discovery and maintenance. We can be uncommented the DSR lines as an alternative if we choose DSR.
  • Applications:
    • A UDP Echo Server is configured at node 0.
    • A UDP Echo Client on node 9 transmits packets to the server, analysing end-to-end connectivity over the network.
  1. Build and Run the Simulation
  1. In the scratch directory, we need to save tora_simulation_approximation.cc.
  2. Go to terminal then pass through to the NS3 directory, and make the script:

./ns3 build

  1. Next, we can execute the simulation:

./ns3 run scratch/tora_simulation_approximation

Option 2: Creating a Custom TORA Module in NS3

If we require a more exact TORA simulation then we deliberate to make a custom TORA execution using an NS3 module. This method needs a comprehending of unique features of TORA that contains:

  • Route Discovery: TORA determines routes only if required and it sustains the routes only when they are authentic.
  • Link Reversal Mechanism: TORA utilises link reversals adjusting to network topology modifications.
  • Route Maintenance and Failure Handling: TORA sustains the routes to destinations and again sets up them if modifications happen within network topology.

Steps for Creating a Custom TORA Module

  1. Understand TORA Protocol Mechanics:
    • Reconsider the design principles of TORA to concentrate on route discovery, maintenance, link reversal, and failure handling.
  2. Set Up a New Module in NS3:
    • In the NS3’s src directory, make a new folder like src/tora.
    • We adhere to NS3’s routing protocol design patterns to execute the TORA classes such as ToraRoutingProtocol.
  3. Develop Key Components:
    • We can execute the TORA-specific techniques for route discovery, maintenance, and failure handling.
  4. Integrate and Test:
    • When executed with the TORA protocol using InternetStackHelper and then experiment it to utilize example scripts that same to the one above.

This method needs more understanding of NS3 and the TORA protocol in addition to C++ programming knowledge.

Experimentation Ideas

To discover and examine the TORA-like behavior, we can consider the following experiments:

  • Vary Node Density: Experiment with various volumes of nodes, monitoring how performance measures protocol.
  • Mobility Variations: Modify the node mobility metrics to observe how TORA or AODV/DSR adjusts to modifying the topologies.
  • Network Failure Scenarios: We replicate the link or node failures, examining how routes are regenerated.
  • Measure Performance Metrics: Compute the performance indicators like packet delivery ratio, end-to-end delay, and routing overhead to utilize NS3’s FlowMonitor or other tools.

Overall, we had completely executed and simulated the TORA Protocol Projects using NS3 simulation tools through above provided simulation approach. If you need more details on this subject we will provide that too.

At phdprojects.org, we are dedicated to helping you discover the most suitable project topics and simulation outcomes to initiate your TORA Protocol Projects utilizing the NS3 tool. Work with us we provide you with  impressive project results. Allow us to manage the project performance on your behalf.