Table of Contents
Ubuntu - Networking - DNS - dnsmasq - Install dnsmasq
sudo install dnsmasq
Configure Dnsmasq
Don't change /etc/dnsmasq.conf.
Setup 127.0.0.1 as DNS server name in /etc/resolve.conf file:
- /etc/resolve.conf
nameserver 127.0.0.1 nameserver 1.1.1.1 nameserver 9.9.9.9
NOTE: Ensure that 127.0.0.1 is listed as the first nameserver address in /etc/resolv.conf.
This ensure that local clients always gets cached queries.
Replace 1.1.1.1/9.9.9.9 with the DNS servers you prefer.
dnsmasq should read the list of nameservers automatically from /etc/resolv.conf.
Restart Dnsmasq
/etc/init.d/dnsmasq restart
Update your devices to point to the DNS server
Point your clients to the address of the server running Dnsmasq.
It is easy to use Dnsmasq rather than setting up caching BIND server.
But hold on it has some cool usage too.
You can add domains which you want to force to specific IP address.
For example, doubleclick.net displays ugly adds on many sites, just send this server it to our 127.0.0.1 (i.e. your local server ).
Just open a file /etc/dnsmasq.conf and add following line to it:
- /etc/dnsmasq.conf
address=/doubleclick.net/127.0.0.1
Restart Dnsmasq
Restart Dnsmasq and make sure you run local webserver at 127.0.0.1 with some default page.
Read the Dnsmasq man page and docs for more information.