1

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.

1 Answers1

2

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).

wolfgangsz
  • 8,767
  • 3
  • 29
  • 34
  • I was afraid that the answer will be "install dns server", but at the very least - now i know :) –  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