Routing Table
Cheat sheet · https://pcornel.dk/topic.php?topic=2777
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.
Remember
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.
First checks
ip rule— policy routing rulesip -br addr— interfaces and addressesip route— routing table and default routeip neigh— ARP/neighbour cacheip route get <dest>— route, interface and source chosen for a destinationnmcli device status / networkctl— which tool manages each interface
Commands
ip route show table main- Shows Linux IPv4 routes in the main table.
ip route get {{destination}}- Asks the kernel which route/source/device would be used for a destination.
ip -6 route show- Inspect IPv6 routes and default-router selection.
ip rule- Fast checks
ip routeip route getip route add
Verify in this order
packet → ip rules choose a table → longest prefix match → lowest metric → next hop and interface
Where it usually breaks
First mismatch in link/interface → address/namespace → route/neighbor → firewall/policy → socket/daemon → DNS/TLS/SSH/application peer path; preserve identity/native diagnostic/pre-state before mutation.
Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=2777