Dig Tricks

dig +short txt _netblocks.google.com
dig -t SRV _kerberos._tcp.circus.com

# get the address(es) for yahoo.com
dig yahoo.com A +noall +answer

# get a list of yahoo’s mail servers
dig yahoo.com MX +noall +answer

# get a list of DNS servers authoritative for yahoo.com
dig yahoo.com NS +noall +answer

# get all of the above
dig yahoo.com ANY +noall +answer

More obscurely, for the present anyway, you can also poll for a hostís IPv6 address using the AAAA option.

dig http://www.isc.org AAAA +short

If the domain you want to query allows DNS transfers, you can get those, too. The reality of life on the Internet, however, is that very few domains allow unrestricted transfers these days.

dig yourdomain.com AXFR

Get a short answer?

When all you want is a quick answer, the +short option is your friend:

$ dig http://www.isc.org +short
204.152.184.88

Get a not-quite-so-short answer?

Note that a short answer is different from only an answer. The way to get a detailed answer, but without any auxiliary information, is to turn off all the results (+noall) and then turn on only those sections you want.

Hereís a short answer followed by only an answer; the latter includes all the configuration information, including time-to-live (TTL) data, displayed in a format compatible with BIND configuration files.

$ dig fsf.org mx +short
20 mx20.gnu.org.
30 mx30.gnu.org.
10 mx10.gnu.org.

$ dig +nocmd fsf.org mx +noall +answer
fsf.org. 3583 IN MX 30 mx30.gnu.org.
fsf.org. 3583 IN MX 10 mx10.gnu.org.
fsf.org. 3583 IN MX 20 mx20.gnu.org.

This entry was posted in Linux, Routing. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s