DNS代理导致上网慢
问题描述
有客户反映,使用AR上网时浏览器一直处于加载状态,网页加载缓慢。
处理过程
- 使用Chrome浏览器的故障排除功能,浏览器打开 www.sina.com.cn,自动进入子网站,访问子网站sax.sina.com.cn需要10多秒。

- 在PC上抓包,浏览器不断解析sax.sina.com.cn的AAAA记录,没有收到任何响应(AAAA表示要查询的域名的IPv6地址)。

- 抓取AR的WAN和LAN侧的数据包,DNS服务器返回一个带有SOA资源记录的DNS响应报文,表示DNS服务器无法解析sax.sina.com.cn的IPv6地址。AR不转发DNS响应报文给PC。

- 当AR作为DNS代理时,DNS响应报文的响应数为0时,AR默认不转发给DNS客户端。

根本原因
作为DNS代理的AR默认不向DNS客户端转发响应数为0的DNS响应报文。导致浏览器等待DNS响应的时间过长,导致上网速度变慢。
AR作为DNS代理的默认行为如下:配置2 个 DNS服务器并向Server1发送查询数据包,如果Server1发送的响应报文中响应个数为0,则AR不转发响应报文给PC。而是AR以轮询的方式将响应报文发送给Server2 。如果Server2发送的响应报文中的响应个数不为0,则AR将响应数据包转发给PC。

在AR上配置DNS 代理forward-any-response命令后,行为如下:配置2台DNS服务器。AR收到查询后,向Server1发送查询报文。如果Server1的响应报文中的响应个数为0,则AR将响应报文转发给PC,不向Server2发送查询报文。

解决方案
执行dns proxy forward-any-response
和dns proxy ipv6 forward-any-response
命令,使DNS代理能够将DNS服务器的所有响应报文转发给DNS客户端。
总结
针对上网慢的问题,通过抓包查看DNS响应时间和更换DNS服务器,快速判断问题是否与DNS服务有关。