Skip to content

andrewlengly.com/nettracer-casestudy :: nettracer case study

# A network lab in the browser. Packets cross a 3D network one frame at a time, and each hop shows which header fields changed.

designed page ......... /nettracer-casestudy

THE SHORT VERSION

  NetTracer is a network lab in the browser. It follows one packet across a 3D network a
  frame at a time and shows which header fields change at each hop. It is built with React,
  Three.js, Tailwind CSS and Vite, and its 7 guided labs and sandbox are live with the code
  public.

the idea .............. Follow one packet across a network and see how the network works.
                        Every frame is on screen, along with the header fields that change
                        at each hop.
what i did ............ Built an engine that turns a network and a traffic flow into a
                        packet capture, then set it under a 3D scene with 7 guided labs and
                        a sandbox.
where it stands ....... Live, with the code public. It has no tests yet, and the header
                        checksum it shows is a stand-in.

kind .................. Case study · Build
role .................. Developer
year .................. 2026
tools ................. React, Three.js, Tailwind CSS, Vite, lucide-react

what it does .......... A 3D network lab that walks packets hop by hop and shows which
                        header fields change at each device.

WHAT IT DOES

  # Seven guided labs and a sandbox run on one engine.

guided labs ........... Seven labs, each with a storyline of steps. Three of them start
                        broken, and the capture shows where the packet dies.
3d stage .............. Laptops, switches, a router and rack servers on a floor grid.
                        Packets travel the cables as capsules.
capture table ......... Every frame in order, with its time, source, destination, protocol
                        and size. Click a row to jump to it.
step narrative ........ Each step says why the packet exists and what the device at this hop
                        did with it.
byte diff ............. The headers at each layer. A field that changed at this hop shows
                        its old value struck through beside the new one.
explode osi layers .... Splits a packet on the stage into its L2, L3, L4 and L7 slabs.
one-click fixes ....... VLANs, gateway repair, HSRP, TLS and route restore. Each fix re-runs
                        the simulation, so the capture shows what it changed.
sandbox ............... Add laptops and servers, then click any device to edit its IP, mask,
                        gateway, VLAN, uplink or power. A traffic generator runs a new
                        capture from the host you pick.

THE QUESTIONS

  # Each lab answers one question.

  How does a frame reach a MAC address nobody has learned yet?
    lab ............... 01 ARP & Switch Flooding
    in the capture .... SW1 floods the ARP broadcast and learns each sender’s port. After
                        that the ping goes out one port

  What changes when a packet crosses a router?
    lab ............... 02 IP Routing & MAC Rewrite
    in the capture .... R1 writes a new Ethernet frame and the IP addresses never change.
                        Four fields differ after that hop, with TTL going from 64 to 63

  What has to happen before a web page loads?
    lab ............... 03 HTTP + DNS + TCP Full Flow
    in the capture .... The DNS lookup and the TCP handshake come first. The GET and its 200
                        OK follow, 40 frames in all

  Why can’t PC-A open any website?
    lab ............... 04 Broken Gateway Diagnosis
    in the capture .... Its gateway is 192.168.1.99, an address nobody on the LAN owns.
                        Three ARP requests go unanswered and the packet is dropped

  What happens when the only router loses power?
    lab ............... 05 Router Failure & HSRP
    in the capture .... ARP for the gateway times out and nothing leaves the LAN. The fix
                        adds a standby router behind a shared virtual IP

  Where does a packet go when its route is missing?
    lab ............... 06 Missing Route to 8.8.8.0/24
    in the capture .... R1 has no entry for 8.8.8.0/24, so the DNS query is dropped at the
                        router

  How do two VLANs talk over one cable?
    lab ............... 07 Inter-VLAN Routing on a Stick
    in the capture .... PC-A in VLAN 10 pings PC-C in VLAN 20 through one trunk to R1. The
                        802.1Q tag changes from 10 to 20 on the way back out

