← Networking
Linux · Networking
How to check the routing table and test connectivity in Linux
View the routing table with ip route and test reachability and the path to a host with ping and traceroute.
Check how traffic leaves the machine and whether a host is reachable. ip route shows the routing table and default gateway; ping tests reachability; traceroute shows the hops.
# Routing table and default gateway
ip route
# Which route would be used for a destination
ip route get 8.8.8.8
# Reachability (5 packets)
ping -c 5 <host>
# Path to the host
traceroute <host>
tracepath <host>Linuxip routeping