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.

Can I configure resolv.conf to use a specific nameserver for a domain?


nameserver internal.thekelleys.org.uk

I don't want to list *.test.com in /etc/hosts; I don't want to install a DNS server locally (dnsmasq -S /internal.thekelleys.org.uk/; and I don't want the internal.thekelleys.org.uk DNS server to serve other domains.

share|improve this question

1 Answer 1

You can't. The resolver is not designed that way. You'd have to write your own resolver and either preload it into your applications or use NSS to have it examined first.

share|improve this answer
could i add this feature to the resolver and submit a patch? is this part of libc? –  Jayen Oct 31 '11 at 7:06
I recommend not screwing with the existing resolver. And with NSS, there's no need to anyway. –  Ignacio Vazquez-Abrams Oct 31 '11 at 7:16
Errr actually that would be a useful adition. Something along the lines os OS X where you can create a /etc/resolver/example.com and then example.com will be resolved thru the nameservers specified in that file... –  Server Horror Oct 31 '11 at 12:35
And further I do recommend fiddling with stuff!. Without people screwing around there won't be any progress! –  Server Horror Oct 31 '11 at 12:37

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.