There were a few occasions to post this in a few threads.
So now I put it in a place.
Feel free to recommend DNS providers I should add (or remove).
Or anything else I suppose.
Example run
Test common resolvers by calculating average response times of 3 queries.
--------------------------------------------------------------------------------
DNS Primary Secondary
AdGuard 94.140.14.14 94.140.15.15
CleanBrowsing 185.228.168.9 185.228.169.9
Cloudflare 1.1.1.1 1.0.0.1
Comodo 8.26.56.26 8.20.247.20
Control-D 76.76.2.2 76.76.10.2
Google 8.8.8.8 8.8.4.4
Neustar 156.154.70.2 156.154.71.2
NextDNS 45.90.28.105 45.90.30.105
OpenDNS 208.67.222.222 208.67.220.220
Quad9 9.9.9.9 149.112.112.112
--------------------------------------------------------------------------------
Do you wish to flush the DNS cache? y
Current DNS X.X.X.X
Avg time: 6 ms
AdGuard 94.140.14.14
Avg time: 40 ms
CleanBrowsing 185.228.168.9
Avg time: 9.66667 ms
Cloudflare 1.1.1.1
Avg time: 9.66667 ms
Comodo 8.26.56.26
Avg time: 242.667 ms
Control-D 76.76.2.2
Avg time: 16.3333 ms
Google 8.8.8.8
Avg time: 60.6667 ms
Neustar 156.154.70.2
Avg time: 8.66667 ms
NextDNS 45.90.28.105
Avg time: 7.33333 ms
OpenDNS 208.67.222.222
Avg time: 26.3333 ms
Quad9 9.9.9.9
Avg time: 10.3333 ms
That is very cool, i used to use GRC.com tool for that purpose on windows. Just a small note, looking at the script: resolvectl service is not the default resolver on a new manjaro install, so this part will not work.
P.s. according to this (read all of it) there is no cache by default, so it does not matter.
When one is experiencing slow network it may as well be a slow dns resolver - this script is quite handy.
I am using bind on a rpi to resolve dns using root servers so I am getting an average of 1s for my current resolver
How about using drill instead of dig? After all drill is default present on Manjaro. as a drop-in replacement for dig.
DIGGER="dig"
if ! command -v $DIGGER > /dev/null; then
$DIGGER="drill"
fi
if ! command -v $DIGGER > /dev/null; then
echo "no capable digger found"
exit 1
fi
drill is not an complete drop-in replacement for dig. I really like drill, but drill does not support query options like dig and this is unfortunate.
Of course +short is nice but not that important. But for example with +https or +tls you can easily test DoH or DoT.
dig manjaro.org A @anycast.uncensoreddns.org +https
dig manjaro.org A @anycast.uncensoreddns.org +https +short
I’ve done some updates for checking for other caches to flush, merged your MR @linux-aarhus, and some other stuff.
Readme now reflects some extra things like drill and the ability to use
I’ve been working on it also after i forked yesterday, will commit in my fork soon, after i finished the total rewrite and incorporated the changes you added