Pcornel
Browse topics
Options
Recent
Favorites
Linux · Technical reference

Routing Table

Direct answer

The Linux routing table decides where each packet goes: the most specific matching route wins, then metric. ip route shows the main table; policy routing (ip rule) can select other tables.

First 30 seconds

1. ip route get <dest> — which route, interface and source?

2. ip route — expected specific route present?

3. Multiple tables? ip rule and ip route show table all.

4. Add temporarily: ip route add <net> via <gw>; then persist in the tool.

5. Test the path: tracepath <dest>.

Operational verification

packet → ip rules choose a table → longest prefix match → lowest metric → next hop and interface

Evidence · next step

For Linux Networking → Routing Table, continue with the first unproven Topic check: Capture relevant ip rule ordering and all tables used by the flow, not only main. If that boundary is healthy, advance to the adjacent check: Run a route lookup using the exact destination and source/context of the failing traffic. Preserve the same host/time/identity scope and rerun the original workload before accepting recovery.

Continue only after interpreting the current observation.
Context & applicabilityCommon mistakes · platform/version boundaries
Platform / version applicability
linux
applies
Structured applicability is explicit Topic metadata; it does not infer compatibility beyond the stored rows.
At a glance

Operational reference

Fast context before you go deeper.

Platformlinux
Key commandip route show table main
Scope / prerequisiteUse it when traffic leaves through the wrong interface, or a network is unreachable.
Verify · 1Reference · 2
What next?3 suggested next steps
Catalog command links3
Evidence1
On this pageJump to a specific section
Linux command reference

Primary Commands

Configuration and operational commands for this Topic.

Operational workflow

Verification & Troubleshooting

Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.

5 steps Observe → verify → isolate → change minimally → repeat the original test.
ObservedRecord what the original test actually shows

Capture the concrete output, symptom, packet, log or counter before changing anything.

Step 1 Operational evidence path Verify boundary

packet context → RPDB rule match → FIB table → longest-prefix/metric selection → route type + nexthop → output interface → neighbor → forwarding path → return path → workload

Healthy evidence: the exact packet context matches the expected policy rule and FIB route, nexthop/interface are usable, and the return path supports the original flow.

Step 2 Verification and output interpretation Verify boundary

Existing fast checks for this Topic. - Capture relevant ip rule ordering and all tables used by the flow, not only main.

  • Run a route lookup using the exact destination and source/context of the failing traffic.
  • Verify nexthop/interface reachability and neighbor state after route selection.
  • Validate both forward and return paths with the original protocol/service.

Verification chain. packet context → RPDB rule match → FIB table → longest-prefix/metric selection → route type + nexthop → output interface → neighbor → forwarding path → return path → workload

Step 3 Commands Verify boundary
ip route
ip route get 8.8.8.8
ip -6 route
Step 4 Failure modes and next checks Narrow the fault

Suspicious evidence: a route exists only in an unused table, policy rules divert traffic, source selection changes lookup outcome, or a valid local lookup masks an unreachable nexthop/return path.

Step 5 Common mistakes Narrow the fault
  • Adding routes with ip route add and losing them on reboot.
Evidence references

Evidence · 1 on this Topic

Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.

observation · 1
Key points

ip route get <dest> shows the actual decision including source address. Routes added with ip route add are temporary — persist them in NetworkManager, netplan or networkd. Check ip rule if you use multiple tables or VPNs.

Key checks
  • ip rule — policy routing rules
  • ip -br addr — interfaces and addresses
  • ip route — routing table and default route
  • ip neigh — ARP/neighbour cache
  • ip route get <dest> — route, interface and source chosen for a destination
  • nmcli device status / networkctl — which tool manages each interface
ReferenceWhat it is1 section · depth on demand

Core model

Do not read the main table as the whole routing decision. Reproduce lookup with the exact destination and, when relevant, source address, ingress interface, fwmark, TOS or VRF context. Distinguish route presence from rule reachability, nexthop usability and symmetric return routing.

ReferenceImportant terms & boundaries5 sections · depth on demand

What this shows and what it does not

A kernel route lookup shows the local host decision for the supplied context, but it does not show nexthop L2 resolution, downstream routing, remote policy or the return path.

In depth

The Linux routing table with ip route

