Improve Client DNS lookup with Dnsmasq

dnsmasq provides a local DNS cache service that can speed up internet browsing. (see Ubuntu Dnsmasq documentation)

My mobile broadband connection is bad enough to frequently get "server name not resolved" errors. Installing dnsmasq should help.

In Ubuntu, can install with

sudo apt-get install dnsmasq

My netbook is using NetworkManager, I edit the Singtel connection setting and change the DNS servers to 127.0.0.1 . This setting is reflected in the /etc/resolv.conf

In /etc/dnsmasq.conf,  I modify the resolv-file setting to point to another resolv.conf file which should contain the name servers which dnsmasq can send/forward dns queries.

I also uncomment the no-dhcp-interface setting since I do not need another dhcp service. And, change the cache-size to a larger value.

If you want to check what are the domain names being queried, uncomment log-queries. By default, the logs are in the /var/log/syslog.

When dnsmasq receives a SIGUSR1, dnsmasq writes some statistics to the system log. With log-queries enabled, a complete dump of the contents of the cache is made.
This can be done with

sudo kill -USR1 <dnsmasq pid>

A DNS query can be tested easily with dig, like:
dig www.google.com

Comments

blog comments powered by Disqus