Every time there is a new DNS service announced a lot of folk rush to use these new settings because of promises of lightning fast lookup speeds. In this article we will run through some quick and dirty testing you can do to see if a different DNS is right for you.
This article comes off the back of lots of discussion over the new 188.8.131.52 by CloudFlare, one thing we won’t be covering is who you should use. It bares mentioning that speed is not the only thing we should care about from a DNS service. Privacy, security, and ethical behaviour are all things you should take into account.
A quick refresher on DNS
The very quick overview of DNS is that we humans like using domain names (
tosbourn.com) but computers need to know which IP address (
184.108.40.206) that domain name lives on so it knows where to go looking for it.
When you type a domain name into your browser, a DNS’ job is to resolve that name to an IP address.
This is a bit of plumbing that just needs to happen, so the faster it can happen the better.
Location and ISPs
We’re going to look at two different metrics you could use to decide which DNS is faster for you, the reason why you might want to run your own tests instead of reading a blog post explaining the difference is that your speed will be effected by how far away you are from the DNS and how your Internet Service Provider acts.
The first thing we can run is
ping lets you send an
ECHO_REQUEST to a network host, which is the equivalent of shouting “HELLO WEBSITE.COM” and seeing if it responds.
ping we can send these requests to the various DNS hosts we want to test and look at the results.
In the above command we called
-c 5, this says “send the request 5 times”. The
220.127.116.11 is the DNS server we’re testing.
Here is the output of that command:
The numbers we care about are the ones after
time=, we should take an average of them to give the DNS a score for ping times.
ping should work on most Unix and Windows based operating systems.
The times given back from
ping are really easy to compare but have some issues. A server could decide that responding to
ping isn’t that important which would make a DNS look slower than it maybe it. A more realistic speed would come from actually asking that DNS to perform a lookup for us.
dig is a DNS lookup utility. It is purpose built for this type of stuff.
We can call it like so:
What we’re saying here is use
18.104.22.168 as the DNS and lookup
Running that command gave me the following output.
That is a lot of information! We care about
Query time. In this example it was
If you wanted to compare several websites (the ones you use most frequently) and several DNS services this could become tiresome. Here is a script that could help:
This uses some
bash scripting to do a
for loop, iterating over some websites we care about and assigning them to the temporary variable
For each domain it will create two variables
google_dns, these both perform the
dig commands and pass their results to a tool called
awk which extracts information from output.
Once we have just the numbers we need, we use
printf to output a line with our results. When we run that script we will get something like:
If all you care about is speed, then the DNS with the lower number for the websites you care about is probably your best bet.
dig should work on most
unix based operating systems, for Windows you will need to install it.