Senin, 27 Agustus 2012

How To Use Dig Command

The command dig is a command that is used for querying DNS name servers for information about host addresses, mail exchanges, name servers, and related information.
Dig is included in most Linux and Mac OS X installations by default via the Terminal. If you are using Windows you will need to install the BIND utilities package or any of the dig replacements that can be found by searching Google for Dig Windows.
The most typical, simplest query is for a single host. By default, however, dig is pretty verbose. You probably don’t need all the information in the default output, but it’s probably worth knowing what it is. Below is an example of the default output from a ‘dig liquidweb.com‘:
$ dig liquidweb.com
; <<>> DiG 9.5.1-P2-RedHat-9.5.1-2.P2.fc10 <<>> liquidweb.com
;; global options: printcmd
;; Got answer:
;; ->>HEADER< ;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 2, ADDITIONAL: 2
;; QUESTION SECTION:
;liquidweb.com. IN A
;; ANSWER SECTION:
liquidweb.com. 197 IN A 209.59.139.21
;; AUTHORITY SECTION:
liquidweb.com. 857 IN NS ns.liquidweb.com.
liquidweb.com. 857 IN NS ns1.liquidweb.com.
;; ADDITIONAL SECTION:
ns.liquidweb.com. 671 IN A 209.59.139.20
ns1.liquidweb.com. 806 IN A 64.91.251.155
;; Query time: 6 msec
;; SERVER: 69.16.222.254#53(69.16.222.254)
;; WHEN: Wed Jun 10 10:35:44 2009
;; MSG SIZE rcvd: 114
This result shows the 4 main sub-sections: Question, Answer, Authority, Additional.
Question Section
;; QUESTION SECTION:
;liquidweb.com. IN A
This section shows the query that is being made. In this case we are just looking for the host IP(or A record if you prefer) for liquidweb.com.
***For more information on the various types of DNS records please read this article***
Answer Section
;; ANSWER SECTION:
liquidweb.com. 197 IN A 209.59.139.21
This section shows the answer or result of the query that was made(provided one can be provided). In this case the answer the is IP address that liquidweb.com resides on.
Authority Section
;;AUTHORITY SECTION:
liquidweb.com. 857 IN NS ns.liquidweb.com.
liquidweb.com. 857 IN NS ns1.liquidweb.com.
This section shows the nameservers that provided dig with the answer to its query. For liquidweb.com the authoritative name servers are ns.liquidweb.com and ns1.liquidweb.com.
Additional Section
;; ADDITIONAL SECTION:
ns.liquidweb.com. 671 IN A 209.59.139.20
ns1.liquidweb.com. 806 IN A 64.91.251.155
The Additional Section provides any extra information that may be wanted but not specifically requested by dig. For this example the Additional Section displays the IP addressed of the authoritative nameservers.
Another example of a common lookup using dig would be to look up the mx, mail exchange, record for a domain. Below is an example of a mx lookup for liquidweb.com.
$ dig mx liquidweb.com
; <<>> DiG 9.5.1-P2-RedHat-9.5.1-2.P2.fc10 <<>> mx liquidweb.com
;; global options: printcmd
;; Got answer:
;; ->>HEADER< ;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 2, ADDITIONAL: 4
;; QUESTION SECTION:
;liquidweb.com. IN MX
;; ANSWER SECTION:
liquidweb.com. 900 IN MX 5 mxgate-03.liquidweb.com.
liquidweb.com. 900 IN MX 10 backupmx.liquidweb.com.
;; AUTHORITY SECTION:
liquidweb.com. 396 IN NS ns.liquidweb.com.
liquidweb.com. 396 IN NS ns1.liquidweb.com.
;; ADDITIONAL SECTION:
mxgate-03.liquidweb.com. 900 IN A 209.59.139.131
backupmx.liquidweb.com. 900 IN A 209.59.139.28
ns.liquidweb.com. 363 IN A 209.59.139.20
ns1.liquidweb.com. 346 IN A 64.91.251.155
;; Query time: 3 msec
;; SERVER: 69.16.222.254#53(69.16.222.254)
;; WHEN: Wed Jun 10 10:58:25 2009
;; MSG SIZE rcvd: 181
The result of a MX query is fairly close to the same as the result of a standard dig. The only difference is howto interupt the Answer Section.
;; ANSWER SECTION:
liquidweb.com. 900 IN MX 5 mxgate-03.liquidweb.com.
liquidweb.com. 900 IN MX 10 backupmx.liquidweb.com.
For MX, mail records, the answer will also include the priority of the mail server. The lower the number the higher the priority. In this example when a domain attempts to send mail to liquidweb.com it will attempt to send mail to mxgate-03.liquidweb.com first and if that attempt fails it will try to send to backupmx.liquidweb.com next.
Source:
http://www.liquidweb.com/kb/how-to-use-dig/
asus87.com

0 komentar:

Posting Komentar

Topics

Recent

Blogroll

Widget

Diberdayakan oleh Blogger.

Popular Posts