View ip route for a given IP

If you are connected to VPN or have multiple network interfaces on your machine, and want to see what route is the machine using, to which interface run:

ip route get IP_ADDRESS
Bash

This will output in following format showing the interface and gateway:

# ip route get 127.0.0.1
local 127.0.0.1 dev lo src 127.0.0.1 uid 0 
    cache <local> 
  
# ip route get 8.8.8.8
8.8.8.8 via 192.168.8.1 dev enp0s13f0u1u2u1 src 192.168.8.167 uid 0 
    cache 
Bash

Useful resources: