Skip to main content

Comparison of Routing Information Protocol vs. static routing using NS3 | NS Project 6

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 Topology
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

Popular posts from this blog

How to Create Ubuntu 24.04 Bootable USB Using Rufus [Step-by-Step Guide]

How to Create Ubuntu 24.04 Bootable USB Using Rufus [Step-by-Step Guide] Are you planning to install or try Ubuntu 24.04 LTS ? The easiest and most reliable method is to create a bootable USB drive using Rufus on a Windows system. This detailed guide will help you create a Ubuntu 24.04 USB bootloader using Rufus with easy-to-follow steps and screenshots (optional). Here is the complete video of the bootloader creation and OS installation in Windows 11. 🧰 Requirements A USB flash drive (minimum 8GB recommended) A Windows PC Ubuntu 24.04 LTS ISO file Rufus USB creation tool 🧾 Steps to Create a Ubuntu 24.04 Bootable USB Using Rufus ✅ Step 1: Download Ubuntu 24.04 ISO Visit the official Ubuntu website and download the Ubuntu 24.04 LTS ISO file . ✅ Step 2: Download and Run Rufus Head to Rufus official site and download the latest version. Open the executable file (no installation required). ✅ Step 3: Insert USB Drive Plug in your USB drive. Rufus ...

Installing ns3 in Ubuntu 22.04 | Complete Instructions

In this post, we are going to see how to install ns-3.36.1 in Ubuntu 22.04. You can follow the video for complete details Tools used in this simulation: NS3 version ns-3.36.1  OS Used: Ubuntu 22.04 LTS Installation of NS3 (ns-3.36.1) There are some changes in the ns3 installation procedure and the dependencies. So open a terminal and issue the following commands Step 1:  Prerequisites $ sudo apt update In the following packages, all the required dependencies are taken care and you can install all these packages for the complete use of ns3. $ sudo apt install g++ python3 python3-dev pkg-config sqlite3 cmake python3-setuptools git qtbase5-dev qtchooser qt5-qmake qtbase5-dev-tools gir1.2-goocanvas-2.0 python3-gi python3-gi-cairo python3-pygraphviz gir1.2-gtk-3.0 ipython3 openmpi-bin openmpi-common openmpi-doc libopenmpi-dev autoconf cvs bzr unrar gsl-bin libgsl-dev libgslcblas0 wireshark tcpdump sqlite sqlite3 libsqlite3-dev  libxml2 libxml2-dev libc6-dev libc6-dev-i386 libc...

Installation of NS2 in Ubuntu 22.04 | NS2 Tutorial 2

NS-2.35 installation in Ubuntu 22.04 This post shows how to install ns-2.35 in Ubuntu 22.04 Operating System Since ns-2.35 is too old, it needs the following packages gcc-4.8 g++-4.8 gawk and some more libraries Follow the video for more instructions So, here are the steps to install this software: To download and extract the ns2 software Download the software from the following link http://sourceforge.net/projects/nsnam/files/allinone/ns-allinone-2.35/ns-allinone-2.35.tar.gz/download Extract it to home folder and in my case its /home/pradeepkumar (I recommend to install it under your home folder) $ tar zxvf ns-allinone-2.35.tar.gz or Right click over the file and click extract here and select the home folder. $ sudo apt update $ sudo apt install build-essential autoconf automake libxmu-dev gawk To install gcc-4.8 and g++-4.8 $ sudo gedit /etc/apt/sources.list make an entry in the above file deb http://in.archive.ubuntu.com/ubuntu/ bionic main universe $ sudo apt update Since, it...