Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

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

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

share|improve this question

/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 * 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
up vote 0 down vote accepted

This is actually dead-simple with dnsmasq:

# install dnsmasq
sudo apt-get install dnsmasq
# map anything ending in .dev to
echo address=/dev/ | sudo tee /etc/dnsmasq.d/dev
# restart to make it read new config
sudo service dnsmasq restart
# verify it's working
# has address
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.