How to Start DSDV Protocol Projects Using NS3

To start DSDV (Destination-Sequenced Distance Vector) using NS3 which is a proactive routing protocol particularly created for mobile ad hoc networks (MANETs) and in NS3, it is available. NS3 environment contains DSDV in their routing module, to create it relatively uncomplicated to configure and replicate a DSDV protocol-based project.

Below is a step-by-step technique that helps you how to get started with a DSDV project in NS3:

Steps to Start DSDV Protocol Projects in NS3

  1. Install NS3

If doesn’t install NS3 then we utilize the below given commands to configure it (assuming a Linux environment):

# Update and install dependencies

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. Create a New Script to Simulate DSDV
  1. In the NS3’s scratch directory, we make a new file, dsdv_simulation.cc,.
  2. We utilize the following code like a basic configuration for a DSDV replication. This instance configures a basic mobile ad hoc network in which nodes utilise DSDV for routing.

#include “ns3/core-module.h”

#include “ns3/network-module.h”

#include “ns3/internet-module.h”

#include “ns3/mobility-module.h”

#include “ns3/olsr-helper.h”

#include “ns3/dsdv-helper.h”

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

#include “ns3/yans-wifi-helper.h”

#include “ns3/wifi-module.h”

using namespace ns3;

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

// Set up logging to see output from DSDV

LogComponentEnable(“DsdvRoutingProtocol”, LOG_LEVEL_INFO);

// Create nodes

NodeContainer nodes;

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

// Set up WiFi and Mobility for ad hoc network

YansWifiChannelHelper channel = YansWifiChannelHelper::Default();

YansWifiPhyHelper phy = YansWifiPhyHelper::Default();

phy.SetChannel(channel.Create());

WifiHelper wifi;

wifi.SetStandard(WIFI_STANDARD_80211b);

WifiMacHelper mac;

mac.SetType(“ns3::AdhocWifiMac”);

NetDeviceContainer devices = wifi.Install(phy, mac, nodes);

// Install the Internet stack with DSDV

DsdvHelper dsdv;

InternetStackHelper internet;

internet.SetRoutingHelper(dsdv); // Use DSDV routing

internet.Install(nodes);

// Assign IP addresses to the network interfaces

Ipv4AddressHelper ipv4;

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

ipv4.Assign(devices);

// Set up mobility model

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

“PositionAllocator”, PointerValue(mobility.GetPositionAllocator()));

mobility.Install(nodes);

// Enable routing table logging

Ipv4StaticRoutingHelper ipv4RoutingHelper;

Ptr<OutputStreamWrapper> routingStream = Create<OutputStreamWrapper>(&std::cout);

dsdv.PrintRoutingTableAllAt(Seconds(5.0), routingStream);

// Set up packet transmission (optional)

UdpEchoServerHelper echoServer(9);

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

serverApps.Start(Seconds(1.0));

serverApps.Stop(Seconds(10.0));

UdpEchoClientHelper echoClient(Ipv4Address(“10.1.1.1”), 9);

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

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;

}

In this example:

    • Nodes: For the ad hoc network, we make 10 nodes.
    • WiFi Setup: The WifiHelper, YansWifiPhyHelper, and WifiMacHelper classes to configure WiFi connectivity within ad hoc mode.
    • DSDV Routing: We utilize the DsdvHelper class allowing DSDV like the routing protocol.
    • Mobility: The MobilityHelper class for the nodes sets up random mobility, general aspects within MANETs.
    • Packet Transmission: The script contains a UDP echo client-server configuration transmitting the packets and to experiment connectivity via the DSDV protocol.
    • Routing Table Logging: The routing tables are carried at certain time for all nodes to monitor how DSDV modernizes routes.
  1. Build and Run the Simulation
  1. In the scratch folder, we can save dsdv_simulation.cc.
  2. Go to terminal, pass through to NS3 directory and make the script:

./ns3 build

  1. Run the simulation:

./ns3 run scratch/dsdv_simulation

  1. Analyze DSDV Results

The log result will be indicated the behaviour of DSDV protocol with routing table updates and packet transmissions. We can be monitored how routes modify over time by reason of node mobility.

If we need to monitor additional in-depth DSDV operations then allow detailed logging for DsdvRoutingProtocol:

LogComponentEnable(“DsdvRoutingProtocol”, LOG_LEVEL_ALL);

Further Exploration

With this configuration, we can test by:

  • Changing Node Count and Topology: Maximize the volume of nodes or modify the network area, observing the scalability of DSDV.
  • Adjusting Mobility Models: Replicate diverse movement patterns and monitor its impact on DSDV using various mobility models.

 

  • Analyzing Network Performance: Measure network performance by tracking packet delivery ratios, latency, and other metrics.

By utilising NS3 simulation tool, we successfully execute the simplified approach with example coding to initiate and simulate the DSDV Protocol Projects. Based on your requirements, we will provide more specific insights about this project.

phdprojects.org researchers specialize in DSDV Protocol Projects utilizing the NS3 tool, providing tailored and high-quality simulations for researchers. Our skilled team has extensive expertise in mobile ad hoc networks (MANETs) and offers comprehensive explanations. To ensure exceptional outcomes for your projects, allow our team to manage your needs. Trust us to enhance your project performance. Reach out to phdprojects.org for further assistance. You can rest assured that our pricing is competitive, and we deliver dependable, high-quality work completed efficiently by our experts.