Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

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'm using some sort of a dns-proxy service (the details aren't clear but as far as I understand it works by resolving the the domain into a cloud based proxy server and returning it's address whilst configuring it to forward my requests to the actual domain)

what I want to do is to use said DNS only when necessary (i.e. when accessing a specific domain) otherwise use the default resolving method.

I've gone over the resolv.conf manual and seen the post Configuring nameserver per domain?. the OP seems to want something similar.

Is there a simple method for achieving this? I think split DNS (from the little I understood) is quite the overkill (if its the only way, I will appreciate some sort of guide please).

the OS is Linux Ubuntu 12.04.

share|improve this question
I think I can explain how to do this by using a BIND instance running locally, and using in resolv.conf, but this is rather overkill. Are you able to explain which dns-proxy service you're using? As I don't see myself why setting this service up for one domain would also force it to be used for other domains, each domain has its own set of authoritative nameservers so the DNS records can be totally different for each; your question doesn't make sense to me in the way that you've worded it. – gac May 28 '12 at 14:53
Actually, I think I now understand what you mean. The answer below, and setting up BIND as a local, forwarding-only resolver, is the only solution I can think of right now. – gac May 28 '12 at 14:56
possible duplicate of Is there a way to use a specific DNS for a specific domain? – mgorven May 28 '12 at 20:16
up vote 0 down vote accepted


run the following commands

sudo apt-get install dnsmasq

then edit /etc/dnsmasq.conf (with sudo!)

find the following string in the file


and add afterwards


for all the other domains it will automatically use the same DNS as your system used before.

don't forget to

sudo /etc/init.d/dnsmasq restart
share|improve this answer

You can setup a local DNS resolver.

Then, if you need to use specific resolver for a domain, just forward DNS query to the resolver by setting a forward zone in your bind configuration :

zone "" IN {
    type forward;
    forwarders {;;};

zone "" IN {
    type forward;
    forwarders {;;};
share|improve this answer

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.