Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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 192.168.0.1
nameserver 192.168.3.15 for example.com test.com

it would work like this: when I need ip for host "a.example.com" it would query 192.168.3.15, but for serverfault.com - it would query 192.168.0.1.

Kind of like routing table, but for dns requests.

Operating system is Linux - if that matters.

share|improve this question
add comment

1 Answer

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.Jan May 24 '12 at 12:28
add comment

Your Answer

 
discard

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