Linux can hold many routing tables. Normal routes go into the main table, and ip route shows and changes them. The ip-route(8) manual page describes the tables:

  • main (254) holds normal routes.
  • local (255) holds local and broadcast addresses and is maintained by the kernel.
  • Table numbers can go up to 2^32−1, with names defined in /etc/iproute2/rt_tables.
  • 0, 253, 254 and 255 are reserved.

Route types

TypeEffect
unicastA real path to the destination (the default type)
localThe destination is this host
broadcastSent as link broadcast
unreachableDropped with ICMP host unreachable; local senders get EHOSTUNREACH
prohibitDropped with ICMP administratively prohibited; local senders get EACCES
blackholeDropped silently; local senders get EINVAL
throwEnds the lookup in this table, so policy rules continue to the next

Route attributes

AttributeMeaning
proto kernel / boot / static / raWho installed the route: the kernel (connected), at boot, the administrator, or IPv6 router discovery
scope link / global / hostDirectly attached / via a gateway / this host
metricLower values are preferred among otherwise equal routes
srcPreferred source address for traffic using the route
nexthop ... weightMultipath routes with relative weights

Asking the kernel instead of reading the table

ip route get resolves a destination exactly as the kernel would, including policy rules and source selection. It's the most reliable answer to "which way will this packet go?"

host$ ip route
default via 10.110.0.1 dev eth0 proto dhcp src 10.110.0.64 metric 100
10.110.0.0/24 dev eth0 proto kernel scope link src 10.110.0.64 metric 100
10.40.0.0/16 via 10.110.0.254 dev eth0 proto static
host$ ip route get 10.40.5.9
10.40.5.9 via 10.110.0.254 dev eth0 src 10.110.0.64 uid 1000
host$ ip route show table all | grep -v '^local\|^broadcast' | head
host$ ip rule show
0:      from all lookup local
32766:  from all lookup main
32767:  from all lookup default
host$ sudo ip route replace 10.40.0.0/16 via 10.110.0.253

Notes on the example

  • replace adds the route or changes it if it already exists. That makes it safer than add in scripts.
  • Since Linux 3.6 there is no IPv4 routing cache. Outdated advice to "flush the route cache" doesn't apply to modern kernels.

Documented example, not captured output.

Source basisSource attribution states what this section is based on; it is not independent proof that the current environment matches it.

How it works at runtime

Routing Table is part of Linux Networking → Routing Table. Linux route selection uses the routing policy database plus one or more FIB tables; prefixes, metrics, route types, source hints, nexthops, interfaces and policy rules determine the route selected for an exact packet context.

Topic-specific state model. Linux route selection uses the routing policy database plus one or more FIB tables; prefixes, metrics, route types, source hints, nexthops, interfaces and policy rules determine the route selected for an exact packet context.

Interpretation rule. - Route listed in a table ≠ route selected by the routing policy database.

  • Lowest metric ≠ universal winner across different prefix lengths, tables and rules.
  • Selected nexthop ≠ neighbor resolution or downstream forwarding succeeds.
  • Forward-path route success ≠ return path is valid or symmetric.

Quick reference

The Linux routing table (main table, plus policy-routing tables) decides the next hop and source address.

ip route show
ip route get 10.20.30.40              # route, device and src chosen for a destination
ip route add 10.50.0.0/16 via 10.0.10.254 dev eth1
ip route replace default via 10.0.10.1 dev eth0 metric 100
ip -6 route show
ip rule show                          # policy routing rules
ip route show table all | grep -v local

Selection: longest prefix, then lowest metric. Routes added with ip route are not persistent — configure them in NetworkManager, netplan or systemd-networkd.

Source basisSource attribution states what this section is based on; it is not independent proof that the current environment matches it.

Limits and how it fails

Primary failure point. A kernel route lookup shows the local host decision for the supplied context, but it does not show nexthop L2 resolution, downstream routing, remote policy or the return path.

ReferenceConfiguration & state1 section · depth on demand

Configuration, persistence and lifecycle

Distribution/platform context. Routing Table owns Linux kernel route/rule lookup semantics. Default Gateway is the default-route specialization; broader route failures are correlated in Network Troubleshooting.

Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Technical verification history

Verification history & basis

When and against what this Topic was checked. Later text edits do not count as a new check.

2026-09-14 · vendor doclinux current

Authoritative/upstream documentation reviewed for bounded claims in Linux Networking → Routing Table. Documentation verification only; this is not observed lab or production Evidence.

