dig命令詳解

2022-09-04 11:24:08 字數 4567 閱讀 2309

dig命令詳解

1.檢視網域名稱的a記錄

# dig yahoo.com; <<>> dig 9.8.2rc1-redhat-9.8.2-0.10.rc1.el6_3.2 <<>> yahoo.com

;; global options: +cmd

;; got answer:

;; ->>header<

2.檢視網域名稱的ip

# dig yahoo.com +short

98.139.183.24

72.30.38.140

98.138.253.109

3.檢視網域名稱的mx 記錄

# dig yahoo.com mx

; <> dig 9.8.2rc1-redhat-9.8.2-0.10.rc1.el6_3.2 <> yahoo.com mx

;; global options: +cmd

;; got answer:

;; ->>header<<- opcode: query, status: noerror, id: 31450

;; flags: qr rd ra; query: 1, answer: 3, authority: 0, additional: 24

;; question section:

;yahoo.com. in mx

;; answer section:

yahoo.com. 33 in mx 1 mta6.am0.yahoodns.net.

yahoo.com. 33 in mx 1 mta7.am0.yahoodns.net.

yahoo.com. 33 in mx 1 mta5.am0.yahoodns.net.

4.檢視網域名稱的soa記錄

# dig yahoo.com soa

; <> dig 9.8.2rc1-redhat-9.8.2-0.10.rc1.el6_3.2 <> yahoo.com soa

;; global options: +cmd

;; got answer:

;; ->>header<<- opcode: query, status: noerror, id: 2197

;; flags: qr rd ra; query: 1, answer: 1, authority: 7, additional: 7

;; question section:

;yahoo.com. in soa

;; answer section:

yahoo.com. 1800 in soa ns1.yahoo.com. hostmaster.yahoo-inc.com. 2012081409 3600 300 1814400 600

5.查詢網域名稱的ttl記錄

# dig yahoo.com ttl

; <> dig 9.8.2rc1-redhat-9.8.2-0.10.rc1.el6_3.2 <> yahoo.com ttl

;; global options: +cmd

;; got answer:

;; ->>header<<- opcode: query, status: noerror, id: 56156

;; flags: qr rd ra; query: 1, answer: 3, authority: 0, additional: 0

;; question section:

;yahoo.com. in a

;; answer section:

yahoo.com. 3589 in a 98.138.253.109

yahoo.com. 3589 in a 98.139.183.24

yahoo.com. 3589 in a 72.30.38.140

6.檢視內容資訊

# dig yahoo.com +nocomments +noquestion +noauthority +noadditional +nostats

; <<>> dig 9.8.2rc1-redhat-9.8.2-0.10.rc1.el6 <<>> yahoo.com +nocomments +noquestion +noauthority +noadditional +nostats

;; global options: +cmd

yahoo.com. 3442 in a 72.30.38.140

yahoo.com. 3442 in a 98.138.253.109

yahoo.com. 3442 in a 98.139.183.24

7.查詢所有的dns記錄型別

# dig yahoo.com any +noall +answer

; <<>> dig 9.8.2rc1-redhat-9.8.2-0.10.rc1.el6 <<>> yahoo.com any +noall +answer

;; global options: +cmd

yahoo.com. 3509 in a 72.30.38.140

yahoo.com. 3509 in a 98.138.253.109

yahoo.com. 3509 in a 98.139.183.24

yahoo.com. 1709 in mx 1 mta5.am0.yahoodns.net.

yahoo.com. 1709 in mx 1 mta6.am0.yahoodns.net.

yahoo.com. 1709 in mx 1 mta7.am0.yahoodns.net.

yahoo.com. 43109 in ns ns2.yahoo.com.

yahoo.com. 43109 in ns ns8.yahoo.com.

yahoo.com. 43109 in ns ns3.yahoo.com.

yahoo.com. 43109 in ns ns1.yahoo.com.

yahoo.com. 43109 in ns ns4.yahoo.com.

yahoo.com. 43109 in ns ns5.yahoo.com.

yahoo.com. 43109 in ns ns6.yahoo.com.

8.dns反向查詢

# dig -x 72.30.38.140 +short

ir1.fp.vip.sp2.yahoo.com.

9.查詢多個dns記錄

# dig yahoo.com mx +noall +answer redhat.com ns +noall +answer

; <<>> dig 9.8.2rc1-redhat-9.8.2-0.10.rc1.el6 <<>> yahoo.com mx +noall +answer redhat.com ns +noall +answer

;; global options: +cmd

yahoo.com. 1740 in mx 1 mta6.am0.yahoodns.net.

yahoo.com. 1740 in mx 1 mta7.am0.yahoodns.net.

yahoo.com. 1740 in mx 1 mta5.am0.yahoodns.net.

redhat.com. 132 in ns ns1.redhat.com.

redhat.com. 132 in ns ns4.redhat.com.

redhat.com. 132 in ns ns3.redhat.com.

redhat.com. 132 in ns ns2.redhat.com.

dig命令詳解

dig是乙個在類unix命令列模式下查詢dns包括ns記錄,a記錄,mx記錄等相關資訊的工具。由於一直缺失 dig man page文件,本文就權當乙個dig使用嚮導吧。dig的原始碼是isc bind大包的一部分,但是大多編譯和安裝bind的文件都不把它包括在內,但是在linux系 統下,它通常是...

dig命令安裝

yum y install bind utils dig是乙個在類unix命令列模式下查詢dns包括ns記錄,a記錄,mx記錄等相關資訊的工具 查詢yahoo.com的a記錄 此處一定是域而不是主機,如我公司為xinpindao.com dig yahoo.com a noall answer 查詢...

dig命令的基本用法

在 unix 和 linux 下,建議大家使用 dig 命令來代替 nslookup。dig 命令的功能比 nslookup 強大很多,不像 nslookkup 還得 set 來 set 去的,怪麻煩的。下面是 dig 的一些比較常用的命令 dig 最基本的用法 dig server sina.co...