Nameserver

NS 查找鏈在哪裡停止?

  • September 24, 2011

NS 查找鏈何時停止?

例如,如果我去A.com並且 NS 為A.comis ns.B.com

然後客戶端(瀏覽器)需要找出 IP 為B.com,NS 為B.comis ns.C.com

然後客戶端需要找出 IP 為C.com, NS 為C.comis ns.D.com

然後客戶端需要找出 IP 為D.com, NS 為D.comis ns.E.com..

我的意思是這條鏈到底在哪裡停止?

一般來說,NS 記錄儲存為膠水。因此,當您訪問時,a.com您會訪問根目錄 (*.root-servers.net),這些根目錄已硬編碼到您的 dns 伺服器中。在 .com 的情況下,您會被指向託管 .com tld 的 *.gtld-servers.net。a.com由於粘合記錄,從那裡您將獲得 NS 記錄以及 IP 地址。這是一個尋找Google的例子..

 [~] dig +trace google.com 

; <<>> DiG 9.7.3 <<>> +trace google.com
;; global options: +cmd
.           321319  IN  NS  k.root-servers.net.
.           321319  IN  NS  c.root-servers.net.
.           321319  IN  NS  l.root-servers.net.
.           321319  IN  NS  g.root-servers.net.
.           321319  IN  NS  j.root-servers.net.
.           321319  IN  NS  f.root-servers.net.
.           321319  IN  NS  d.root-servers.net.
.           321319  IN  NS  h.root-servers.net.
.           321319  IN  NS  a.root-servers.net.
.           321319  IN  NS  m.root-servers.net.
.           321319  IN  NS  e.root-servers.net.
.           321319  IN  NS  b.root-servers.net.
.           321319  IN  NS  i.root-servers.net.
;; Received 512 bytes from 10.10.0.1#53(10.10.0.1) in 7 ms

com.            172800  IN  NS  g.gtld-servers.net.
com.            172800  IN  NS  m.gtld-servers.net.
com.            172800  IN  NS  a.gtld-servers.net.
com.            172800  IN  NS  f.gtld-servers.net.
com.            172800  IN  NS  b.gtld-servers.net.
com.            172800  IN  NS  i.gtld-servers.net.
com.            172800  IN  NS  h.gtld-servers.net.
com.            172800  IN  NS  k.gtld-servers.net.
com.            172800  IN  NS  e.gtld-servers.net.
com.            172800  IN  NS  l.gtld-servers.net.
com.            172800  IN  NS  d.gtld-servers.net.
com.            172800  IN  NS  j.gtld-servers.net.
com.            172800  IN  NS  c.gtld-servers.net.
;; Received 488 bytes from 192.5.5.241#53(f.root-servers.net) in 35 ms

google.com.     172800  IN  NS  ns2.google.com.
google.com.     172800  IN  NS  ns1.google.com.
google.com.     172800  IN  NS  ns3.google.com.
google.com.     172800  IN  NS  ns4.google.com.
;; Received 164 bytes from 192.26.92.30#53(c.gtld-servers.net) in 40 ms

google.com.     300 IN  A   72.14.204.105
google.com.     300 IN  A   72.14.204.103
google.com.     300 IN  A   72.14.204.99
google.com.     300 IN  A   72.14.204.147
google.com.     300 IN  A   72.14.204.104
;; Received 108 bytes from 216.239.36.10#53(ns3.google.com) in 124 ms

ns3.google.com 的地址是從附加部分中返回的 gtld-server 獲得的。

[~] dig @c.gtld-servers.net ns3.google.com       

; <<>> DiG 9.7.3 <<>> @c.gtld-servers.net ns3.google.com
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 62420
;; flags: qr rd; QUERY: 1, ANSWER: 0, AUTHORITY: 4, ADDITIONAL: 4
;; WARNING: recursion requested but not available

;; QUESTION SECTION:
;ns3.google.com.            IN  A

;; AUTHORITY SECTION:
google.com.     172800  IN  NS  ns2.google.com.
google.com.     172800  IN  NS  ns1.google.com.
google.com.     172800  IN  NS  ns3.google.com.
google.com.     172800  IN  NS  ns4.google.com.

;; ADDITIONAL SECTION:
ns2.google.com.     172800  IN  A   216.239.34.10
ns1.google.com.     172800  IN  A   216.239.32.10
ns3.google.com.     172800  IN  A   216.239.36.10
ns4.google.com.     172800  IN  A   216.239.38.10

;; Query time: 44 msec
;; SERVER: 192.26.92.30#53(192.26.92.30)
;; WHEN: Sat Sep 24 10:04:56 2011
;; MSG SIZE  rcvd: 164

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