A pyramid of little scripts: nsdig
One of my DNS diagnostic tools is a program called nsdig
; it makes
a query to all of the authoritative servers for a zone. This makes
it convenient to both look for inconsistencies and see what the
authoritative servers are saying, as opposed to whatever is filtering
through your local caching servers.
As another one of my little shell scripts, and as
a practical example of how little utilities stack on top of each other
to everyone's benefit, here's nsdig
and its component bits:
; cat nsdig #!/bin/sh case "$#" in 3) nssrc=$3;; 2) nssrc=$2;; *) echo usage: nsdig T WHAT [DOM] 1>&2 exit 1;; esac for i in `nsaddrs $nssrc`; do echo "---- $i ----" dig +norecurse $1 $2 @$i done
(The third argument is necessary for cases like 'nsdig a www.foo.com
foo.com
'.)
; cat nsaddrs #!/bin/sh addr `sdig ns $1` | sort -u ; cat addr #!/bin/sh for i in "$@"; do sdig a $i done ; cat sdig #!/bin/sh exec dig +short "$@"
(dig
is the standard DNS lookup utility. Honesty compels me to
admit that the version of addr
that I actually use is a much more
complicated Python program with various additional features that are
irrelevant for nsaddr
's usage.)
The one building block that is not as useful as it could be is dig
,
which sometimes insists on sprinkling its output with extraneous bits.
(For example, even the short dig
output for TXT
queries has quotes
around the results, which are almost always surplus.)
Comments on this page:
|
|