如何在递归过程中解决 DNS 问题?

str*_*gee 13 domain-name-system recursive

我的 DNS 有一个非常奇怪的问题。我的域名 ( strugee.net) 在某些网络上无法解析,而在其他网络上却可以解析。

例如,在我的家庭网络(服务器所在的同一网络)上:

% dig strugee.net

; <<>> DiG 9.10.3-P4 <<>> strugee.net
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 10086
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;strugee.net.           IN  A

;; ANSWER SECTION:
strugee.net.        1800    IN  A   216.160.72.225

;; Query time: 186 msec
;; SERVER: 205.171.3.65#53(205.171.3.65)
;; WHEN: Sat Apr 16 15:42:36 PDT 2016
;; MSG SIZE  rcvd: 56
Run Code Online (Sandbox Code Playgroud)

但是,如果我登录到我在 Digital Ocean 上的服务器,域将无法解析:

% dig strugee.net      

; <<>> DiG 9.9.5-9+deb8u3-Debian <<>> strugee.net
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: SERVFAIL, id: 58551
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 512
;; QUESTION SECTION:
;strugee.net.           IN  A

;; Query time: 110 msec
;; SERVER: 2001:4860:4860::8844#53(2001:4860:4860::8844)
;; WHEN: Sat Apr 16 18:44:25 EDT 2016
;; MSG SIZE  rcvd: 40
Run Code Online (Sandbox Code Playgroud)

但是,直接访问权威域名服务器工作正常:

% dig @dns1.registrar-servers.com strugee.net   

; <<>> DiG 9.9.5-9+deb8u3-Debian <<>> @dns1.registrar-servers.com strugee.net
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 30856
;; flags: qr aa rd; QUERY: 1, ANSWER: 1, AUTHORITY: 5, ADDITIONAL: 1
;; WARNING: recursion requested but not available

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;strugee.net.           IN  A

;; ANSWER SECTION:
strugee.net.        1800    IN  A   216.160.72.225

;; AUTHORITY SECTION:
strugee.net.        1800    IN  NS  dns3.registrar-servers.com.
strugee.net.        1800    IN  NS  dns4.registrar-servers.com.
strugee.net.        1800    IN  NS  dns2.registrar-servers.com.
strugee.net.        1800    IN  NS  dns1.registrar-servers.com.
strugee.net.        1800    IN  NS  dns5.registrar-servers.com.

;; Query time: 3 msec
;; SERVER: 216.87.155.33#53(216.87.155.33)
;; WHEN: Sat Apr 16 18:46:36 EDT 2016
;; MSG SIZE  rcvd: 172
Run Code Online (Sandbox Code Playgroud)

很明显,某处的某个大型网络存在问题,无法解析我的域,但我似乎无法弄清楚在哪里。我浏览了dig联机帮助页以查找可能有帮助的选项,但没有发现任何特别有用的内容。

我在 Namecheap 上既是域注册商又是 DNS 托管。我打开了 DNSSEC 选项。我最近没有对我的 DNS 设置进行任何更改。

如何调试此问题并找到有问题的名称服务器?

And*_*w B 25

如何调试此问题并找到有问题的名称服务器?

daxd5 提供了一些很好的入门建议,但这里唯一真正的答案是您需要知道如何像递归 DNS 服务器一样思考。由于权威层存在大量错误配置可能导致不一致SERVFAIL,因此您需要 DNS 专业或在线验证工具。

无论如何,我们的目标不是逃避帮助你,但我想确保你明白这个问题没有决定性的答案。


在您的特定情况下,我注意到这strugee.net似乎是一个用 DNSSEC 签名的区域。从推荐链中存在的DSRRSIG记录可以明显看出这一点:

# dig +trace +additional strugee.net
<snip>
strugee.net.            172800  IN      NS      dns2.registrar-servers.com.
strugee.net.            172800  IN      NS      dns1.registrar-servers.com.
strugee.net.            172800  IN      NS      dns3.registrar-servers.com.
strugee.net.            172800  IN      NS      dns4.registrar-servers.com.
strugee.net.            172800  IN      NS      dns5.registrar-servers.com.
strugee.net.            86400   IN      DS      16517 8 1 B08CDBF73B89CCEB2FD3280087D880F062A454C2
strugee.net.            86400   IN      RRSIG   DS 8 2 86400 20160423051619 20160416040619 50762 net. w76PbsjxgmKAIzJmklqKN2rofq1e+TfzorN+LBQVO4+1Qs9Gadu1OrPf XXgt/AmelameSMkEOQTVqzriGSB21azTjY/lLXBa553C7fSgNNaEXVaZ xyQ1W/K5OALXzkDLmjcljyEt4GLfcA+M3VsQyuWI4tJOng184rGuVvJO RuI=
dns2.registrar-servers.com. 172800 IN   A       216.87.152.33
dns1.registrar-servers.com. 172800 IN   A       216.87.155.33
dns3.registrar-servers.com. 172800 IN   A       216.87.155.33
dns4.registrar-servers.com. 172800 IN   A       216.87.152.33
dns5.registrar-servers.com. 172800 IN   A       216.87.155.33
;; Received 435 bytes from 192.41.162.30#53(l.gtld-servers.net) in 30 ms
Run Code Online (Sandbox Code Playgroud)

在我们继续之前,我们需要检查签名是否有效。DNSViz是经常用于此目的的工具,它确认确实存在问题。图片中愤怒的红色表明您有问题,但与其将鼠标悬停在所有内容上,不如展开左侧边栏上的通知

RRSIG strugee.net/A alg 8, id 10636: The Signature Expiration field of the RRSIG RR (2016-04-14 00:00:00+00:00) is 2 days in the past.
RRSIG strugee.net/DNSKEY alg 8, id 16517: The Signature Expiration field of the RRSIG RR (2016-04-14 00:00:00+00:00) is 2 days in the past.
RRSIG strugee.net/DNSKEY alg 8, id 16517: The Signature Expiration field of the RRSIG RR (2016-04-14 00:00:00+00:00) is 2 days in the past.
RRSIG strugee.net/MX alg 8, id 10636: The Signature Expiration field of the RRSIG RR (2016-04-14 00:00:00+00:00) is 2 days in the past.
RRSIG strugee.net/NS alg 8, id 10636: The Signature Expiration field of the RRSIG RR (2016-04-14 00:00:00+00:00) is 2 days in the past.
RRSIG strugee.net/SOA alg 8, id 10636: The Signature Expiration field of the RRSIG RR (2016-04-14 00:00:00+00:00) is 2 days in the past.
RRSIG strugee.net/TXT alg 8, id 10636: The Signature Expiration field of the RRSIG RR (2016-04-14 00:00:00+00:00) is 2 days in the past.
net to strugee.net: No valid RRSIGs made by a key corresponding to a DS RR were found covering the DNSKEY RRset, resulting in no secure entry point (SEP) into the zone. (216.87.152.33, 216.87.155.33, UDP_0_EDNS0_32768_4096)
Run Code Online (Sandbox Code Playgroud)

问题很明显:您区域上的签名已过期,需要刷新密钥。您看到不一致结果的原因是,并非所有递归服务器都启用了 DNSSEC 验证。验证的人正在删除您的域,而对于那些没有验证的人,一切照旧。


编辑: Comcast 的 DNS 基础设施以实施 DNSSEC 验证而闻名,作为他们的客户之一,我可以确认我也看到了SERVFAIL

$ dig @75.75.75.75 strugee.net | grep status
;; ->>HEADER<<- opcode: QUERY, status: SERVFAIL, id: 2011
Run Code Online (Sandbox Code Playgroud)


小智 5

当您确实看到权威名称服务器正确响应时,您需要跟踪整个 DNS 解析链。也就是说,从根服务器向上走整个 DNS 层次结构。

$ dig net NS
;; ANSWER SECTION:
net.            172800  IN  NS  c.gtld-servers.net.
net.            172800  IN  NS  f.gtld-servers.net.
net.            172800  IN  NS  k.gtld-servers.net.
;; snipped extra servers given
$ dig @c.gtld-servers.net strugee.net NS
;; AUTHORITY SECTION:
strugee.net.        172800  IN  NS  dns2.registrar-servers.com.
strugee.net.        172800  IN  NS  dns1.registrar-servers.com.
;; snipped extra servers again
Run Code Online (Sandbox Code Playgroud)

这基本上检查公共 DNS 服务器是否正常工作,并且您正在做与您的 DNS 解析器应该做的相同的事情。所以你应该在你的 Digital Ocean 服务器中得到与上面相同的答案,除非他们的 DNS 解析器有问题:

$ dig net NS
$ dig strugee.net NS
$ dig strugee.net
Run Code Online (Sandbox Code Playgroud)

如果前两个查询失败,则是 Digital Ocean 端的 DNS 失败。检查/etc/resolv.conf并尝试查询辅助 DNS 服务器。如果第二个工作正常,只需切换解析器的顺序,然后再试一次。