Trying to get this DNS caching working for natty 11.04.
Almost did it - but I can't get it to 'stick'.
Here's what i did to get it almost working:
(with thanks to all the contributors to this thread):
(Synaptic likes to also install the resolvconf package - this form of the command stops that)
Edit the pdnsd config file:
sudo apt-get --no-install-recommends install pdnsd
And make the changes suggested in post #1, i.e. comment out the server section for resolv.conf, and modify the other server to point to your favourite DNS server.
gksu gedit /etc/pdnsd.conf
Then modify these files:
to remove the # in the line:
gksu gedit /etc/dhcp/dhclient.conf
gksu gedit /etc/dhcp3/dhclient.conf
(i.e. uncomment it).
#prepend domain-name-servers 127.0.0.1;
Note: I could only get 'nameserver 127.0.0.1' to appear in /etc/resolv.conf by editing /etc/dhcp/dhclient.conf.
It is pointless editing /etc/resolv.conf as it is automatically generated.
Finally, check that /etc/default/pdnsd is like this:
(If START-DAEMON is commented out, or set to 'no', then it will be impossible to start pdnsd. Also, if AUTO_MODE is set to something, then your custom /etc/pdnsd.conf will be ignored)
# do we start pdnsd ?
# auto-mode, overrides /etc/pdsnd.conf if set [see /usr/share/pdnsd/]
# optional CLI options to pass to pdnsd(8)
Restart the system and test it using 'dig', e.g.
dig www.goog.com (some site you haven't visited before)
Check the dig query worked (no error):
Check the server used was 127.0.0.1
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 33790
If you dug an unvisited site, the reported query time should be around 50ms:
;; SERVER: 127.0.0.1#53(127.0.0.1)
Do another dig and the query time should become zero.
;; Query time: 24 msec
To check the cache size is increasing with each new web site, use
The first few lines of printout will contain:
sudo pdnsd-ctl status
10240 kB maximum disk cache size.
1207140 of 10496000 bytes (11.5%) memory cache used in 5022 entries.
The contents of my /etc/resolv.conf: (automatically generated)
(192.xxx.yyy.zzz is my router address)
# Generated by NetworkManager
However, in my case, pdnsd only worked successfully if, having logged in, I restarted it using:
Otherwise dig queries would always return a query time of 0 msec and the cache would not get updated.
sudo /etc/init.d/pdnsd restart
I tried a couple of ways to automatically restart pdnsd during login,
Inserted into /etc/rc.local :
Put script into /usr/local/bin :
& put a script launcher into /etc/xdg/autostart
But neither of these helped.
Something is amiss, but I don't know what.
[Motive for using pdnsd: if ever the PTB kill the internet by killing dns servers, a cache will mean you still have a connection]