Using dig to Look Up IP Address

Joseph S D Yao jsdy at cospo.osis.gov
Fri Jun 29 17:43:11 UTC 2001


On Thu, Jun 28, 2001 at 08:03:08PM -0600, Jim wrote:
> How do you use dig to do an IP address to name lookup?  It's easy
> enough to do with nslookup, and I don't have problems using dig to
> find most other DNS data, but I'll be hanged if I can figure out how
> to do reverse lookups.

E.g.

206.168.47.17 ->
dig ptr 17.47.168.206.in-addr.arpa. [produces a CNAME; see below]

; <<>> DiG 8.3 <<>> ptr 17.47.168.206.in-addr.arpa. 
;; res options: init recurs defnam dnsrch
;; got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 4
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 0
;; QUERY SECTION:
;;	17.47.168.206.in-addr.arpa, type = PTR, class = IN

;; ANSWER SECTION:
17.47.168.206.in-addr.arpa.  1W IN CNAME  17.moi.47.168.206.in-addr.arpa.

;; AUTHORITY SECTION:
moi.47.168.206.in-addr.arpa.  3H IN SOA  ns1.mediaodyssey.com. hostmaster.mediaodyssey.com. (
					2001030401	; serial
					4H		; refresh
					30M		; retry
					1w3d		; expiry
					1D )		; minimum


;; Total query time: 349 msec
;; FROM: ...
;; WHEN: Fri Jun 29 13:24:45 2001
;; MSG SIZE  sent: 44  rcvd: 158

NOW, this has a CNAME record in the ANSWER section, but no PTR record.
Unconvinced that it tried hard enough, I continue:

CNAME  17.moi.47.168.206.in-addr.arpa. ->
dig ptr 17.moi.47.168.206.in-addr.arpa.

; <<>> DiG 8.3 <<>> ptr 17.moi.47.168.206.in-addr.arpa. 
;; res options: init recurs defnam dnsrch
;; got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 4
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0
;; QUERY SECTION:
;;	17.moi.47.168.206.in-addr.arpa, type = PTR, class = IN

;; AUTHORITY SECTION:
moi.47.168.206.in-addr.arpa.  2h58m20s IN SOA  ns1.mediaodyssey.com. hostmaster.mediaodyssey.com. (
					2001030401	; serial
					4H		; refresh
					30M		; retry
					1w3d		; expiry
					1D )		; minimum


;; Total query time: 7 msec
;; FROM: ...
;; WHEN: Fri Jun 29 13:26:25 2001
;; MSG SIZE  sent: 48  rcvd: 115

Now I am convinced that there is no resolution to this IP address, even
though there is a CNAME ... somebody missed one!  ;-)

On a server where there is no CNAME, or the aliased PTR is also on that
server, I know you will get a PTR record in the original response.  But
I am not sure whether you need to try twice if the aliased-to record
exists but is on another server.

-- 
Joe Yao				jsdy at cospo.osis.gov - Joseph S. D. Yao
OSIS Center Computer Support					EMT-B
-----------------------------------------------------------------------
This message is not an official statement of COSPO policies.


More information about the bind-users mailing list