Linux Commands / IT Support Guides
Check Linux route selection with ip route get
Check which interface and gateway Linux would use to reach one IP address.
Environment and inputs: Linux · Bash-compatible shell; package and service names vary by distribution
Understand the problem
Use the affected machine or container. Replace the documentation address 192.0.2.10 with the destination you actually need to reach.
Run the command
Run ip route show to inspect the main routing table, then run ip route get with the destination IP. The second command performs a local route lookup.
ip route show
ip route get 192.0.2.10
Read the output
In a result such as 192.0.2.10 via 192.0.2.1 dev eth0 src 192.0.2.25, via is the gateway, dev is the outgoing interface and src is the selected local source address. Some routes are direct and omit via.
Choose the next step
Compare the selected interface and source address with what you expect. If Linux reports that the network is unreachable, check the interface address and routing configuration.
Before making changes
A route lookup shows the local routing decision. Confirm reachability separately before changing a gateway or routing rule.