Press "Enter" to skip to content

[Techy] localdomain settings in Linux Mint 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). So how can you do this?

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

Now you just need to configure it. Create a file in /etc/dnsmasq.d/ using something like nano, pico, vi, emacs :

sudo nano -w /etc/dnsmasq.d/localdomain.conf

with the following settings:

address=/localdomain/127.0.0.1
listen-address=127.0.0.1

This will tell DNSMasq to setup a wildcard for everything on “localdomain” to point to 127.0.0.1 and to listen for DNS requests on 127.0.0.1. Now just restart DNSmasq:
sudo service dnsmasq restart
and you are nearly done.

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!