Windows Server 2008 R2 DNS使用根提示对某些域名无法解析的问题

当DNS Server从Server 2003升级到Server 2008 R2后,可能遇到这样的问题:使用根提示解析某些外部域名时,返回的IP地址为空。此时你可能会感觉非常奇怪,03解析这些域名没有问题,为什么升级到08 R2反而会有问题。

我们先来仔细看一下此问题的现象。用nslookup查时,看到返回的IP为空:

E:\>nslookup a.contoso.com

服务器: localhost

Address: 127.0.0.1

 

非权威应答:

名称: a.contoso.com

 

在DNS服务器上抓netmon,看到DNS Server(192.168.1.107)收到DNS客户端(192.168.1.105)请求后(第48帧),通过一系列根提示和CNAME替换(49~94)将a.contoso.com解析成b.contoso.com。第95~99帧,对b.contoso.com继续解析。但在没有解析出IP的情况下,第100帧直接回复客户端,IP为空。

48 3.0836047            192.168.1.105      192.168.1.107 DNS DNS:QueryId = 0x3, QUERY (Standard query), Query for a.contoso.com of type Host Addr on class Internet

49 3.0941067 192.168.1.107 some.dns.server DNS DNS:QueryId = 0xAE00, QUERY (Standard query), Query for a.contoso.com of type Host Addr on class Internet

 

……此处省略了根提示和CNAME替换的过程………

 

95 4.2918082 192.168.1.107 some.dns.server DNS DNS:QueryId = 0xC98D, QUERY (Standard query), Query for b.contoso.com of type Host Addr on class Internet

99 4.3035002 some.dns.server 192.168.1.107 DNS DNS:QueryId = 0xC98D, QUERY (Standard query), Response - Success, Array[192.168.2.189]

100 4.3048338 192.168.1.107 192.168.1.105 DNS DNS:QueryId = 0x3, QUERY (Standard query), Response - Success, , 

 

现在的关键是,到底第99帧收到了什么样的回复,致使DNS Server做出这样异常的行为。为此我们再看一下第99帧的细节:

- Dns: QueryId = 0xC98D, QUERY (Standard query), Response - Success, Array[192.168.2.189]

    QueryIdentifier: 51597 (0xC98D)

  + Flags: Response, Opcode - QUERY (Standard query), AA, Rcode - Success

    QuestionCount: 1 (0x1)

    AnswerCount: 1 (0x1)

    NameServerCount: 1 (0x1)

    AdditionalCount: 2 (0x2)

  + QRecord: b.contoso.com of type Host Addr on class Internet

  + ARecord: b.contoso.com of type CNAME on class Internet: c.contoso.com

  + AuthorityRecord: b.contoso.com of type NS on class Internet: some.dns.server

  + AdditionalRecord: some.dns.server of type Host Addr on class Internet: 192.168.2.189

  + AdditionalRecord: Type: OPT, Sender's largest UDP payload size: 4096

 

我们看到,在第99帧中,首先将b.contoso.com 通过CNAME 解析成 c.contoso.com。然后是b.contoso.com的NS记录和对应的IP地址。

这里的关键是:b.contoso.com既是CNAME,又是NS记录。因为某种原因,08 R2不允许这种情况存在。最终的结果是缓存中的CNAME被替换成NS记录,解析无法继续,直接向客户端返回。而03则允许两者并存,所以没有这样的问题。

目前对应这个问题,已经有hotfix可以解决,即 KB2616776。打上此hotfix之后,该问题得到了完美解决。

说明:为保护隐私,文中的Netmon数据做了修改和省略处理,与实际情况可能有一定出入。此hotfix的链接:https://support.microsoft.com/kb/2616776