dig
用法示例
編輯在這個例子中,dig用於查詢域名example.com中的任何類型的記錄信息。
$ dig example.com any
; <<>> DiG 9.6.1 <<>> example.com any
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 4016
;; flags: qr rd ra; QUERY: 1, ANSWER: 4, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;example.com. IN ANY
;; ANSWER SECTION:
example.com. 172719 IN NS a.iana-servers.net.
example.com. 172719 IN NS b.iana-servers.net.
example.com. 172719 IN A 208.77.188.166
example.com. 172719 IN SOA dns1.icann.org. hostmaster.icann.org. 2007051703 7200 3600 1209600 86400
;; Query time: 1 msec
;; SERVER: ::1#53(::1)
;; WHEN: Wed Aug 12 11:40:43 2009
;; MSG SIZE rcvd: 154
上例中的數字172719是存活時間值,表示數據的有效時間。
人們可以查詢指定的DNS伺服器以獲取特定記錄;例如此例中的MX記錄:
$ dig wikimedia.org MX @ns0.wikimedia.org
; <<>> DiG 9.6.1 <<>> wikimedia.org MX @ns0.wikimedia.org
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 61144
;; flags: qr aa rd; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 2
;; WARNING: recursion requested but not available
;; QUESTION SECTION:
;wikimedia.org. IN MX
;; ANSWER SECTION:
wikimedia.org. 3600 IN MX 10 mchenry.wikimedia.org.
wikimedia.org. 3600 IN MX 50 lists.wikimedia.org.
;; ADDITIONAL SECTION:
mchenry.wikimedia.org. 3600 IN A 208.80.152.186
lists.wikimedia.org. 3600 IN A 91.198.174.5
;; Query time: 73 msec
;; SERVER: 208.80.152.130#53(208.80.152.130)
;; WHEN: Wed Aug 12 11:51:03 2009
;; MSG SIZE rcvd: 109
參考
編輯參考書目
編輯- Paul Albitz and Cricket Liu. DNS and BIND, 5th Edition. Nutshell Series. O'Reilly and Associates, Inc., 2006.