Created
June 25, 2021 16:13
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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