Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I was wondering is there a way to configure a linux or windows machine to use separate nameservers depending on what domain is being queried.

Like for it resolves to for example and for the rest go through google at

The Primary reason for this would be use in a VPN.

share|improve this question
Have a +1 to counteract the completely unjustified -1 someone gave you. – John Gardeniers Apr 4 '12 at 5:25

The usual way to handle this is to configure your own DNS server that forwards requests for non-local domains to other DNS servers.

share|improve this answer

I can't answer for Windows, but this capability (selecting nameservers based on the domain name being queried) is not available under Linux. It is available on OS X, where it is extremely useful for exactly the reason you've described.

Under OS X, you use the scutil command to manipulate domain-specific DNS servers. It ain't pretty!

Here's a script that uses scutil to set up DNS for OpenVPN. In fact, you'll often find scutil discussed in the context of open-source VPN solutions like OpenVPN, vpnc, etc.

share|improve this answer
I've never heard of this functionality in OS X. How do you configure this stuff? DNS in the Advanced Network Dialog doesn't offer any way to differentiate the servers per domain. – Sven Apr 4 '12 at 1:19

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.