Linux for Network Engineers: How to Use DNSping

Continuing our coverage of ping-verse, after pathping, fping, gping, prettyping, nping, today we’ll talk about dnsping! There is more to come…

As its name reveals, dnsping is a utility that is focused in probing, troubleshooting, and measuring response time of DNS servers. Let’s see how you can install it and how you can use it.

The easy way to install it with the following:

Actually, dnsping is part of a package that also includes dnstraceroute and dnseval as we’ll see below.

As usually, to make sure you get the latest version of, it’s better to install from github as follows:

If you are missing pip3 you can install it with sudo apt-get -y install python3-pip

At this point you should be able to see the three executables,,, and in the dnsdiag directory.


By using the  --help on any of,, and you get all the different options available for each utility. The help output is well document and the options are pretty much self explanatory.

In its simplest form, you can run the following test:

This looks a lot like the regular ping output, but in this case, dnsping reports how long it takes to resolve “” by using the system’s default servers. 

There are several flags you can use to customize your results. For example:

Uses TCP as transport protocol for the test, use the DNS server and does 5 tests. You can explore the rest of the options easily by playing with them.

Dnstraceroute traces the hop-by-hop information to the DNS server used to do a query. This helps you understand if your DNS traffic goes through any unexpected route.

Here is what it looks like:

The options I used are self explanatory. The  --expert option is supposed to print warnings for detected events such as hijacking, but I haven’t seen it in practice giving any useful information (also because there is nothing out of the ordinary going on).

Finally, gives you an easy way to compare multiple DNS servers. To begin, put the DNS servers you want to compare in a file (e.g. servers.txt) one server on each line.

To try to compare apples to apples as much as possible, for LFT we use the IP traceroute targeted for

Then use the utility as follows:

In the installation directory there is a file public-servers.txt that contains several well known public DNS servers. Here is what it looks like to use on that file:

You can see that the best performing agents are the DynDNS server with average response of 1.0.31 ms, followed by the Google with response 1.428 ms.

Dnsdiag comes with three very useful DNS related troubleshooting and measurements utilities that let you measure DNS resolution time, identify the routing you take to a DNS server, and also compare several DNS servers in terms of response time and failed queries. If DNS troubleshooting is something that you do a lot (and many of you do), then you should look more into the nitty gritty details of all of them.