Skip to content

Instantly share code, notes, and snippets.

@Disassembler0
Created April 2, 2018 07:38
Show Gist options
  • Select an option

  • Save Disassembler0/3829dbca0570d1334f9b5db6f1abb2e6 to your computer and use it in GitHub Desktop.

Select an option

Save Disassembler0/3829dbca0570d1334f9b5db6f1abb2e6 to your computer and use it in GitHub Desktop.
Simple DNS resolver performance test
#!/bin/sh
# Get top 1M domain list
if [ ! -e top-1m.txt ]; then
wget http://s3.amazonaws.com/alexa-static/top-1m.csv.zip
unzip top-1m.csv.zip
cut -d',' -f2 top-1m.csv >top-1m.txt
fi
# Create list of DNS resolvers
cat <<EOF >dns.txt
1.1.1.1
1.0.0.1
8.8.8.8
8.8.4.4
8.26.56.26
8.20.247.20
9.9.9.9
77.88.8.8
77.88.8.1
185.228.168.168
185.228.168.169
199.85.126.10
199.85.127.10
208.67.222.222
208.67.220.220
2001:4860:4860::8888
2001:4860:4860::8844
2606:4700:4700::1111
2606:4700:4700::1001
2620:fe::fe
2a02:6b8::feed:0ff
2a02:6b8:0:1::feed:0ff
127.0.0.1
EOF
# Run
for DNS in $(cat dns.txt); do
for QUERY in $(shuf -n 100 top-1m.txt); do
dig @${DNS} ${QUERY} | grep 'time'
done | awk -v dns="${DNS}" '{total += $4; count++} END {print dns" - "total/count" ms"}'
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment