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
/etc/NetworkManager/NetworkManager.confand comment out (with a
#) the line
/etc/resolvconf/resolv.conf.d/headand add the line
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: 188.8.131.52 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: 184.108.40.206 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.