Skip to content

Instantly share code, notes, and snippets.

@asergeyev
Created February 15, 2016 17:35
Show Gist options
  • Save asergeyev/2c943caf3c72c4fa69e3 to your computer and use it in GitHub Desktop.
Save asergeyev/2c943caf3c72c4fa69e3 to your computer and use it in GitHub Desktop.
Bunch of dig command line examples
# All authority gluerecs by name:
dig +noall +authority $NAME @b.gtld-servers.net | sed -e 's/.*\s//' | xargs -n1 -I % bash -c 'dig +short $NAME @% | sed -e s/^/%\\t/'
# All authority gluerecs with glue IPs:
dig +noall +additional $NAME @b.gtld-servers.net | sed -e 's/.*\s//' | xargs -n1 -I % bash -c 'dig +short $NAME @% | sed -e s/^/%\\t/'
# All recs found with resolving every name to all known IPs
dig +noall +authority $NAME @b.gtld-servers.net | sed -e 's/.*\s//' | xargs -n1 -I % dig +short NS $ZONE @% | sort -u | xargs -n1 -I % bash -c 'dig +short A %; dig +short AAAA %' | sort -u | grep -v : |xargs -n1 -I % bash -c 'dig +short $NAME @% | sed -e s/^/%\\t/'
# For one above, find zone by name (not 100% good but works ok for basic things):
dig +noall +authority SOA _.c.b.a.$NAME
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment