Skip to content

Instantly share code, notes, and snippets.

@pankpan
Created June 25, 2021 16:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pankpan/a4f799c292e12ef55a686e938ada2898 to your computer and use it in GitHub Desktop.
Save pankpan/a4f799c292e12ef55a686e938ada2898 to your computer and use it in GitHub Desktop.
Measure DNS speed by query Alexa top 50 sites NS and A record
#!/bin/bash
TEMP=/tmp/alexa.html
if [ -z $1 ] ; then
echo "`basename $0` {dns}"
else
DNS=$1
[ -f $TEMP ] || curl -s https://www.alexa.com/topsites > $TEMP
T1=`date +%s.%N`
for HOST in `awk -F[\"\/] '/href=..siteinfo\// {print $4}' $TEMP`
do
echo $HOST
dig NS $HOST @$DNS
dig A $HOST @$DNS
done
T2=`date +%s.%N`
echo -n "Total time "`echo $T2-$T1 | bc -l`
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment