MiniNet is a from-scratch, in-process network protocol simulator written in Python. It models a lossy, delayed physical medium using asyncio and runs a custom reliable transport protocol (Go-Back-N ARQ) layered on top of a dynamic Distance Vector routing protocol (Bellman-Ford style with poison reverse).
This simulator does not use real OS sockets; instead, it implements a simulated link layer, allowing deterministic injection of packet loss, latency, and packet corruption for testing protocol convergence and reliable transport characteristics.
+--------------------------------------------+
| CLI Group |
| (run-topology, show-routes, send) |
+----------------------+---------------------+
| (Local TCP Control Socket)
v
+--------------------------------------------+
| NetworkSimulator |
| - Manages nodes & physical connections |
| - Models dynamic link loss & latency |
+----------+----------------------+----------+
| |
v v
+--------------------+ +--------------------+
| SimNode | | SimNode |
| ("N1") | | ("N4") |
| +----------------+ | | +----------------+ |
| | GBNSender | | | | GBNSender | |
| +----------------+ | | +----------------+ |
| | GBNReceiver | | | | GBNReceiver | |
| +----------------+ | | +----------------+ |
| | RoutingNode | | | | RoutingNode | |
| +----------------+ | | +----------------+ |
+----------+---------+ +----------^---------+
| |
+---[ VirtualLink ]-----+
(Loss & Latency)
- High Packet Loss Tolerance: Reliably sustains error-free, byte-for-byte identical 50KB transfers over a 3-hop routed network even at 20% packet loss on data links and 10% packet loss on ACK links.
-
Swift Convergence: A 3-hop linear topology (
$N_1 - N_2 - N_3 - N_4$ ) with a 2.0-second broadcast interval converges completely within 2.12 seconds (second update cycle). -
Advanced Retransmit Control: Successfully triggers Fast Retransmit upon the 3rd duplicate ACK (4th consecutive receipt) and applies Exponential Backoff on consecutive timeouts, doubling the retransmit timer up to a capped
$4\times$ multiplier.
-
Clone the repository:
git clone https://github.com/DhyeyTandel/MiniNET.git cd MiniNET -
Set up virtual environment and install in editable mode:
python3 -m venv .venv source .venv/bin/activate pip install -e ".[test,dev]"
The CLI is registered under the mininet command.
Run the zero-config demo which sets up a 4-node line topology with 10% packet loss on links, displays table convergence, and runs a reliable GBN transfer over 3 hops.
mininet demoOutput:
1. Starting 4-node line topology with 10% loss rates on all links...
Awaiting routing table convergence...
Routing converged in 2.12 seconds!
Routing Table for N1
┏━━━━━━━━━━━━━┳━━━━━━┳━━━━━━━━━━┓
┃ Destination ┃ Cost ┃ Next Hop ┃
┡━━━━━━━━━━━━━╇━━━━━━╇━━━━━━━━━━┩
│ N1 │ 0.0 │ N1 │
│ N2 │ 1.0 │ N2 │
│ N3 │ 2.0 │ N2 │
│ N4 │ 3.0 │ N2 │
└─────────────┴──────┴──────────┘
...
2. Initiating GBN reliable file transfer from N1 to N4 (3-hop routed transfer)...
Received Stream: 'Hello World! This message has been sent reliably over a 3-hop virtual network with 10% packet loss on every hop, utilizing Bellman-Ford Distance Vector routing and sliding window Go-Back-N reliable transport protocol.'
Success: Stream verification passed (byte-for-byte identical)!
Transfer Performance Stats:
Bytes Transmitted: 217 bytes
Timeout Retransmits: 0
Fast Retransmits: 0
Elapsed GBN Time: 0.0245 seconds
Load a topology definition JSON file to run the network and daemon control server:
mininet run-topology examples/four_node.jsonIn a separate terminal, inject packet loss on a specific link:
mininet inject-loss --link N1 N2 --rate 0.25View the routing tables of all running nodes (add --watch to monitor live updates):
mininet show-routesSend text or files between nodes in the running network:
mininet send --from N1 --to N4 --data "This is reliable transport data"Use the included Makefile targets to build, test, and check code style:
- Run test suite:
make test - Run test suite with coverage report:
make test-cov - Lint code with Ruff:
make lint - Run the demo:
make demo
This project is licensed under the MIT License. See LICENSE for details.