June 22, 2018 at 10:17 AM in Linux

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 cp -p head head.orig #backup
sudo nano head

Then add the following line:

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.