The +noall tells dig(1) to print nothing. The +question and +answer tell dig(1) to print
only the question and answer sections:
% dig +noall +question +answer -x 192.0.34.166
;166.34.0.192.in-addr.arpa. IN PTR
166.34.0.192.in-addr.arpa. 20341 IN PTR www.example.com.
Note that because -x specifies an IP address, the IP address must immediately follow
it. Here, dig(1) produced just two lines of output. The first line (a comment line) is
the original question that was asked. That line is followed by the answer line.
You might reasonably ask, however, where did the in-addr.arpa come from? In the
halcyon days of yore, there was no dig(1) program; hence, there was no easy way to
This is the Title of the Book, eMatter Edition
Copyright ?© 2007 O??™Reilly & Associates, Inc. All rights reserved.
342 | Chapter 9: DNS and sendmail
look up a host by its address. In order to look up the address, you first had to reverse
it (hence, a reverse lookup) and then to append an in-addr.arpa to the result:
192.0.34.166 reverses to 166.34.0.192.in-addr.arpa
Internally, dig(1) performs this task for you, thus causing your question to look different
from your command line. In summary, then, the following two dig(1) commands
perform the same lookup,* but the second is easier to use:
% dig ptr 166.34.0.192.in-addr.arpa
% dig -x 192.0.34.166
Finally, note that forward lookups and reverse lookups don??™t always agree.
Pages:
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621