Vi.
Vi.

Reputation: 38694

How to check what route (interface) does a destination IP address belong to without sending anything?

How to look up IP address in routing table (retrieve network interface index and MAC) without sending any packets there?

Upvotes: 2

Views: 2548

Answers (1)

Joe
Joe

Reputation: 28316

You could use the ip command:

# ip route get to 74.125.228.197
74.125.228.197 via 192.168.1.1 dev eth0  src 192.168.1.100

And once you know the interface you can get its index and link/ether(MAC) address:

# ip addr show eth0 
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 100
link/ether 88:00:00:00:f2:4c brd ff:ff:ff:ff:ff:ff
inet 192.168.1.100/24 brd 192.168.1.255 scope global eth0
inet6 fe80::3039:34ff:fe2c:f24c/64 scope link 
   valid_lft forever preferred_lft forever

Upvotes: 4

Related Questions