MacOS – Location-aware hostname resolution

macbook promacosNetworkvpn

Here is my situation: I am running Tunnelblick on my MacBook (running Mavericks) to connect to my own VPN, which comprises several machines, both at home and at remote locations. I can of course use the VPN-internal addresses to enable communication between my MacBook and other machines but I would like to prefer local addresses for a machine, if possible.

Example:

I have a server that is running an AppleTalk daemon for Time Machine. This server is part of the VPN and as thus it’s reachable under a 10.x.x.x IP address. However, when I’m at home I would like to use the local 192.168.x.x IP address so that traffic doesn’t have to go over the internet (and my rather smallish outbound bandwidth). Currently I edit /etc/hosts every time I arrive at the office or at home to facilitate the switch.

Is there any way to have this switch happen automatically?

Best Answer

Maybe ControlPlane can help you.

ControlPlane allows you to build configuration profiles, contexts in ControlPlane lingo, for your Mac based on where you are or what you are doing.

ControlPlane determines where you are or what you are doing based on a number of available evidence sources and then automatically reconfigures your Mac based on your preferences. Evidence sources can include your current location, visible WiFi networks, attached USB devices, running applications and more. You can even write your own evidence sources using shell scripts!