Skip to main content
 

Fix slow DNS responses on Ubuntu

I've been finding that browsing has been slow for me lately on my linux box, which has Ubuntu 16.04 installed. After some investigation it seemed worthwhile to try to install a DNS cache to speed up DNS queries. This has sped up successive DNS queries from 21ms to 0ms, removing sluggishness.

sudo apt install bind9
cd /etc/resolvconf/resolv.conf.d
sudo echo "nameserver 127.0.0.1" >> head

Apply the configuration as follows:

sudo resolvconf -u

The improvement can be seen by using dig to query a domain and looking at the Query time output. After the first dig, subsequent digs return in 0 ms.