rDNS Benchmark Bash

Asphyxia

Owner
Administrator
Apr 25, 2015
1,801
2,158
287
Code:
echo "Select a DNS provider:"
echo "[1] Cloudflare        1.1.1.1"
echo "[2] Google        8.8.8.8"
echo "[3] OpenDNS        208.67.222.222"
echo "[4] Comodo Secure    8.26.56.26"
echo "[5] Quad9        9.9.9.9"
echo "[6] Verisign        64.6.64.6"
echo "[7] CleanBrowsing    185.228.168.9"
echo "[8] Alternate        198.101.242.72"
echo "[9] AdGuard        94.140.14.14"
echo "[10] DNS.WATCH        84.200.69.80"
echo "[11] Level3        205.171.3.66"
echo "[12] SafeDNS        195.46.39.39"
echo "[13] OpenNIC        192.71.245.208"
echo "[14] Dyn        216.146.35.35"
echo "[15] FreeDNS        45.33.97.5"
echo "[16] Yandex.DNS        77.88.8.8"
echo "[17] UncensoredDNS    91.239.100.100"
echo "[18] Hurricane Electric    74.82.42.42"
echo "[19] puntCAT        109.69.8.51"
echo "[20] Fourth Estate    45.77.165.194"
echo "[99] Hail mary DNS average"
read sel
case $sel in
1)
dnsadd=1.1.1.1
;;
2)
dnsadd=8.8.8.8
;;
3)
dnsadd=208.67.222.222
;;
4)
dnsadd=8.26.56.26
;;
5)
dnsadd=9.9.9.9
;;
6)
dnsadd=64.6.64.6
;;
7)
dnsadd=185.228.168.9
;;
8)
dnsadd=198.101.242.72
;;
9)
dnsadd=94.140.14.14
;;
10)
dnsadd=84.200.69.80
;;
11)
dnsadd=205.171.3.66
;;
12)
dnsadd=195.46.39.39
;;
13)
dnsadd=192.71.245.208
;;
14)
dnsadd=216.146.35.35
;;
15)
dnsadd=45.33.97.5
;;
16)
dnsadd=77.88.8.8
;;
17)
dnsadd=91.239.100.100
;;
18)
dnsadd=74.82.42.42
;;
19)
dnsadd=109.69.8.51
;;
20)
dnsadd=45.77.165.194
;;
99)
Servers=("1.1.1.1" "8.8.8.8" "208.67.222.222" "8.26.56.26" "9.9.9.9" "64.6.64.6" "185.228.168.9" "198.101.242.72" "94.140.14.14" "84.200.69.80" "205.171.3.66" "195.46.39.39" "192.71.245.208" "216.146.35.35" "45.33.97.5" "77.88.8.8" "91.239.100.100" "74.82.42.42" "109.69.8.51" "45.77.165.194");
ProviderName=("Cloudflare" "Google" "OpenDNS" "Comodo Secure" "Quad9" "Verisign" "CleanBrowsing" "Alternate" "AdGuard" "DNS.WATCH" "Level3" "SafeDNS" "OpenNIC" "Dyn" "FreeDNS" "Yandex.DNS" "UncensoredDNS" "Hurricane Electric" "puntCAT" "Fourth Estate");
BestTime=("999" "999")

for i in ${!Servers[@]};
do

    mil1=`dig noirth.com @${Servers[i]} +time=1 +tries=1 | grep msec | cut -d " " -f4`
    mil2=`dig yahoo.com @${Servers[i]} +time=1 +tries=1 | grep msec | cut -d " " -f4`
    mil3=`dig example.com @${Servers[i]} +time=1 +tries=1 | grep msec | cut -d " " -f4`
    mil4=`dig hetzner.de @${Servers[i]} +time=1 +tries=1 | grep msec | cut -d " " -f4`
    mil5=`dig reg.ru @${Servers[i]} +time=1 +tries=1 | grep msec | cut -d " " -f4`
    mil6=`dig icann.org @${Servers[i]} +time=1 +tries=1 | grep msec | cut -d " " -f4`
    mil7=`dig apnic.net @${Servers[i]} +time=1 +tries=1 | grep msec | cut -d " " -f4`
    mil8=`dig apple.com @${Servers[i]} +time=1 +tries=1 | grep msec | cut -d " " -f4`
    mil9=`dig hi.contact @${Servers[i]} +time=1 +tries=1 | grep msec | cut -d " " -f4`
    mil10=`dig youtube.com @${Servers[i]} +time=1 +tries=1 | grep msec | cut -d " " -f4`
    totalMil=$(((mil1+mil2+mil3+mil4+mil5+mil6+mil7+mil8+mil9+mil10)/10))
echo $totalMil"ms average in 10 requests from "${ProviderName[i]}
if [ $totalMil -gt 0 ]
then
BestTime[i]=$totalMil
fi

done
echo "Sort at end"
#echo ${BestTime[*]}

sortedTime=( $( printf "%s\n" "${BestTime[@]}" | sort -n ) )

#echo ${BestTime[@]/${sortedTime[0]}//} | cut -d/ -f1 | wc -w | tr -d ' '

#echo "flyone"
for i in "${!BestTime[@]}"; do
   [[ "${BestTime[$i]}" = "${sortedTime[0]}" ]] && break
done

#echo $i
#echo "flytwo"

echo "Best times in ms: "${sortedTime[*]}

echo "The best rDNS provider for you is "${ProviderName[$i]}

exit
esac

while :; do dig noirth.com @$dnsadd | grep time & sleep 0.5; done

Example use:
Save the above code to dnsMs.sh

then run 'bash dnsMs.sh'

or whatever.. and you'll see something like this (consider option 99 to test various DNS resolvers for ms / latency):
1612416621583.png

You can see Cloudflare is pretty dam good. It's great on my VPN, great off my VPN, great on my servers. Am I a Cloudflare fanboooiii? I would wear a Cloudflare shirt.

Video of this in action:
 
Last edited:
Top