Skip to content

Instantly share code, notes, and snippets.

@kanazux
Created June 3, 2015 19:49
Show Gist options
  • Select an option

  • Save kanazux/69090d2ed95a7e00401a to your computer and use it in GitHub Desktop.

Select an option

Save kanazux/69090d2ed95a7e00401a to your computer and use it in GitHub Desktop.
#!/bin/sh
sites="/root/url_list"
fdnss="/root/fdnss"
[ -f $fdnss ] && /bin/rm $fdnss
dnss=`cat /etc/resolv.conf | egrep '^nameserver' | egrep -v '127.0.0.1|8.8.8.8' | awk '{print $2}' | sort -u >> /root/fdnss`
for site in `cat $sites`; do
g_dns=`dig +short $site 8.8.8.8 | head -1`
for dns in `cat $fdnss`; do
s_dns=`dig +short +tries=1 +time=3 $site $dns | head -1`
if [ "$g_dns" != "$s_dns" ]; then
echo "$site no $dns NOT ok"
echo "ip $g_dns - ip $s_dns"
else
echo "$site no $dns ok"
fi
done
echo ""
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment