Configure to Select DNS based on Domain

dnsNetworkvpn

At my office, I have a hardware VPN with a split tunnel that routes all my traffic either to the public internet or to the other office, depending on IP address. However, to resolve the intranet hostnames to IP addresses, all of my DNS queries get routed to the internal server.

So, when the VPN link goes down, I lose almost all internet connectivity until I go in and manually configure my network interface (wifi in this case) to use 8.8.8.8 as my DNS. Then I have to erase that (so that it will revert to the DHCP-assigned addresses) to get back to the intranet when things are fixed.

Is there any way to configure OSX to use 8.8.8.8 as my default, but another DNS when querying on a specific domain?

Best Answer

What you're describing is a split-horizion DNS setup.

There's a pretty good walkthrough on how to do exactly what you want to do, but it will require root on your laptop and some command line patience to setup. In a nutshell, you'll be configuring your own DNS server on the laptop to forward your DNS requests to the right server.

If you're on Mavericks (not sure yet about Yosemite), it looks like bind isn't installed anymore. You'll want to get it with homebrew or similar. Check out this stack overflow Q/A. It should also have a default named.conf that you can just edit, but YMMV.