Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How should I set up a server to map all subdomains of a domain to an IP?

I wish I could do something like that in the hosts file: *
share|improve this question
Not in hosts but in your DNS server. – mailq Dec 21 '11 at 21:13
All subdomains of parent domain or hosts unside domain? They are very different things – Lazy Badger Dec 22 '11 at 4:58
up vote 6 down vote accepted

As mailq mentioned, DNS supports wildcard host entries (while the hosts file does not).

A DNS record with the name * will match all names for which there is no other record on that name, returning the wildcard record.

An entry would look like this:

*    IN    A

But, I'm not sure why you'd want to do that pointing to - can you clarify what you're attempting to accomplish with this, and we might be able to point you in a better direction?

share|improve this answer
CNAME works for hosts, not subdomains as OP asked – Lazy Badger Dec 22 '11 at 5:00
@LazyBadger Huh? Who said anything about a CNAME? – Shane Madden Dec 22 '11 at 6:09
mea culpa, think and write in parallel. Wildcard RR haven't relation to CNAME, shure – Lazy Badger Dec 22 '11 at 6:42

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.