Displaying routing information on Linux shows which networks the kernel can reach directly, which gateway handles everything else, and which interface carries each path. That view is often enough to explain why a remote subnet is unreachable, why traffic leaves through the wrong adapter, or why a host is still using an old default gateway.
Current Linux distributions use the iproute2 toolset for route lookups. The plain ip route command reads the kernel's IPv4 routing table, while narrower forms such as ip route show default or ip route show 172.17.0.0/16 limit the display to one route when the full table is noisier than necessary.
The commands below are read-only and do not change network state. Route values vary by host, and systems using VPNs, multiple uplinks, or source-based routing can still choose a different path for a real destination, so finish with ip route get when you need to confirm the route Linux would actually use. If you need the IPv6 view, run the same commands with -6.
Related: How to check the default route in Linux
Related: How to add a static route in Linux
Steps to show routes in Linux:
- Display the current IPv4 routing table with ip route.
$ ip route default via 172.17.0.1 dev eth0 172.17.0.0/16 dev eth0 proto kernel scope link src 172.17.0.3
The default route is the fallback path for destinations that do not match a more specific network. Connected-network entries show the subnets the interface can reach directly without an intermediate gateway.
- Filter the output to the route you care about instead of rereading the full table every time.
$ ip route show default default via 172.17.0.1 dev eth0 $ ip route show 172.17.0.0/16 172.17.0.0/16 dev eth0 proto kernel scope link src 172.17.0.3
Use show default to isolate the fallback gateway, or replace the sample prefix with the subnet currently under investigation.
- Ask the kernel which path it would actually use for a destination.
$ ip route get 203.0.113.50 203.0.113.50 via 172.17.0.1 dev eth0 src 172.17.0.3 uid 0 cacheThe via value is the next hop, dev is the outgoing interface, and src is the preferred source address. If this lookup does not match the path you expected, continue with How to check the default route in Linux to inspect the selected default route and related routing context.
Mohd Shakir Zakaria is a cloud architect with deep roots in software development and open-source advocacy. Certified in AWS, Red Hat, VMware, ITIL, and Linux, he specializes in designing and managing robust cloud and on-premises infrastructures.
