Skip to content

Instantly share code, notes, and snippets.

@bradmontgomery
Created May 4, 2017 20:59
Show Gist options
  • Save bradmontgomery/824810809d83fa86876e56df6b6f590c to your computer and use it in GitHub Desktop.
Save bradmontgomery/824810809d83fa86876e56df6b6f590c to your computer and use it in GitHub Desktop.
Script to check a domain name against several public DNS servers.
#!/bin/bash
DOMAIN=$1;
if [ -z "$DOMAIN" ]; then
echo "USAGE: ./digger <your-domain>"
else
echo "Testing $DOMAIN"
# Here's a list of public name servers.
# See: https://www.lifewire.com/free-and-public-dns-servers-2626062
declare -a nameservers=("209.244.0.3" "64.6.64.6" "8.8.8.8" "84.200.69.80" "8.26.56.26" "208.67.222.222" "199.85.126.10" "81.218.119.11" "195.46.39.39" "96.90.175.167" "208.76.50.50" "216.146.35.35" "37.235.1.174" "77.88.8.8" "91.239.100.100" "74.82.42.42" "109.69.8.51")
for ns in "${nameservers[@]}"
do
RESULT=$(dig @$ns +short $DOMAIN)
echo "GOT: $RESULT <--- from: ${ns}"
done
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment