Get the interface and ip address used to connect to a specific host (ip)

Posted by umop on Server Fault See other posts from Server Fault or by umop
Published on 2012-06-22T20:19:46Z Indexed on 2012/06/22 21:18 UTC
Read the original article Hit count: 247

I'm sure this has been asked and answered before, but I wasn't able to find it, so hopefully this will at least link someone to the right place.

I want to find out my local interface and ip address used to reach a certain host. For instance, if I had 3 adapters connected to my box and they all three went to different networks, I'd like to know which of the three (specifically, its ip address) is used to reach my.local.intranet (in this case, it would be a vpn tunnel interface). I suspect this is a job for ifconfig or traceroute, but I haven't been able to find the correct switches.

I'm running OSX 10.7 (Darwin)

Thanks!

© Server Fault or respective owner

Related posts about macosx

Related posts about ip-address