Route & Longest-Prefix-Match Visualizer

Forward a destination address through an editable routing table and watch the longest-prefix-match lookup work.

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 page explains the result, whether the packet is forwarded via a gateway, dropped (a blackhole route), or has no route at all.

The table is free text on purpose: it takes the shape ip route prints, so you can paste in a table copied off a real machine and look an address up against it. 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. If a keyword is incomplete (a distance with no number) the parser skips that whole line rather than guessing at it, and it shows you which line it skipped.

Every route is tested and shown, including the ones that lose, because the losers are the interesting part. The most specific prefix wins, with ties broken by administrative distance and then by metric. 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. A losing route that could still have carried the packet is drawn reaching the destination, and a route that does not cover the address stops at its next hop. The diagram adds to the Decision panel 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