Configure local wildcard DNS server
-
Install Dnsmasq:
sudo apt-get install dnsmasq
-
Since Ubuntu's NetworkManager uses dnsmasq, and since that messes things up a little for us, open up
/etc/NetworkManager/NetworkManager.conf
and comment out (#
) the line that readsdns=dnsmasq
. Restart NetworkManager afterwards:sudo systemctl restart NetworkManager
. -
Make sure Dnsmasq listens to local DNS queries by editing
/etc/dnsmasq.conf
, and adding the linelisten-address=127.0.0.1
. -
Create a new file in
/etc/dnsmasq.d
(eg./etc/dnsmasq.d/localhost
), and add the lineaddress=/localhost/127.0.0.1
to have dnsmasq resolve requests for *.localhost domains. -
Restart Dnsmasq:
sudo systemctl restart dnsmasq
.