site  contact  subhomenews

dnsmasq caching nameserver for Easy

May 27, 2018 — BarryK

I posted earlier today about some issues with my new Telstra mobile connection:

http://bkhome.org/news/201805/trouble-with-telstra-mobile.html

I wondered if maybe Telstra's nameserver is overloaded. I don't always have "unresolved url" problem, so maybe in my area the network is getting stressed at certain times of the day.

So, I am playing with dnsmasq, configured as a local caching nameserver. This website explains how:

http://www.g-loaded.eu/2010/09/18/caching-nameserver-using-dnsmasq/

I have played with dnsmasq before, and was considering it to use with EasyShare, for network discovery. That's another story. Considering the immediate requirement, as a local caching nameserver...

Easy (and Quirky, and all the pups), use /etc/resolv.conf, which has the IP-address of the nameserver. Summarising, at bootup, 'dhcpcd' is run, which queries a dhcp-server on the network (which is usually in your router-modem), and dhcpcd writes to /etc/resolv.conf.

In my case, this is the content of /etc/resolv.conf:

nameserver 192.168.0.1

If dnsmasq is setup as per the above link, /etc/resolv.conf has to be copied to /etc/resolv.dnsmasq, and /etc/resolv.conf changed to:

nameserver 127.0.0.1

Then, 'dnsmasq' daemon is started, just by typing it's name in a terminal.

Applications such as SeaMonkey look at /etc/resolv.conf for converting URLs to IP-addresses, and the above changes cause SM to query the local dnsmasq daemon, instead of the remote nameserver (192.168.0.1 in my case). The dnsmasq daemon queries 192.168.0.1, gets the IP-address, and caches it locally, so next time there is a lookup of that URL, dnsmasq already has the IP-address.

This can speed-up web browsing, and I am also wondering if it will solve my name resolution failures.

Testing it now, so far, so good. I wondered if downloading of large files will improve, if multiple queries are made to the nameserver during a download -- don't know if that happens, just a thought.

Downloaded latest firefox, which earlier today kept stopping. Using SM Download Manager, the download stopped once, hit "Pause" then "Resume" and download completed.

The jury is still out. It may be that the Telstra network is less busy right now.

If I decide to make this a permanent feature of Easy, it will require many changes. There are scripts that expect the nameserver IP-address to be in /etc/resolv.conf, and 'dhcpcd' daemon itself will have to be told to write to /etc/resolv.dnsmasq. But, it is doable.

Tags: easy