find default ip used for connection

ip route list

ip route get 8.8.8.8

# ip route get 8.8.8.8
8.8.8.8 via 100.126.1.1 dev eth0  src 100.126.1.100
    cache  mtu 1500 advmss 1460 hoplimit 64

# ip route list      
100.126.1.0/24 dev eth0  proto kernel  scope link  src 100.126.1.100
192.168.2.0/24 dev eth1  proto kernel  scope link  src 192.168.2.1
10.0.2.0/23 dev eth1  proto kernel  scope link  src 10.0.2.8
169.254.0.0/16 dev eth0  scope link  metric 1002
169.254.0.0/16 dev eth1  scope link  metric 1003
default via 100.126.1.1 dev eth0 

No comments:

Post a Comment