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.
-
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).
depesz : I was afraid that the answer will be "install dns server", but at the very least - now i know :)From wolfgangsz -
One other way is to list up to (3) nameservers.... And set up resolv.conf thus:
domain here.com
search there.com here.com somewhereelse.com
nameserver xxx.xxx.xxx.xxx # here
nameserver xxx.xxx.xxx.xxx # there
nameserver xxx.xxx.xxx.xxx # somewhere else
Most Unix os's will look at up to 3 nameserves (top down) for resolution only...
The other answer would be to place some IP's into the /etc/hosts file for quick reference, as lookups should be set to look there first.
depesz : But neither of these solves my particular problem - putting 3 nameservers doesn't help if I can't make resolver send queries for domain "x" to nameserver "y". and adding to hosts - well, it's possible, but complicated, a lot of work, and error prone in case of ip changes.Rick Gillette : I do not believe anyone has ever created an "intelligent" resolv.conf for any OS. It really is not the purpose of resolv.conf to make domain-based decisions. It exists to identify to it's own server where it lives and how to find others within it's "search" parameters. Good luck!From Rick Gillette
0 comments:
Post a Comment