Benchmarking DNS resolution time at home

Benchmarking home DNS resolution

Typically we tend to use our ISP’s DNS servers on our home networks. This is what 90% of the people who have an internet connection are using today. Typically this is automatic and part of your ISP setup process and since you are behind a NAT (or two) and your IP is dynamically allocated, the DNS server is also configured by your ISP’s DHCP server. This is all great if we want the raw and unfiltered advertisement loaded internet along with ISP being a big brother on your DNS traffic.

I had solved the problem of spammy internet by rolling out a Pi-hole server on my network and it has been working admirably well. Pi-hole is one of those projects that one should have running on their networks. Please support them by Donating to Pi-hole whatever you can.

Back to my DNS resolution, one thing I noticed was that the DNS resolution times were still randomly high for some domains. There were times when opening a new website would take “just that little bit longer” than usual and it was a one time thing (clearly indicating its a DNS resolution issue). So I wanted to fix that when I had some free time. This weekend was that day.

I went looking for a tool that will bechmark various DNS servers to find out which one was the fastest. I found a project from Google called namebench that seems to be abandonware. I realized that I can probably cobbler something myself to run the test. While I cant address every edge case that Google has handled but for comparing various DNS servers for my personal use, I thought I would build it myself.

Thus was born the dnsbench a simple python script that will test a bunch of public DNS servers and find out the top best 3 choices. Currently it benchmarks some of the popular public DNS servers out there that I found from Wikipedia. It is maintained as a dict in the python code, feel free to change / add it and send me a pull request.

In summary, I found that a specific cloudflare server, 1.0.0.1 gave me the best results for my geographic location. You should explore what works best for you by running this script on your home network.

Yes my DNS resolutions are way faster now and the slowness is history.

updatedupdated2021-05-232021-05-23