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

I have a setup where one webserver (bar.com) is serving lots of subdomains, so it would be convenient to use a wildcard DNS entry. At the same time I'd like to use bar.com as search domain, so that foo resolves to foo.bar.com.

The problem now is that if I set it up like this, foo.com resolves to the webservers IP if there is no foo.com elsewhere (i.e. it first tries foo.com, fails, and then tries foo.com.bar.com, which gets matched by the wildcard).

This is very inconvenient because any hostname typos ends up at the webserver instead of producing an error. Is there a way to resolve this without specifying all the subdomains explicitly? I'm thinking something like a rule saying only "bare" hostnames (i.e. names without a dot in it) should go to the webserver. (I'm using BIND as DNS server, but the answer is probably general).

share|improve this question

2 Answers 2

up vote 2 down vote accepted

You shouldn't mix a wildcard domain, and a search domain in the same resolv.conf. If you want to try, switch search for domain;

# /etc/resolv.conf
nameserver x.y.z.k
domain bar.com
share|improve this answer

Unfortunately for you, this is a feature of a client, not server.

see man resolv.conf i.e. for unices, windows probably has different rules

share|improve this answer

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.