Understanding the dig command

dig will let you perform any valid DNS query, the most common of which are A (the IP address), TXT (text annotations), MX (mail exchanges), and NS nameservers.

The command dig is a tool for querying DNS nameservers for information about host addresses, mail exchanges, nameservers, and related information.

This tool can be used from any Linux (Unix) or Macintosh OS X operating system. The most typical use of dig is to simply query a single host.

$ dig serverbuddies.com
; <> DiG 9.5.1-P3 <> serverbuddies.com
;; global options: printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 39970
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 13, ADDITIONAL: 0

;; QUESTION SECTION:
;serverbuddies.com. IN A

;; ANSWER SECTION:
serverbuddies.com. 14043 IN A 67.228.43.85

A quick way to just get the answer only is to run the following command:

dig serverbuddies.com +short

Use the following command to get a list of all the mailservers for mt-example.com:

dig serverbuddies.com MX +noall +answer

Use the following command to get a list of authoritative DNS servers for mt-example.com:

dig serverbuddies.com NS +noall +answer

Trackback URI | Comments RSS

Leave a Reply

You must be logged in to post a comment.