HOW IT WORKS

  # The engine is pure functions, so every edit re-runs the capture.

  # How a network on screen becomes a capture
  01. Network and flow
      Each device’s IP, mask, gateway and VLAN
      One traffic flow, such as a ping
  02. Engine
      Pure functions
      ARP caches and switch MAC tables
      VLAN domains and HSRP election
      Longest-prefix routing
      Returns: A list of frames, each with the fields that changed since the hop before
  03. Three.js stage
      Devices and cables built in code
      Packets as capsules on the floor
  04. React interface
      Capture table and step narrative
      Byte diff and fixes
      Keys: Space plays or pauses, and the arrow keys step one frame

  The whole app is one React component, 2,960 lines long. The engine sits at the top of the
  file and needs nothing from the other two parts.

  A switch records the sender’s MAC against the port a frame came in on. It floods a frame
  whenever it has no single port to send it to, which covers broadcasts and any MAC it
  hasn’t learned yet. A router picks the route with the longest matching prefix, and every
  one of those rules reads the device’s current settings.

THE MATH

  # The health score starts at 100 and loses points for each problem.

  # Health score
health score .......... 100 minus the penalty of every open issue, never below 0
  The header shows the score in green from 85 and in amber from 60. Anything lower is red.

  # Points each issue takes off the health score
columns ............... Penalty
a gateway that no router owns
                        30
the only router is down
                        30
a router with no route to its own network
                        25
two hosts on one ip ... 20
plain http on port 80
                        15
a single router with no standby
                        10
every host in one broadcast domain
                        10
a host that bypasses the hsrp virtual gateway
                        8
a router down while the standby carries traffic
                        5
  The base network starts at 65, with 35 points lost across the issues it ships with. Apply
  every fix the panel offers and it reads 100.

  # Routing rules
same subnet ........... two addresses match once each is ANDed with the mask
route chosen .......... the matching route with the longest prefix
ttl ................... starts at 64 and drops by 1 at each router
arp timeout ........... 3 requests with no answer
  Lab devices start on /24 masks.

WHAT IT FOUND

  # The three labs that start broken score lowest before any fix.

  The engine runs on its own in Node, with no browser and no 3D scene. The figures below
  come from running it that way against all seven labs.

  # Health score as each lab opens
01 arp & switch flooding (8)
                        65
02 ip routing & mac rewrite (16)
                        65
03 http + dns + tcp full flow (40)
                        65
04 broken gateway diagnosis (7)
                        35
05 router failure & hsrp (7)
                        45
06 missing route to 8.8.8.0/24 (7)
                        40
07 inter-vlan routing on a stick (16)
                        75
  Frames in each capture in parentheses. Labs 04 to 06 end in a drop, and each one delivers
  once its first suggested fix is applied. No lab opens in the green, which starts at 85.

WHERE IT SIMPLIFIES

  # The checksum on screen is a stand-in.

  The Header checksum field shows a 16-bit slice of an FNV-1a hash over the source,
  destination, TTL and identification. It changes whenever TTL changes, which is the point
  lab 02 makes.

  A real IPv4 checksum is a ones’ complement sum over the whole header, so the value here
  won’t match a real capture. The README says checksums are computed from live device
  config. That holds for the inputs, though the arithmetic is a hash.

  # What else is simplified
  UDP checksums
    on screen ......... A checksum on DNS and HSRP datagrams
    underneath ........ The same hash, taken over the ports and the length

  Timing
    on screen ......... A time on every frame, such as 0.015 s for lab 01
    underneath ........ Fixed delays. Each hop adds 2 ms or 6 ms, and an ARP request nobody
                        answers adds 1 s

  TCP and TLS
    on screen ......... A handshake, then data
    underneath ........ Scripted packets with fixed ports and sizes. The TLS payload is
                        placeholder bytes

  A drop at a router
    on screen ......... The capture ends where no route matches
    underneath ........ A real router would also send ICMP Destination Unreachable back. The
                        step note says so

  HSRP failover
    on screen ......... A Hello from the Active router, and a standby that takes over
    underneath ........ The powered router with the highest priority owns the virtual IP at
                        once. No hold timer runs