Basis: https://docs.kernel.org/networking/index.html · confidence 94%
Technical changelog & impact

What changed and what may be affected

Recent technical edits are separated from ordinary page timestamps. Relationship impact is advisory: it identifies nearby canonical references to review, not automatic breakage.

Related reference impactReview these references after material technical changes when their shared boundary is affected.
Terminology layer

Terms & aliases

Hover a linked term for a quick definition; click it to open its glossary entry. Aliases are other names that find this Topic in search.

Aliases that resolve here
linux routing tableip route linuxlinux fib routingip rule routing
Embedded reference data

Quick lookup tables

Routing Table operational reference

Topic-specific lookup boundaries, proof limits and next-step Evidence for Routing Table.

Lookup boundaryTopic-specific referenceOperational use
Scope / effective stateLinux route selection uses the routing policy database plus one or more FIB tables; prefixes, metrics, route types, source hints, nexthops, interfaces and policy rules determine the route selected for an exact packet context.Establish exactly what this Topic owns before crossing into another subsystem.
Fast verificationPin host + namespace + exact flow → identify configuration owner/renderer → identify ifindex/interface + topology → inspect link/carrier → inspect addresses → inspect neighbor resolution → reproduce route/rule lookup → verify VLAN/bond/bridge/MTU as relevant → inspect packets/socket → verify return path → repeat original workload.Use the shortest evidence path first; a fast check is a boundary test, not blanket proof.
Verification chainpacket context → RPDB rule match → FIB table → longest-prefix/metric selection → route type + nexthop → output interface → neighbor → forwarding path → return path → workloadTrace requested/configured state through effective state to the observed workload result.
Failure boundaryA kernel route lookup proves the local host decision for the supplied context; it does not prove nexthop L2 resolution, downstream routing, remote policy or the return path.Stop broad troubleshooting at the first boundary that is not supported by evidence.
Positive evidenceCorrelated Linux networking evidence can establish this proof path: packet context → RPDB rule match → FIB table → longest-prefix/metric selection → route type + nexthop → output interface → neighbor → forwarding path → return path → workloadUse this observation only for the specific claim it actually supports.
Evidence limitIt does not independently prove behavior outside the captured namespace, interface, local kernel, L2/path or workload scope. A kernel route lookup proves the local host decision for the supplied context; it does not prove nexthop L2 resolution, downstream routing, remote policy or the return path.Do not promote a local success signal into end-to-end or adjacent-dependency proof.
Next troubleshooting checkContinue from the first unproven boundary: confirm namespace and configuration owner, inspect ifindex/link/address/neighbor/route state for the exact flow, verify L2/MTU construction and packet movement, then test the listening service and return path before making additional changes.Continue to the next unresolved boundary while preserving the original test condition.

Routing Table · operational reference

Compact Linux state, persistence, verification and boundary reference for fast lookup.

Reference boundaryRouting Table
Topic pathLinux Networking → Routing Table
Runtime stateLinux route selection uses the routing policy database plus one or more FIB tables; prefixes, metrics, route types, source hints, nexthops, interfaces and policy rules determine the route selected for an exact packet context.
Fast checks- Capture relevant ip rule ordering and all tables used by the flow, not only main. - Run a route lookup using the exact destination and source/context of the failing traffic. - Verify nexthop/interface reachability and neighbor state after route selection. - Validate both forward and return paths with the original protocol/service.
Verification chainpacket context → RPDB rule match → FIB table → longest-prefix/metric selection → route type + nexthop → output interface → neighbor → forwarding path → return path → workload Boundary chain: local authoritative state → adjacent dependency → effective/programmed state → original workload/request → return/regression → explicit Evidence boundary. Boundary chain: local authoritative state → adjacent dependency → effective/programmed state → original workload/request → return path or regression → explicit Evidence boundary.
Failure boundaryA kernel route lookup proves the local host decision for the supplied context; it does not prove nexthop L2 resolution, downstream routing, remote policy or the return path. Boundary chain: process/socket namespace → source/rule/FIB → neighbor → netfilter/eBPF/qdisc → virtual/physical device → peer → return → application.
Persistence ruleProve which configuration source owns the state, then prove that the running consumer loaded or generated the intended state.
Confirmation

Confirm action

Continue?