This release is a pre-release and may not be stable for production use.
ByteSim
A network simulator that runs in your terminal. Add gateways, routers, switches and computers, cable them together by typing device ids, and watch DHCP, routing, multicast and router failover happen packet by packet.
╭┄ rfab1 · HA ┄┄┄┄┄┄┄┄┄┄┄┄╮
┆ ┌────────┐ ┌────────┐ ┆
┆ │ r1 │ │ r2 │ ┆
┆ │ ●●○●●● │ │ ●●○●●● │ ┆
┆ └─┬┬─┬┬┬─┘ └─┬┬─┬┬┬─┘ ┆
╰┄┄┄││┄┃║║┄┄┄┄┄┄┄┄││┄┃║║┄┄┄╯
┌──────────────┘└─┴┴┼──────────┼┼─┴┤║
│ ┌─────┴──────────┴┴──┼┴────────────┐
╭┄┄┄┄│ fab1 ┄┄┄┄┄┄┄│┄┄┄┄┄┄┄╮ ╭┄┄┄┄│ fab2 ┄┄┄┄┄┄┄│┄┄┄┄┄┄┄╮
┆ ┌──┴─────┐ ┌──┴─────┐ ┆ ┆ ┌──┴─────┐ ┌──┴─────┐ ┆
┆ │ s1 │ │ s2 │ ┆ ┆ │ s3 │ │ s4 │ ┆
┆ │ ●●●●○○ │ │ ●●●○○○ │ ┆ ┆ │ ●●●●○○ │ │ ●●●○○○ │ ┆
┆ └─┬─┬┬───┘ └─┬─┬────┘ ┆ ┆ └─┬─┬┬───┘ └─┬─┬────┘ ┆
╰┄┄┄│┄││┄┄┄┄┄┄┄┄┄┄│┄│┄┄┄┄┄┄╯ ╰┄┄┄│┄││┄┄┄┄┄┄┄┄┄┄│┄│┄┄┄┄┄┄╯
└─●•••─────┬─┘ │ │ ││ │ └─────┐
┌─┴──┐ ┌┴───┐ ┌────┐ ┌─┴──┐ ┌────┐ ┌────┐
│ c1 │ │ c2 │ │ c3 │ │ c4 │ │ c5 │ │ c6 │
└────┘ └────┘ └────┘ └────┘ └────┘ └────┘
(1,10) (1,11) (1,12) (2,10) (2,11) (2,12)
ByteSim keeps what matters about networking (graphs, broadcast domains, forwarding, failure) and leaves out the detail that gets in the way:
- Devices with real ports. Routers and switches can have any number of
ports, and computers can have several network cards. Every port shows on
the device as
○(free) or●(in use). - Cabling by typing.
r1 s2connects two devices using their first free ports.r1:3 s2:8picks the ports. - Selectable layouts: layered, tree, circular, grid, compact and compact-layered, with arrow keys or the mouse to move things yourself.
- Simple addressing. An address is a pair: a network id and an 8-bit host
number, like
(2,14). MAC addresses name the physical port:R1Ais port 1 of router r1. - DHCP and ad-hoc addressing, animated as broadcast-then-reply, with
server bindings, conflict probing, renewal and expiry on a simulated clock
(
wait). - Routing tables: every router forwards by its own table (connected,
learned by a link-state protocol, static, default), hop by hop.
routes,route r1 5 via (2,2), and a realtraceroute. - Switching and ARP as they work: switches forward by MAC tables that learn, age and flush; interfaces cache ARP answers; TTLs run out.
- Random traffic with per-cable load shading and statistics (drops, busiest cables, top talkers), reproducible with a seed.
- Unicast, ping and multicast. With multicast you can see the packet copied
wherever the paths split.
mpingsends a shared request and collects replies from individual receivers. Large batches stay interactive and summarize per sender; globaldetail onshows every reply.mping all all *includes addressed routers and gateways alongside computers. Usetrace onfor full request and reply paths, including switch ports and selected cables. - Pause and queue. Freeze playback, queue several packet commands, then
resumeto launch them together. Adjust animation withspeed. - Console logs.
tee traffic.logappends console output to a plain text file while keeping it on screen;tee offstops capture. - Cable roles (data, control, fabric) and failures you can trigger by hand.
- Multipath: flow-hashed ECMP across equal-cost routes, link aggregation
(
lag) for parallel cables, and MLAG/vPC domains for cables to several switches, with a peer keepalive and dual-active detection. - Switching loops: spanning tree with root bridges, port costs and blocked ports, and real broadcast storms (frames multiplying, MAC tables flapping) when STP is off.
- The internet, NAT and overlays. Declare which group is the internet and sites sit behind stateful NAT (per-flow mappings that expire; easy or hard, double NAT included). Overlays connect members through every NAT like a mesh VPN (modeled on Tailscale, though not a fully faithful implementation): overlay addresses, direct or relayed connections, a coordination server, subnet routers, exit nodes and access rules.
- HA router clusters with a shared virtual gateway, failover, split-brain, quorum or witness policies, and active-active or active-passive forwarding. Build redundant routed cores that inter-site traffic can't bypass.
- Nested groups drawn as labelled frames, which you can clone along with their internal cables.
- BFS/DFS renumbering, once or automatically after every change, so ids follow the network's shape.
- Graph mode, which ignores addressing so you can explore pure connectivity.
- Topology files. Describe networks in YAML with reusable templates and link
macros (
mesh: [routers, switches]), then load or export them. - Construction scripts.
export scriptwrites the console commands that rebuild your network, reusing repeated parts withcloneandcopy. Each script is checked by replaying it before you get it, andrunreplays it.
Install
pip install bytesim
Requires Python 3.10+ and a terminal with Unicode and colour support.
Quick start
bytesim --demo basic # a small routed network
bytesim --demo ha # a clustered router pair between two fabrics
bytesim --demo loop # a switch loop with STP off: set off a storm
bytesim --demo core # three sites joined through a redundant routed core
bytesim --demo mlag # a seven-tier data centre built from bundled MLAG pairs
bytesim --demo internet # three sites behind NAT, joined only through the internet
bytesim --demo overlay # the same sites joined by a mesh-VPN overlay
bytesim mynet.json # open a saved network
bytesim campus.yaml # build one from a topology file
bytesim mynet.json --log-file traffic.log # also capture the console from startup
bytesim mynet.json --trace --no-detail # full paths with concise result summaries
New to ByteSim? The tutorial builds a first network from a blank canvas. For a quick taste, at the command line at the bottom of the screen:
add r 4 add a router with 4 ports → r1
add s 8 add an 8-port switch → s1
add c 1 3 add three computers with 1 NIC → c1 c2 c3
r1 s1 cable r1 to s1
s1 c1 cable s1 to c1 (c1 gets an address by DHCP)
ping c1 c2 watch the echo request and reply
Type help for every command. Press Esc to switch from the command line to
the canvas, where the arrow keys move the selected device and Tab cycles
through devices.
Documentation
- Tutorial: build two networks and a router from a blank canvas, step by step
- User guide: concepts, every command, keys, worked examples
- Architecture: how the code is organised, and how to add a command
- Topology format: templates and link macros in YAML
- Construction scripts:
export scriptandrun, with a tutorial - Save file format
- Changelog
- Roadmap: planned work
Stability
From 1.0.0b1, packet behaviour is feature-frozen: the betas fix bugs and fidelity gaps, and add no new packet features. Until 1.0.0:
- Kept compatible: save files (older ones always load), topology files, construction scripts and the console commands documented in the guide.
- May still change: console wording and colours, the layout algorithms and
the Python API beyond
Network,Device,Iface,LinkandNetError. - Experimental: anything the roadmap marks experimental, such as pop-out panels, has no compatibility promise.
Using the model from Python
The simulation is a plain Python model with no UI dependency:
from bytesim import Network
net = Network()
net.add("r"); net.add("s"); net.add("c"); net.add("c")
net.connect("r1", None, "s1", None)
net.connect("s1", None, "c1", None)
net.connect("s1", None, "c2", None)
net.reconcile() # router autoconfig + DHCP
print(net.iface("c1", 1).addr) # (1, 10)
for src, dst, frames in net.route("c1", ("c2", 1)):
print(src, "→", dst, [d for d, _ in frames])
Development
git clone https://github.com/BytesAndCoffee/bytesim
cd bytesim
python -m venv .venv && . .venv/bin/activate
pip install -e ".[dev]"
pytest
python -m build && twine check dist/*
License
MIT © Michael Yazdani. See LICENSE.
Metadata
Release files for bytesim 1.0.0b1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| bytesim-1.0.0b1.tar.gz | 250.6 kB | Without provenance | Details for bytesim-1.0.0b1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| bytesim-1.0.0b1-py3-none-any.whl | Python 3 | none | any | Details for bytesim-1.0.0b1-py3-none-any.whl |
Total release size: 427.6 kB
Release files / bytesim-1.0.0b1.tar.gz
| Download URL | bytesim-1.0.0b1.tar.gz |
|---|---|
| Size | 250.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
68a33e26f95fa5b4b4104f7765a53b084e4cd2e841e068163a86526121194d26
|
|
BLAKE2b-256 checksum How to use checksums |
c9c6d696cfc059aca2fbf64d51047a3ef5e363346a79a5a9f1cdae84bc00ff57
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.8
|
Release files / bytesim-1.0.0b1-py3-none-any.whl
| Download URL | bytesim-1.0.0b1-py3-none-any.whl |
|---|---|
| Size | 177.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
56bb6b66786b973f54b61946af5dda75b4883635736f33ee18a0864495ce0db3
|
|
BLAKE2b-256 checksum How to use checksums |
d6df2f8786e3101fa2643558c2ae7102e8fbe2c641c033f913eb266bd3c85a75
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.8
|
Security for bytesim 1.0.0b1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.