Whois

為什麼 nslookup 或 dig 不返回某些域的名稱伺服器?

  • November 30, 2017

為什麼 nslookup 或 dig 不返回某些域的名稱伺服器?

例子:

dig @8.8.8.8 NS zzy.pl

; <<>> DiG 9.9.5-9+deb8u10-Raspbian <<>> @8.8.8.8 NS zzy.pl
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 9801
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 512
;; QUESTION SECTION:
;zzy.pl.                                IN      NS

;; AUTHORITY SECTION:
pl.                     1724    IN      SOA     ns1.dropped.net.pl. kontakt.dropped.pl. 2008121404 3600 1800 1209600 3600

;; Query time: 101 msec
;; SERVER: 8.8.8.8#53(8.8.8.8)
;; WHEN: Thu Nov 30 19:15:36 UTC 2017
;; MSG SIZE  rcvd: 103

.

nslookup -type=ANY -timeout=10 zzy.pl 8.8.8.8

Server:         8.8.8.8
Address:        8.8.8.8#53

Non-authoritative answer:
Name:   zzy.pl
Address: 212.91.7.33
Name:   zzy.pl
Address: 212.91.6.58

Authoritative answers can be found from:

來自whois:

DOMAIN NAME:    
zzy.pl

registrant type:    
organization

nameservers:    
ns1.aftermarket.pl.    
ns2.aftermarket.pl.

(...)

TL;WR,主要的收穫是當有人設置不正確時,你會得到奇怪的結果。

zzy.pl域被委派給

ns1.aftermarket.pl.
ns2.aftermarket.pl.

這些名稱伺服器配置錯誤,而不是zzy.pl(預期的)有一個區域,它們有一個pl(不正確的)區域。

因此,當您詢問這些名稱伺服器時zzy.pl IN NS,他們沒有NS記錄(作為上述錯誤配置的直接結果)並用來自他們NODATA的記錄的響應(意味著請求的名稱存在,但沒有請求類型的記錄)回答區域SOA的版本pl

任何區域都應該至少有SOA並且NS在頂點,所以zzy.pl在這方面被打破了。

以供參考:

pl來自TLD 名稱伺服器的授權(正常) :

$ dig @a-dns.pl zzy.pl NS +norec

; <<>> DiG 9.11.1-P3-RedHat-9.11.1-3.P3.fc26 <<>> @a-dns.pl zzy.pl NS +norec
; (2 servers found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 51524
;; flags: qr; QUERY: 1, ANSWER: 0, AUTHORITY: 2, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;zzy.pl.                                IN      NS

;; AUTHORITY SECTION:
zzy.pl.                 86400   IN      NS      ns2.aftermarket.pl.
zzy.pl.                 86400   IN      NS      ns1.aftermarket.pl.

;; Query time: 25 msec
;; SERVER: 2001:a10:121:1::156#53(2001:a10:121:1::156)
;; WHEN: Thu Nov 30 20:29:50 UTC 2017
;; MSG SIZE  rcvd: 83
$

權威響應(預計與上述匹配,但NODATA 看起來好像響應來自pl區域,我們剛剛從上一步中繼續):

$ dig @ns1.aftermarket.pl. zzy.pl NS +norec

; <<>> DiG 9.11.1-P3-RedHat-9.11.1-3.P3.fc26 <<>> @ns1.aftermarket.pl. zzy.pl NS +norec
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 20464
;; flags: qr aa ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;zzy.pl.                                IN      NS

;; AUTHORITY SECTION:
pl.                     3600    IN      SOA     ns1.dropped.net.pl. kontakt.dropped.pl. 2008121404 3600 1800 1209600 3600

;; Query time: 23 msec
;; SERVER: 212.91.6.36#53(212.91.6.36)
;; WHEN: Thu Nov 30 20:24:23 UTC 2017
;; MSG SIZE  rcvd: 103

$

查詢它們以pl確認這一點:

$ dig @ns1.aftermarket.pl. pl NS +norec

; <<>> DiG 9.11.1-P3-RedHat-9.11.1-3.P3.fc26 <<>> @ns1.aftermarket.pl. pl NS +norec
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 63021
;; flags: qr aa ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 3

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;pl.                            IN      NS

;; ANSWER SECTION:
pl.                     3600    IN      NS      ns2.dropped.net.pl.
pl.                     3600    IN      NS      ns1.dropped.net.pl.

;; ADDITIONAL SECTION:
ns1.dropped.net.pl.     86400   IN      A       212.91.6.36
ns2.dropped.net.pl.     86400   IN      A       212.91.7.38

;; Query time: 23 msec
;; SERVER: 212.91.6.36#53(212.91.6.36)
;; WHEN: Thu Nov 30 20:24:29 UTC 2017
;; MSG SIZE  rcvd: 111

$

引用自:https://serverfault.com/questions/886026