I am using google open DNS. How can I measure the speed of a DNS server?
If you just want to time the lookup of a single record, use
time dig a foobar.com @220.127.116.11. This testing method really isn't that good since after the first lookup, you'll be getting cached results and whatever server is closer to you will give you the fastest response.
namebench is probably the tool you're looking for. It does lookups based on domains are in your browser cache, random records from a list of popular records, etc. It is highly configurable to test your preferred list of DNS servers, your list of records, etc.
This helped me on the bash prompt. I had an issue where the name servers were randomly timing out. You need the dig utility, which is not a default on minimal installs. You can get it by installing
$ yum install bind-utils
for Fedora/RedHat/CentOS or
$ apt install dnsutils
$ while true; do dig www.google.com | grep time; sleep 2; done
This yields an output like:
;; Query time: 2 msec ;; Query time: 1 msec ;; connection timed out; no servers could be reached ;; Query time: 1 msec ;; Query time: 53 msec ;; connection timed out; no servers could be reached ;; connection timed out; no servers could be reached ;; Query time: 2 msec ;; Query time: 5 msec ;; Query time: 3 msec
On a healthy connection, it should be no more than 2 msec a query.
sudo apt-get install namebench namebench ... > Sending 1 queries to 7 servers... [0/7] > Sending 1 queries to 7 servers... [4/7] > Sending 1 queries to 7 servers... [6/7] > Sending 1 queries to 7 servers... [7/7] > Saving report to /tmp/namebench_2019-08-13_1148.html > Saving detailed results to /tmp/namebench_2019-08-13_1148.csv > Opening /tmp/namebench_2019-08-13_1148.html > Complete! SYS-127.0.0.53 [127.0.0.53] is the best. Au revoir, mes amis!
and make an html report with the results of the best dns for you based on response speed of dns