Tags: dnsmasq linux
I started by editing /etc/hosts when adding new local domain names. But then I heard about dnsmasq which is the better option.
sudo aptitude install dnsmasq
Edit dnsmasq configuration:
sudo vim /etc/dnsmasq.conf
And add a line like this (in order to use all submodmains like *.localhost):
Edit /etc/resolv.conf to always look for localhost on dns lookups first. This should be the first nameserver in the file:
Your /etc/reolv.conf file which is (depending on your setup) automatically created on boot, should also know that we need to keep 127.0.0.1 as first name server. In order to do this we uncomment the following line in /etc/dhcp/dhclient.conf
prepend domain-name-servers 127.0.0.1
For dhcp3 you will need to add this line (note the ';')
prepend domain-name-servers 127.0.0.1;
Now it should work from boot every time!