Skip to content

# Route & Longest-Prefix-Match Visualizer

Forward a destination address through an editable routing table and watch the longest-prefix-match lookup work: every route is tested, the matching ones are shown, and the most specific prefix wins (ties broken by administrative distance, then metric).

Working out the prefixes to put in the table is the Subnet Calculator: a CIDR in, and its network, broadcast, netmask and host range out. The destination this page forwards sits in an IPv4 header, which the Packet Analyzer decodes field by field.

About this lab4 paragraphs

The result (forward via a gateway, blackhole, or unreachable) is explained.

The table is free text on purpose: it takes the shape `ip route` prints, so a table copied off a real box can be pasted in and asked a question. Beyond `via`, `dev` and `metric` it reads `proto <source>` and `distance <0-255>`, and every parsed route gets a distance field beside the table that writes back into its own line. A keyword it can only half read (a `distance` with no number) drops that line rather than guessing at it, and the skipped line is visible where a guessed field is not.

Every route is tested and shown, including the ones that lose, because the losers are the interesting part. Longest prefix match is not "first match" and not "best metric": a /24 beats a /8 that was listed first and beats a /8 with a better metric, and seeing the candidates side by side is the fastest way to stop expecting otherwise. The diagram draws the same candidates as paths from this host to the destination, so a loser that could have carried the packet still reaches it and a route that does not cover the address stops at its next hop; it augments the decision block rather than replacing it.

It forwards one packet through one table. There is no policy routing, no multiple tables, no equal-cost multipath and no next-hop recursion. The same lookup runs offline through `route-cli`.

Use it locally This lab has a native command line twin. Build `route-cli` from the site's source with:

    cargo build --release --bin route-cli

Source and licence terms