DECISIONS

  # The whole lab ships as one component.

a pure engine ......... It takes a network and a flow and returns a list of frames. Editing
                        a device runs it again, so the capture always matches the settings
                        on screen.
hardware built in code
                        Laptops, switches, the router and the servers are Three.js geometry.
                        The app loads no model files.
one file .............. All three parts live in one component, with the engine at the top.
pixel ratio capped at 2
                        The renderer never draws more than 2 device pixels for each CSS
                        pixel.
cleanup on exit ....... Leaving the stage cancels its animation frame and removes its
                        listeners. Geometries, materials, textures and the renderer are all
                        freed.
a note on small screens
                        Under 1,024 px wide, the app says it was built for a desktop screen
                        and offers an Open anyway button.

DESIGN

  # Each protocol keeps one color from the stage to the capture.

  The interface is dark, with Inter for text and JetBrains Mono for labels and the capture
  table. Color carries the protocol.

protocol colors ....... Eight of them. ARP is cyan, DNS is amber, TCP is blue, and a drop is
                        always red. A packet on the stage and its row in the capture share
                        the color.
device accents ........ Each device type has its own accent, shown as the dot on its label.
camera ................ A 28° camera looks down on the network like a diorama. Drag to
                        orbit, right-drag to pan, scroll to zoom, and click a device to
                        inspect it.
playback .............. Four speeds from 0.5x to 4x, with a strip of ticks that marks every
                        frame.

WHERE IT STANDS

  # Live, with the code public and no tests yet.

guided labs ........... 7
devices in the base network
                        8
issues the health score checks for
                        9
automated tests ....... 0

WHAT’S NEXT

  # What I’d change where NetTracer stops short.

  # Next
real checksums ........ Swap the hash for real ones’ complement checksums on IPv4 and UDP. A
                        real IPv4 checksum still changes with TTL, so lab 02 keeps its
                        point.
tests and ci .......... Turn the per-lab figures on this page into the engine’s first tests,
                        and run them on every pull request. The engine already runs without
                        a browser.
a phone view .......... Put a still of a lab above the Open anyway button, or build a layout
                        for small screens.
a check by hand ....... Walk the capture rows by keyboard, then play a capture with reduced
                        motion turned on.

  # Known limits
checksums ............. The IP and UDP checksums are hash stand-ins. They won’t match a real
                        capture.
no tests .............. Nothing checks the engine yet, and the repo has no CI. One pull
                        request has merged since the first build on November 5, 2026, and it
                        added no tests.
desktop only .......... There is no phone layout. A small screen gets the note and the Open
                        anyway button.
keyboard and motion ... Capture rows now take keyboard focus, and Up, Down, Home and End
                        move between frames. With reduced motion on, a new capture waits for
                        Play and packets move only when you play or step. The pull request
                        notes list both changes as not checked.

TL;DR

built ................. A network lab in the browser where packets cross a 3D network one
                        frame at a time.
found ................. The three broken labs open with the lowest health scores, 35 to 45,
                        and each delivers after its first fix.
  # by the numbers
  7 ................... Guided labs
  9 ................... Issues the health score checks for
  0 ................... Automated tests
the catch ............. Nothing checks the engine yet. These scores come from running it in
                        Node, with 0 automated tests behind them.
next .................. Swap the hash stand-ins for real ones’ complement checksums on IPv4
                        and UDP.

LINKS

open nettracer ........ nettracer.andrewlengly.com
code .................. github.com/AndrewLengLy/nettracer
the developer side .... /machine/developer

# end of /machine/nettracer-casestudy. andrew.leng.ly@gmail.com · leave machine mode