How to use wildcards for *.localhost in Ubuntu

I was tired of a very long /etc/hosts, with tens of lines with different test environments (client1.localhost, client2.localhost). So I found a way to make it easier: dnsmasq.

Information from and tested in Ubuntu Maverick 10.10 (should work on any Linux)

sudo aptitude install dnsmasq
sudo echo "address=/localhost/" >> /etc/dnsmasq.conf
sudo /etc/init.d/dnsmasq restart

Now you just add as a DNS server and you are done.

One comment.

  1. Thanks, you helped a lot, it’s exactly what i’ve needed.

Post a comment.