User Tools

Site Tools


networking:dns:improve_dns_performance:dnsmasq

Networking - DNS - Improve DNS Performance - Dnsmasq

dnsmasq is a lightweight DNS, TFTP, PXE, router advertisement and DHCP server.

It is intended to provide coupled DNS and DHCP service to a LAN.

Dnsmasq accepts DNS queries and either answers them from a small, local, cache or forwards them to a real, recursive, DNS server.


Install Dnsmasq

sudo install dnsmasq

Configure Dnsmasq

Dont 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

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.

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.


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 and make sure you runs local webserver at 127.0.0.1 with some default page.

Read the Dnsmasq man page and docs for more information.

networking/dns/improve_dns_performance/dnsmasq.txt · Last modified: 2020/07/15 09:30 by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki