DNS Caching in Ubuntu Desktop
In a previous blog entry I described setting up a caching-only DNS server to speed up hostname resolution on Debian systems. I've recently been playing with Ubuntu and noticed that this hack is not working.
Some investigation lead me to two blog entries.
- This describes changes to DNS in Ubuntu 12.04 and their rationalle
- This blog entry describes dsnmasq and how to switch NetworkManager to use your own dnsmasq setup.
I have found that I can continue to use my own bind9 setup (not wishing to learn about dnsmasq(8) today) by combining sugestions from the two blogs.
- Setup DNS caching server per my existing procedure for Debian
- edit
/etc/NetworkManager/NetworkManager.conf
and comment out (with a#
) the linedns=dnsmasq
- edit
/etc/resolvconf/resolv.conf.d/head
and add the linenameserver=127.0.0.1
sudo restart network-manager
Now test it:
mjl@hoppy:~$ time nslookup australia.gov.au Server: 127.0.0.1 Address: 127.0.0.1#53 Non-authoritative answer: Name: australia.gov.au Address: 205.239.168.12 real 0m0.630s user 0m0.008s sys 0m0.000s mjl@hoppy:~$ time nslookup australia.gov.au Server: 127.0.0.1 Address: 127.0.0.1#53 Non-authoritative answer: Name: australia.gov.au Address: 205.239.168.12 real 0m0.012s user 0m0.000s sys 0m0.008s
The (real) time dropped from nearly 2/3 of a second to under 1/64 seconds!
Once again visiting sites with lots of DNS lookups is improved dramatically.