Linux Mint: localdomain settings using DNSMasq

If you are developing websites on Linux Mint, then you might want to set a DNS Wildcard so that anything on localdomain (*.localdomain) resolves to your machine (i.e. test.localdomain, anything.localdomain). First of all, you need to install dnsmasq “a lightweight, easy to configure DNS forwarder and DHCP server”, this can be simply done using:

sudo apt-get install dnsmasq
sudo vim /etc/dnsmasq.d/localdomain.conf
 
address=/server1.com/192.168.0.160
address=/server2.com/192.168.0.159
 
sudo service dnsmasq restart

This will tell DNSMasq to setup a wildcard for everything on “server1.com” to point to 192.168.0.160 and to listen for DNS requests on 127.0.0.1. You now just need to change your DNS servers in network manager. On the Linux Mint task bar, right click on the network icon and select “Edit connections” and edit the connection you are using. Select “IPv4 Settings”. If you have “Automatic (DHCP)” selected, change it to “Automatic (DHCP Addresses only)”. Then add the DNS server 127.0.0.1 and others of your choosing (such as the Google 8.8.8.8 and 8.8.4.4 ones). All should now be working!


Leave a Reply