Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. 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

It seems that wildcards are not supported in the /etc/hosts file.

What is the best solution for me to resolve all *.local domains to localhost?

share|improve this question
What distro are you using? – Mark Davidson Oct 21 '10 at 8:22
@Mark Ubuntu 10.10 – Peter Smit Oct 21 '10 at 11:12
possible cross site duplicate of: serverfault.com/questions/118378/… – Ciro Santilli 巴拿馬文件 六四事件 法轮功 Aug 6 '14 at 9:30
up vote 14 down vote accepted

You'd really need to run your own DNS server and use wildcards. Exactly how you'd do that would depend on the DNS package you ran.

share|improve this answer
Indeed. This is rather trivial with dnsmasq; a configuration with address=/local/ does what OP requests. – ephemient Oct 21 '10 at 13:25

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.