Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have a domain test.dev bound to in /etc/hosts. How can I bind all the subdomains, e.g. any.th.ing.test.dev to as well?

share|improve this question

1 Answer 1

up vote 2 down vote accepted

/etc/hosts (where you'd make an edit) doesn't allow wildcards. This leaves you with two choices:

  1. Do without automatic subsdomains and just edit /etc/hosts each time you want a new one.

  2. Push all your DNS through a crazy DNS proxy (per this answer) and change your network settings to the proxy. This will likely slow anything that makes a DNS query down a little but should let you do anything you like with domains.

I personally settle for just setting them myself. It only takes 10 seconds. But you might have different, stranger requirements.

Edit: Just had an idea. If you have a real domain (with real DNS hosting) you could set *.local.mydomain.com to point to and that should work.

share|improve this answer
It looks like people are using bind9 to solve the problem? Do you have any experience with it? –  Fluffy Jan 11 '12 at 12:09
I'd lump that in with the crazy DNS proxy - which is essentially what it would be, just harder to configure. I don't have any experience with BIND9 but there is a help page. You'll need to make sure you're using the forwarders setting to make sure DNS queries that your local DNS can't resolve are passed onto your ISP. But yes, certainly an option. –  Oli Jan 11 '12 at 12:28
So from that help file, you want to mix the "Caching Server configuration" and "Primary Master Server configuration". –  Oli Jan 11 '12 at 12:31
Ok, I guess I'll go with dnsmasq, thanks –  Fluffy Jan 11 '12 at 12:51

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.