Cách sử dụng dig command đơn giản nhất (có thể hiểu rỏ từng phần của thông tin output thông qua câu lệnh này)
Khi bạn đưa một domain name vào lệnh dig, mặt định nó sẽ hiển thị A Record
Trong ví dụ dưới đây nó sẽ hiển thị A Record của redhat.com trong "answer section" của output
$ dig redhat.com
; <<>> DiG 9.7.3-RedHat-9.7.3-2.el6 <<>> redhat.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 62863
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 4, ADDITIONAL: 3
;; QUESTION SECTION:
;redhat.com. IN A
;; ANSWER SECTION:
redhat.com. 37 IN A 209.132.183.81
;; AUTHORITY SECTION:
redhat.com. 73 IN NS ns4.redhat.com.
redhat.com. 73 IN NS ns3.redhat.com.
redhat.com. 73 IN NS ns2.redhat.com.
redhat.com. 73 IN NS ns1.redhat.com.
;; ADDITIONAL SECTION:
ns1.redhat.com. 73 IN A 209.132.186.218
ns2.redhat.com. 73 IN A 209.132.183.2
ns3.redhat.com. 73 IN A 209.132.176.100
;; Query time: 13 msec
;; SERVER: 209.144.50.138#53(209.144.50.138)
;; WHEN: Thu Jan 12 10:09:49 2012
;; MSG SIZE rcvd: 164
Giải thích các sections
-
Header : hiển thị version của dig command, global options, và một số thông tin header khác
Question section : chứa input. và mặt định là Record A
Answer section : hiển thị kết quả nhận được từ DNS server, là output, và hiển thị A Record của redhat.com
Authority section : hiển thị DNS name server mà được quyền trả lời những request
Additional section : hiển thị ip address của list server ở trên Authority section
Cuối cùng là hiển thi một vài trạng thái của dig command, trong đó có khoản thời gian thực thi câu query (query time)