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.
-
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
| Component | Technology |
|---|---|
| Simulation Framework | NS-3.48 |
| Programming Language | C++17 |
| Build System | CMake |
| Visualization | NetAnim |
| Performance Analysis | FlowMonitor |
| Containerization | Docker |
| Topology | Description |
|---|---|
| Random | Random connected graph |
| Ring | Circular chain of routers |
| Mesh | Fully connected network |
| Tree | Binary hierarchical topology |
The simulator measures:
- Packet Delivery Ratio (PDR)
- Average End-to-End Delay
- Throughput
- Packet Loss
- Flow Statistics
ns3-Routing-Simulator/
│
├── src/
│ └── routing-sim.cc
│
├── docker/
│ └── Dockerfile
│
├── screenshots/
│
└── README.md
Install:
- NS-3.48
- CMake
- GCC/G++
- Python 3.x
./ns3 configure --enable-examples./ns3 build./ns3 run routing-sim| 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 |
./ns3 run "routing-sim --routers=100 --topology=random"./ns3 run "routing-sim --routers=50 --topology=ring"./ns3 run "routing-sim --routers=20 --topology=mesh"./ns3 run "routing-sim --routers=31 --topology=tree"./ns3 run "routing-sim --routers=100 --packets=500"./ns3 run "routing-sim --routers=50 --randomDelay=true --delayMin=1 --delayMax=10"The simulator can be built and executed inside Docker without installing NS-3, GCC, CMake, Python, or any other dependencies locally.
docker build -t ns3-routing-simulator .docker run --rm ns3-routing-simulatordocker run --rm ns3-routing-simulator --helpdocker run --rm ns3-routing-simulator --routers=50 --topology=ringdocker run --rm ns3-routing-simulator ^
--routers=50 ^
--topology=mesh ^
--packets=500 ^
--packetSize=1024 ^
--source=5 ^
--destination=40 ^
--randomDelay=true ^
--delayMin=5 ^
--delayMax=50- 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
--helpto view all available simulation options.
The simulator generates an animation.xml file that can be opened using NetAnim.
Follow the official NS-3 documentation to install NetAnim on your system.
netanimThen load:
animation.xml
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.
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.
Potential extensions include:
- Privacy-preserving routing
- Secret-sharing based routing protocols
- Distributed routing algorithms
- Multi-path routing
- Secure forwarding mechanisms