To develop the Non-Adaptive Routing utilized the environment NS3. The Non-Adaptive Routing (also called static routing) is routing method in which routes are precomputed and do not variation the despite of network environments like as traffic, connection failures, or node mobility. In NS3, non-adaptive routing can be employed for used the Ipv4StaticRouting. This method configures the manual, fixed routes which remain the unaltered during the replication.
Steps to Develop a Non-Adaptive Routing Project in NS3
- Install and Set Up NS-3
Download the NS3 is installed:
git clone
cd ns-3-dev
./ns3 configure –enable-examples –enable-tests
./ns3 build
- Define a Network Topology
A wired or wireless network can be used for non-adaptive routing.
Example: Create a 6-Node Network
NodeContainer nodes;
nodes.Create(6); // Create 6 nodes
We join the nodes for utilized the point-to-point connections
PointToPointHelper p2p;
p2p.SetDeviceAttribute(“DataRate”, StringValue(“1Gbps”));
p2p.SetChannelAttribute(“Delay”, StringValue(“2ms”));
NetDeviceContainer devices01 = p2p.Install(nodes.Get(0), nodes.Get(1));
NetDeviceContainer devices12 = p2p.Install(nodes.Get(1), nodes.Get(2));
NetDeviceContainer devices13 = p2p.Install(nodes.Get(1), nodes.Get(3));
NetDeviceContainer devices34 = p2p.Install(nodes.Get(3), nodes.Get(4));
NetDeviceContainer devices35 = p2p.Install(nodes.Get(3), nodes.Get(5));
- Allot the IP Addresses
InternetStackHelper stack;
stack.Install(nodes);
Ipv4AddressHelper address;
address.SetBase(“10.1.1.0”, “255.255.255.0”);
Ipv4InterfaceContainer interfaces01 = address.Assign(devices01);
address.SetBase(“10.1.2.0”, “255.255.255.0”);
Ipv4InterfaceContainer interfaces12 = address.Assign(devices12);
address.SetBase(“10.1.3.0”, “255.255.255.0”);
Ipv4InterfaceContainer interfaces13 = address.Assign(devices13);
address.SetBase(“10.1.4.0”, “255.255.255.0”);
Ipv4InterfaceContainer interfaces34 = address.Assign(devices34);
address.SetBase(“10.1.5.0”, “255.255.255.0”);
Ipv4InterfaceContainer interfaces35 = address.Assign(devices35);
- Implement Non-Adaptive Routing (Static Routing)
Static routing is enable which routes never change, although enhanced the route becomes accessible.
(A) We fix the Static Routing Table
Ptr<Ipv4StaticRouting> staticRouting0 = Ipv4RoutingHelper::GetRouting<Ipv4StaticRouting>(nodes.Get(0)->GetObject<Ipv4>());
Ptr<Ipv4StaticRouting> staticRouting1 = Ipv4RoutingHelper::GetRouting<Ipv4StaticRouting>(nodes.Get(1)->GetObject<Ipv4>());
Ptr<Ipv4StaticRouting> staticRouting2 = Ipv4RoutingHelper::GetRouting<Ipv4StaticRouting>(nodes.Get(2)->GetObject<Ipv4>());
Ptr<Ipv4StaticRouting> staticRouting3 = Ipv4RoutingHelper::GetRouting<Ipv4StaticRouting>(nodes.Get(3)->GetObject<Ipv4>());
Ptr<Ipv4StaticRouting> staticRouting4 = Ipv4RoutingHelper::GetRouting<Ipv4StaticRouting>(nodes.Get(4)->GetObject<Ipv4>());
Ptr<Ipv4StaticRouting> staticRouting5 = Ipv4RoutingHelper::GetRouting<Ipv4StaticRouting>(nodes.Get(5)->GetObject<Ipv4>());
(B) Improve the Static Routes
staticRouting0->AddHostRouteTo(Ipv4Address(“10.1.5.2”), Ipv4Address(“10.1.1.2”), 1);
staticRouting1->AddHostRouteTo(Ipv4Address(“10.1.5.2”), Ipv4Address(“10.1.2.2”), 2);
staticRouting2->AddHostRouteTo(Ipv4Address(“10.1.5.2”), Ipv4Address(“10.1.3.2”), 2);
staticRouting3->AddHostRouteTo(Ipv4Address(“10.1.5.2”), Ipv4Address(“10.1.4.2”), 1);
staticRouting4->AddHostRouteTo(Ipv4Address(“10.1.5.2”), Ipv4Address(“10.1.5.2”), 2);
- Every node is manually allocated the path to node 5.
- It happens no dynamic paths are recalculations, even if network environments are modify.
- We setting the congestion applications
UdpEchoServerHelper echoServer(9);
ApplicationContainer serverApps = echoServer.Install(nodes.Get(5));
serverApps.Start(Seconds(1.0));
serverApps.Stop(Seconds(10.0));
UdpEchoClientHelper echoClient(Ipv4Address(“10.1.5.2”), 9);
echoClient.SetAttribute(“MaxPackets”, UintegerValue(5));
echoClient.SetAttribute(“Interval”, TimeValue(Seconds(1.0)));
echoClient.SetAttribute(“PacketSize”, UintegerValue(512));
ApplicationContainer clientApps = echoClient.Install(nodes.Get(0));
clientApps.Start(Seconds(2.0));
clientApps.Stop(Seconds(10.0));
- Ensure the Tracing for Debugging
AsciiTraceHelper ascii;
p2p.EnableAsciiAll(ascii.CreateFileStream(“non-adaptive-routing.tr”));
p2p.EnablePcapAll(“non-adaptive-routing”);
- Implement the Replication
Simulator::Run();
Simulator::Destroy();
- Investigate the Results
We assist for vision the tool like NetAnim:
./waf –run non-adaptive-routing
netanim
- Extend with Advanced Features
- Security-Based Non-Adaptive Routing: We avoid the unauthorized route variations.
- Energy-Efficient Static Routing: Enhance for minimal power usage.
- Hierarchical Non-Adaptive Routing: It utilized a layered routing method.
We clearly get knowledge about how the non-adaptive will implement in ns3 tool that has generate the network then analyse the results in the traffic using the ns3 tool in INET framework. If you any doubts regarding the non-adaptive routing we will assist and provide it.