Skip to content

Latest commit

 

History

8 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NS-3 Routing Simulator

A configurable network routing simulator built using NS-3.48 for studying routing behavior, packet forwarding, and network performance across multiple network topologies.

This project is a port of a custom C++ routing simulator into the NS-3 ecosystem, enabling realistic packet-level simulation, performance analysis using FlowMonitor, and visualization through NetAnim.


Features

  • Multiple network topologies

    • Random Connected Graph
    • Ring Network
    • Full Mesh
    • Binary Tree
  • Configurable network size

    • Tested from 20 to 500 routers
  • UDP-based packet transmission

  • IPv4 routing using NS-3 Global Routing

  • FlowMonitor integration

  • NetAnim visualization support

  • Command-line configurable simulation parameters

  • Docker support for reproducible builds


Technologies Used

Component Technology
Simulation Framework NS-3.48
Programming Language C++17
Build System CMake
Visualization NetAnim
Performance Analysis FlowMonitor
Containerization Docker

Supported Topologies

Topology Description
Random Random connected graph
Ring Circular chain of routers
Mesh Fully connected network
Tree Binary hierarchical topology

Simulation Metrics

The simulator measures:

  • Packet Delivery Ratio (PDR)
  • Average End-to-End Delay
  • Throughput
  • Packet Loss
  • Flow Statistics

Repository Structure

ns3-Routing-Simulator/
│
├── src/
│   └── routing-sim.cc
│
├── docker/
│   └── Dockerfile
│
├── screenshots/
│
└── README.md

Prerequisites

Install:

  • NS-3.48
  • CMake
  • GCC/G++
  • Python 3.x

Build Instructions

Configure

./ns3 configure --enable-examples

Build

./ns3 build

Run

./ns3 run routing-sim

Command Line Parameters

Parameter Description Default
--routers Number of routers 20
--topology random / ring / mesh / tree random
--packets Number of packets 100
--packetSize Packet size (bytes) 512
--source Source router ID 0
--destination Destination router ID Last Router
--dataRate Link bandwidth 10Mbps
--linkDelay Link delay 5ms
--randomDelay Enable random delay false
--delayMin Minimum delay 1ms
--delayMax Maximum delay 10ms
--seed Random seed 42

Example Commands

Random Topology

./ns3 run "routing-sim --routers=100 --topology=random"

Ring Topology

./ns3 run "routing-sim --routers=50 --topology=ring"

Mesh Topology

./ns3 run "routing-sim --routers=20 --topology=mesh"

Tree Topology

./ns3 run "routing-sim --routers=31 --topology=tree"

Custom Packet Count

./ns3 run "routing-sim --routers=100 --packets=500"

Random Link Delays

./ns3 run "routing-sim --routers=50 --randomDelay=true --delayMin=1 --delayMax=10"

Docker Support

The simulator can be built and executed inside Docker without installing NS-3, GCC, CMake, Python, or any other dependencies locally.

Build Docker Image

docker build -t ns3-routing-simulator .

Run Default Simulation

docker run --rm ns3-routing-simulator

View Available Parameters

docker run --rm ns3-routing-simulator --help

Run with Custom Arguments

docker run --rm ns3-routing-simulator --routers=50 --topology=ring

Larger Mesh Topology Example

docker run --rm ns3-routing-simulator ^
--routers=50 ^
--topology=mesh ^
--packets=500 ^
--packetSize=1024 ^
--source=5 ^
--destination=40 ^
--randomDelay=true ^
--delayMin=5 ^
--delayMax=50

Notes

  • The Docker image contains a complete NS-3 environment.
  • No local installation of NS-3 is required.
  • All command-line parameters are forwarded directly to the simulator.
  • Use --help to view all available simulation options.

NetAnim Visualization

The simulator generates an animation.xml file that can be opened using NetAnim.

Install NetAnim

Follow the official NS-3 documentation to install NetAnim on your system.

Open Animation

netanim

Then load:

animation.xml

Note

NetAnim is not included in the Docker image because it requires a graphical user interface (GUI). Docker is used only for simulation execution and XML generation.


Experimental Results

Initial experiments were conducted across all supported topologies.

Topology Routers Packet Delivery Ratio
Random 20 100%
Ring 10 100%
Tree 15 100%
Mesh 8 100%

Key observations:

  • Mesh topology achieves the lowest delay.
  • Tree topology introduces higher path lengths.
  • Ring topology provides deterministic routing.
  • Random topology balances connectivity and scalability.
  • All tested configurations achieved 100% packet delivery.

Future Work

Potential extensions include:

  • Privacy-preserving routing
  • Secret-sharing based routing protocols
  • Distributed routing algorithms
  • Multi-path routing
  • Secure forwarding mechanisms

About

NS-3 based network routing simulator with support for random, ring, mesh and tree topologies. Docker-enabled for easy deployment.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages