PUBLIC WORK / 2026

route-explain

Find out which route Linux selects for a flow and why your expected route may not be used. A read-only CLI for inspecting routing rules, tables, namespaces and VPN configuration.

TYPE

Network forensics CLI

STACK

Python · Linux · iproute2 · nftables

STATUS

v0.4.2 · Alpha · PyPI

LOOKUP

Inspect the routing decision.

Give route-explain a destination and any relevant source address, packet mark or network namespace. It asks the Linux kernel for the selected route, then gathers the policy rules, routing tables and available WireGuard or Tailscale context.

The report labels kernel lookup results as KERNEL, supporting context as INFO, and conflicts or unresolved questions as CHECK.

EXAMPLE

Why another interface won.

A route can exist in one table while policy sends a flow through another.--why-not checks the interface or table you expected against the kernel's selected path.

$ route-explain 10.70.0.12 --from 10.10.0.24 --mark 0x42 --why-not tailscale0

Kernel decision
  dev:    eth0
  table:  main

Why this path
  KERNEL kernel resolved the flow through table main on eth0
  CHECK  a more-specific route exists in table 52 via tailscale0

WHY NOT tailscale0?
  route exists, but the kernel selected table main on eth0

SNAPSHOTS & TRACES

Save and compare results.

A snapshot stores the kernel decision for one flow alongside its route, rule and interface context. Replay rebuilds that report from the saved evidence. Before-and-after diffs show changes to the selected route and surrounding configuration.

With existing nftables trace events, trace --correlate can match a flow and use its observed packet mark and input interface in another kernel lookup. The report compares that result with the original decision.

LIMITS

What the lookup proves.

A lookup shows the route the kernel selects for the supplied inputs at that moment. A lookup using nftables trace data does not by itself prove that a packet was rerouted at the observed hook.

NAT and conntrack are not reconstructed end to end, and some advanced policy-routing behaviour remains unresolved. Tracing requires packets already marked for nftables tracing. Collection is read-only: route-explain does not change routes or inject tracing rules.

INSTALL

Install route-explain.

Available on PyPI for Linux. Install with pipx install route-explain or uv tool install route-explain. The README covers requirements, flow selectors and namespace usage.