0

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 internal.example.com it resolves to 192.168.10.7 for example and for the rest go through google at 8.8.8.8.

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

1
  • Have a +1 to counteract the completely unjustified -1 someone gave you. Apr 4, 2012 at 5:25

3 Answers 3

7

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

3

You can do this in BIND with forwarders on a per-domain basis.

http://www.zytrax.com/books/dns/ch4/index.html#forwarding

http://gleamynode.net/articles/2267/

2

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.

1
  • 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, 2012 at 1:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .