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

Does anyone know if it's possible to limit queries to a specific name server using dnsmasq? As an example:

All queries for anything on should only be answered by server A. All queries for the Internet should only be answered by server B

In this case server A is my ISPs main name server and it handles queries for the Internet and also the customers Intranet (the 172 network) Unless I use their name server I cannot access resources on the Intranet. However, I also wish to use a VPN but the ISPs name server leaks on dns leak test.

I have looked at the server=/ section of the dnsmasq man page but I can't tell whether it will work for the scenario described above.


share|improve this question
Are you querying PTR records? – Gevial Mar 4 '13 at 10:10
No, straight forward lookup. – Pulse Mar 4 '13 at 10:15

You just need to state the following in your dnsmasq.conf:


Queries to any host in ispdomain.tld would be answered by, where is your ISP's main name server.

And "server B"'s IP address should be stated in /etc/resolv.conf as this:


share|improve this answer
Thanks for the reply. I have tried this before but it doesn't prevent the isp name server from answering Internet requests and thus leaking. – Pulse Mar 4 '13 at 22:04
It SHOULD answer Internet requests as well, but it is your right to use it for resolving only several domains while using "server B" for other requests. – Gevial Mar 5 '13 at 6:18
I appreciate it should answer Internet queries but that's what I'm trying to prevent. – Pulse Mar 5 '13 at 23:10
Suggested setup in my answer should work. Using server A or server B depends on domain name queried. What's exactly wrong with it? – Gevial Mar 6 '13 at 7:28

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.