UNIX System Administration Handbook - Evi Nemeth [284]
nslookup and dig are included in the BIND release.
nslookup is a user-level command that queries the DNS database. It expects fully qualified names ending in a dot and appends the default domain if you forget the dot. For local names, this behavior is often what you want. Table 16.16 gives a short list of nslookup commands.
Table 16.16 Commands understood by nslookup
a. any is a good value that means “all record types.”
dig provides the same rough functionality as nslookup, but it has more sensible defaults, provides more information, and has a nicer user interface (especially when compared to older versions of nslookup).
For example, to ask for anchor’s MX records, use
% dig anchor.cs.colorado.edu. mx
The command
% dig @ns1.berkeley.edu vangogh.berkeley.edu. any
obtains vangogh’s complete records from a berkeley.edu server, and
% dig -x 128.32.33.5
performs a reverse query for vangogh. Here is a complete example that uses both nslookup and dig to query for the same data:
% nslookup
Default Server: bb.rc.vix.com
Address: 204.152.187.11
> set type=any
> amazon.com.
Server: bb.rc.vix.com
Address: 204.152.187.11
Non-authoritative answer:
amazon.com nameserver = AUTH00.NS.UU.NET
amazon.com nameserver = NS2.PNAP.NET
amazon.com nameserver = NS1.PNAP.NET
amazon.com nameserver = NS-1.amazon.com
amazon.com preference = 10, mail exchanger = service-4.amazon.com
amazon.com preference = 10, mail exchanger = service-5.amazon.com
amazon.com internet address = 208.216.182.15
Authoritative answers can be found from:
amazon.com nameserver = AUTH00.NS.UU.NET
amazon.com nameserver = NS2.PNAP.NET
amazon.com nameserver = NS1.PNAP.NET
amazon.com nameserver = NS-1.amazon.com
AUTH00.NS.UU.NET internet address = 198.6.1.65
NS2.PNAP.NET internet address = 206.253.194.97
NS1.PNAP.NET internet address = 206.253.194.65
NS-1.amazon.com internet address = 209.191.164.20
service-4.amazon.com internet address = 209.191.164.50
service-5.amazon.com internet address = 209.191.164.51
nslookup returns four NS records, two MX records, and an A record. It also provides the IP addresses of the name servers and MX hosts.
% dig amazon.com. any
; <<>> DiG 8.3 <<>> amazon.com any
;; res options: init recurs defnam dnsrch
;; got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 4
;; flags: qr rd ra; QUERY: 1, ANSWER: 7, AUTHORITY: 4, ADDITIONAL: 6
;; QUERY SECTION:
;; amazon.com, type = ANY, class = IN
;; ANSWER SECTION:
amazon.com. 1h27m11s IN NS AUTH00.NS.UU.NET.
amazon.com. 1h27m11s IN NS NS2.PNAP.NET.
amazon.com. 1h27m11s IN NS NS1.PNAP.NET.
amazon.com. 1h27m11s IN NS NS-1.amazon.com.
amazon.com. 59m22s IN MX 10 service-4.amazon.com.
amazon.com. 59m22s IN MX 10 service-5.amazon.com.
amazon.com. 1h59m29s IN A 208.216.182.15
;; AUTHORITY SECTION:
amazon.com. 1h27m11s IN NS AUTH00.NS.UU.NET.
amazon.com. 1h27m11s IN NS NS2.PNAP.NET.
amazon.com. 1h27m11s IN NS NS1.PNAP.NET.
amazon.com. 1h27m11s IN NS NS-1.amazon.com.
;; ADDITIONAL SECTION:
AUTH00.NS.UU.NET. 13h11m20s IN A 198.6.1.65
NS2.PNAP.NET. 20h51m44s IN A 206.253.194.97
NS1.PNAP.NET. 20h51m44s IN A 206.253.194.65
NS-1.amazon.com. 59m22s IN A 209.191.164.20
service-4.amazon.com. 59m22s IN A 209.191.164.50
service-5.amazon.com. 59m22s IN A 209.191.164.51
;; Total query time: 7 msec
;; FROM: bb.rc.vix.com to SERVER: default -- 204.152.187.11
;; WHEN: Sun Jul 2 12:45:59 2000
;; MSG SIZE sent: 28 rcvd: 338
dig is verbose. Its output includes not only