Simulation and Comparison of Static Routing and RIP in a 6-Router Network Under Link Failure Using NS-3
AIM:
To simulate and compare Static Routing and RIP in a 6-router network under link failure using NS-3.
NETWORK TOPOLOGY:
The simulation consists of 6 routers connected in a mesh topology.
Multiple paths exist between the source (Node 0) and the destination (Node 5).
A link between routers is intentionally broken during simulation to test routing behaviour.
|
|
| Network Design |
WORKING:
Static Routing:
Routes are manually configured. When a link fails, packets are dropped and communication stops.
RIP Routing:
Dynamic routing protocol. Automatically updates routing tables and discovers an alternate path after a link failure.
NetAnim:
The animation represents a 6-router network topology where data packets are transmitted from the source node (Node 0) to the destination node (Node 5). The arrows indicate the direction of packet flow through intermediate routers.
Initially, packets follow the shortest available path based on RIP routing. During the simulation, a link disturbance is introduced, and the RIP protocol dynamically updates its routing tables. Although the exact path change is not clearly visible in the animation, communication is maintained through alternate routing decisions.
This demonstrates the adaptive nature of RIP in handling network changes and ensuring continuous data transmission.
Packet Reception vs Time for RIP Routing under Link Failure
The graph shows packet reception over time in the network. A consistent packet reception is observed throughout the simulation, even after the occurrence of link failure.
This indicates that the RIP routing protocol successfully maintains communication by dynamically updating routing paths and selecting alternate routes.
In contrast, static routing would result in a complete interruption of packet delivery after link failure, as it does not support dynamic route updates.
Hence, the graph demonstrates that RIP is more reliable and efficient than static routing in handling network failures.
Performance Analysis using TraceMetrics
The table shows the throughput and goodput values for different nodes in the network. It can be observed that nodes closer to the source (Node 0, 1, and 2) have higher throughput and goodput values, indicating active participation in packet forwarding.
Nodes farther from the main transmission path show lower or zero goodput, as they are not directly involved in data delivery. This reflects the routing behavior of RIP, where only optimal paths are selected for communication.
The Little’s Law results show parameters such as arrival rate (λ), average number of packets in the system (E[N]), and average waiting time (E[W]). The values indicate that the system maintains low delay and efficient packet handling during transmission.
The minimal waiting time and stable packet flow demonstrate that the network operates efficiently even under link disturbances due to the adaptive nature of RIP routing.
CODE:
#include "ns3/core-module.h"
#include "ns3/network-module.h"
#include "ns3/internet-module.h"
#include "ns3/point-to-point-module.h"
#include "ns3/applications-module.h"
#include "ns3/netanim-module.h"
#include "ns3/rip-helper.h"
#include "ns3/mobility-module.h"
using namespace ns3;
int main ()
{
NodeContainer routers;
routers.Create (6);
// MOBILITY (FIX NODE POSITIONS)
MobilityHelper mobility;
Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator>();
positionAlloc->Add (Vector (0, 50, 0)); // Node 0
positionAlloc->Add (Vector (30, 80, 0)); // Node 1
positionAlloc->Add (Vector (30, 20, 0)); // Node 2
positionAlloc->Add (Vector (60, 80, 0)); // Node 3
positionAlloc->Add (Vector (60, 50, 0)); // Node 4
positionAlloc->Add (Vector (90, 50, 0)); // Node 5
mobility.SetPositionAllocator (positionAlloc);
mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
mobility.Install (routers);
// Links
PointToPointHelper p2p;
p2p.SetDeviceAttribute ("DataRate", StringValue ("5Mbps"));
p2p.SetChannelAttribute ("Delay", StringValue ("2ms"));
NetDeviceContainer d1 = p2p.Install (routers.Get(0), routers.Get(1));
NetDeviceContainer d2 = p2p.Install (routers.Get(1), routers.Get(2));
NetDeviceContainer d3 = p2p.Install (routers.Get(0), routers.Get(2));
NetDeviceContainer d4 = p2p.Install (routers.Get(1), routers.Get(3));
NetDeviceContainer d5 = p2p.Install (routers.Get(2), routers.Get(4));
NetDeviceContainer d6 = p2p.Install (routers.Get(3), routers.Get(4));
NetDeviceContainer d7 = p2p.Install (routers.Get(3), routers.Get(5));
NetDeviceContainer d8 = p2p.Install (routers.Get(4), routers.Get(5));
// RIP
RipHelper ripRouting;
Ipv4ListRoutingHelper listRH;
listRH.Add (ripRouting, 0);
InternetStackHelper stack;
stack.SetRoutingHelper (listRH);
stack.Install (routers);
// IPs
Ipv4AddressHelper address;
address.SetBase ("10.1.1.0", "255.255.255.0");
address.Assign (d1);
address.SetBase ("10.1.2.0", "255.255.255.0");
address.Assign (d2);
address.SetBase ("10.1.3.0", "255.255.255.0");
address.Assign (d3);
address.SetBase ("10.1.4.0", "255.255.255.0");
address.Assign (d4);
address.SetBase ("10.1.5.0", "255.255.255.0");
address.Assign (d5);
address.SetBase ("10.1.6.0", "255.255.255.0");
address.Assign (d6);
address.SetBase ("10.1.7.0", "255.255.255.0");
address.Assign (d7);
address.SetBase ("10.1.8.0", "255.255.255.0");
address.Assign (d8);
// Traffic
uint16_t port = 9;
OnOffHelper onoff ("ns3::UdpSocketFactory",
Address (InetSocketAddress ("10.1.7.2", port)));
onoff.SetConstantRate (DataRate ("1Mbps"));
onoff.Install (routers.Get(0)).Start (Seconds (1.0));
PacketSinkHelper sink ("ns3::UdpSocketFactory",
InetSocketAddress (Ipv4Address::GetAny (), port));
sink.Install (routers.Get(5)).Start (Seconds (0.0));
// LINK FAILURE (disable interface)
Ptr<Ipv4> ipv4 = routers.Get(1)->GetObject<Ipv4>();
Simulator::Schedule (Seconds (10.0),
&Ipv4::SetDown,
ipv4,
ipv4->GetInterfaceForDevice (d2.Get(0)));
// Animation
AnimationInterface anim ("rip.xml");
Simulator::Stop (Seconds (20.0));
Simulator::Run ();
Simulator::Destroy ();
return 0;
}
COMPARISON TABLE
| Parameter | Static Routing | RIP Routing |
|---|---|---|
| Adaptability | No | Yes |
| Route Update | Manual | Automatic |
| Packet Loss | High (after failure) | Low |
| Recovery | Not possible | Possible |
| Convergence Time | Not applicable | Few seconds |
| Complexity | Low | Moderate |
| Network Suitability | Small networks | Dynamic networks |
INFERENCE
The experiment demonstrates that RIP is more efficient than static routing in dynamic network conditions. RIP is capable of automatically detecting link failures and updating routing tables to select alternate paths, thereby maintaining continuous communication. In contrast, static routing fails to adapt to network changes, resulting in communication breakdown. Hence, RIP provides better reliability and performance in networks with changing topology.
Comments
Post a Comment