How to Start Internal Protocols Projects Using NS3

To start internal (intra-domain) routing protocols in NS3 for networks within an autonomous system (AS) using Interior Gateway Protocols (IGPs) that can be done. General IGPs contain various protocols like OSPF (Open Shortest Path First), RIP (Routing Information Protocol), and EIGRP (Enhanced Interior Gateway Routing Protocol). Although NS3 doesn’t support OSPF or EIGRP directly then it offers assist for static routing, OLSR (Optimized Link State Routing), and DSDV (Destination-Sequenced Distance Vector) that can utilize, estimating the internal routing behavior.

We can follow below given steps to configuring and executing an internal protocol simulation project in NS3.

Steps to Start Internal Protocols Projects in NS3

  1. Install NS3

We can adhere to these commands (assuming a Linux environment) as NS3 isn’t installed:

# Update system 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 for Internal Routing Protocol Simulation
  1. In the NS3’s scratch directory, make a new file like internal_protocol_simulation.cc.
  2. Configure a simulation for an internal routing protocol to utilise the below code outline. For intra-domain routing, we can be chosen among the OLSR and DSDV.

Basic Structure of internal_protocol_simulation.cc:

#include “ns3/core-module.h”

#include “ns3/network-module.h”

#include “ns3/internet-module.h”

#include “ns3/olsr-helper.h”

#include “ns3/dsdv-helper.h”

#include “ns3/point-to-point-module.h”

#include “ns3/applications-module.h”

#include “ns3/mobility-module.h”

using namespace ns3;

NS_LOG_COMPONENT_DEFINE(“InternalProtocolSimulation”);

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

// Enable logging for debugging purposes

LogComponentEnable(“UdpEchoClientApplication”, LOG_LEVEL_INFO);

LogComponentEnable(“UdpEchoServerApplication”, LOG_LEVEL_INFO);

// Create nodes in a network topology

NodeContainer nodes;

nodes.Create(6);  // Example with 6 nodes representing routers in a network

// Set up point-to-point links to form a simple internal network topology

PointToPointHelper pointToPoint;

pointToPoint.SetDeviceAttribute(“DataRate”, StringValue(“10Mbps”));

pointToPoint.SetChannelAttribute(“Delay”, StringValue(“2ms”));

NetDeviceContainer deviceAB = pointToPoint.Install(nodes.Get(0), nodes.Get(1));

NetDeviceContainer deviceBC = pointToPoint.Install(nodes.Get(1), nodes.Get(2));

NetDeviceContainer deviceCD = pointToPoint.Install(nodes.Get(2), nodes.Get(3));

NetDeviceContainer deviceDE = pointToPoint.Install(nodes.Get(3), nodes.Get(4));

NetDeviceContainer deviceEF = pointToPoint.Install(nodes.Get(4), nodes.Get(5));

// Install Internet stack and set up the routing protocol

InternetStackHelper internet;

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

OlsrHelper olsr;

internet.SetRoutingHelper(olsr);  // Use OLSR for intra-domain routing

// DsdvHelper dsdv;

// internet.SetRoutingHelper(dsdv);  // Use DSDV for intra-domain routing

internet.Install(nodes);

// Assign IP addresses to each link

Ipv4AddressHelper ipv4;

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

ipv4.Assign(deviceAB);

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

ipv4.Assign(deviceBC);

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

ipv4.Assign(deviceCD);

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

ipv4.Assign(deviceDE);

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

ipv4.Assign(deviceEF);

// Set up UDP echo server on the last node to test connectivity

UdpEchoServerHelper echoServer(9);

ApplicationContainer serverApps = echoServer.Install(nodes.Get(5));  // Node 5 as the server

serverApps.Start(Seconds(1.0));

serverApps.Stop(Seconds(10.0));

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

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

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

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

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

ApplicationContainer clientApps = echoClient.Install(nodes.Get(0));  // Node 0 as the client

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 can make six nodes to replicate the routers in an autonomous system.
  • Point-to-Point Links: Links are launched among neighbouring nodes to make a basic internal network topology.
  • Internet Stack and Routing Protocols: We configure the Internet stack and then we choose the required internal routing protocol:
    • OLSR (Optimized Link State Routing): A proactive link-state protocol, which modernizes routing data occasionally.
    • DSDV (Destination-Sequenced Distance Vector): A proactive distance-vector protocol, which sustains routes to all nearby destination.
  • IP Address Assignment: IP addresses are allocated to every link, making different subnets.
  • Applications:
    • A UDP Echo Server is installed at node 5, performing as the destination.
    • A UDP Echo Client on node 0 interacts with the server to experiment end-to-end connectivity over the network.
  1. Build and Run the Simulation
  1. In the scratch directory, we can save internal_protocol_simulation.cc.
  2. Go to terminal then pass through to NS3 directory, and make the script:

./ns3 build

  1. Execute the simulation including either OLSR, DSDV, allowed by uncommenting the respective line:

./ns3 run scratch/internal_protocol_simulation

  1. Analyze the Results

Use chosen internal routing protocol, simulation will be recorded the connectivity among nodes. Both OLSR and DSDV will be modernized and periodically sustained routing tables, thus we will be observed the routing activity at the same time deprived of dynamic data transmission.

To observe in-depth protocol logs, we can be allowed certain logging for OLSR or DSDV:

  • For OLSR:

LogComponentEnable(“OlsrRoutingProtocol”, LOG_LEVEL_ALL);

  • For DSDV:

LogComponentEnable(“DsdvRoutingProtocol”, LOG_LEVEL_ALL);

Above command will show in-depth routing data with modernizing routing table and route maintenance messages.

Experimentation Ideas

To discover more advance IGPs, we can deliberate the following experiments:

  • Increase Network Size: Append additional nodes and links to experiment the scalability of protocol within larger networks.
  • Topology Changes: Insert more complex topologies including further links and nodes, monitoring how the protocols handle the path diversity.
  • Measure Performance Metrics: Estimate performance indicators like packet delivery ratio, latency, and control overhead to utilise FlowMonitor.
  • Compare OLSR and DSDV: We can execute several simulations including both protocols and then equate its behaviors and performance parameters.
  • Link Failure Simulation: Launch link failures such as by detaching links among the nodes, monitoring how each protocol adjusts to modifications within network connectivity.

Through this module, you can acquire the simulation and execution approach regarding Internal Protocols Projects using NS3 tool. We will guide you through the process of establishing an HWMP-based mesh network with straightforward, step-by-step instructions. Our expertise lies in OSPF (Open Shortest Path First), RIP (Routing Information Protocol), and EIGRP (Enhanced Interior Gateway Routing Protocol). At phdprojects.org, we are dedicated to helping you discover the most suitable project topics and simulation outcomes to launch your Internal Protocols Projects using the NS3 tool. Collaborate with us, and you will witness impressive project results. Allow us to manage the performance of your project.