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

In resolv.conf, I have list of nameservers. Is is somehow possible to make resolver use given dns server only for hosts for given domain?

I envision it like this (this is purely theoretical syntax, doesn't work anywhere as far as I know):

nameserver for

it would work like this: when I need ip for host "" it would query, but for - it would query

Kind of like routing table, but for dns requests.

Operating system is Linux - if that matters.

share|improve this question
up vote 2 down vote accepted

No, this is not possible. However, you can use what is called split DNS.

Install a DNS server and configure it to do recursive queries, using the DNS servers provided by your ISP as forwarders. This ensures that all names that can be resolved on the Internet, will be resolved. Update your DHCP server so that it hands out the IP address of this name server to all its clients, this ensures that all computers on your local network use this DNS server (instead of the ISP's server).

Now you can start configuring zones for which you want the traffic to go somewhere other than normal. This can include domains that you don't own. Since this is a local DNS server, you are not confusing anybody else, and on your LAN you can do what you like.

If you keep the TTL values very low, you will be able to change target IP addresses very quickly. And if you have to do this a lot, I would recommend webmin for a more convenient user interface (unless you are happy work from the command line).

share|improve this answer
I was afraid that the answer will be "install dns server", but at the very least - now i know :) – user13185 Aug 21 '10 at 19:31
@wolfgangsz can you please recommend a dns server for ubuntu that can do all that? – Boaz May 24 '12 at 12:28

Your Answer


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