dig

dig is the most complete and powerful DNS utility and is available in most Unix/Linux systems. The tool will use the default nameservers defined in the resolv.conf file:

# dig www.oreilly.com

; <<>> DiG 9.4.3-P1 <<>> www.oreilly.com
;; global options:  printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 17863
;; flags: qr rd ra; QUERY: 1, ANSWER: 3, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;www.oreilly.com.        IN    A


;; ANSWER SECTION:
www.oreilly.com.    161    IN    CNAME    oreilly.com.
oreilly.com.        448    IN    A    100.201.239.100
oreilly.com.        448    IN    A    100.201.239.101

;; Query time: 4 msec
;; SERVER: 100.100.0.43#53(100.100.0.43)
;; WHEN: Mon Dec 14 14:48:55 2009
;; MSG SIZE  rcvd: 79

Sometimes it’s also useful to query nameservers other than the default. This can be done without changing the default address in resolv.conf, by using @ plus the nameserver’s IP address:

# dig @10.20.10.10 www.oreilly.com

; <<>> DiG 9.4.3-P1 <<>> www.oreilly.com
;; global options:  printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 17863
;; flags: qr rd ra; QUERY: 1, ANSWER: 3, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;www.oreilly.com.        IN    A

;; ANSWER SECTION:
www.oreilly.com.    161    IN    CNAME    oreilly.com.
oreilly.com.        448    IN    A    100.201.239.100
oreilly.com.        448    IN    A    100.201.239.101

;; Query time: 4 msec
;; SERVER: 10.20.10.10#53(10.20.10.10)
;; WHEN: Mon Dec 14 14:48:55 2009
;; MSG SIZE  rcvd: 79

If PTR (reverse) records are missing, this can affect many network services ...

Get LPI Linux Certification in a Nutshell, 3rd Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.