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 restart network-manager
. - 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/dev
), and add the lineaddress=/dev/127.0.0.1
to have dnsmasq resolve requests for *.dev domains. Restart Dnsmasq:sudo /etc/init.d/dnsmasq restart
.
source: http://brunodbo.be/blog/2013/04/setting-up-wildcard-apache-virtual-host-wildcard-dns
Might not be the case in 2013, when I wrote this gist 😁
It might not be a good idea to set up
.dev
like that, because since then a real.dev.
TLD was created (it’s owned by Google).Nowadays I prefer using
*.localhost
, which resolve to::1
without any setup (on Ubuntu at least).