
5

使用dig确定local DNS使用哪个IP进行DNS查询
source link: https://sikasjc.github.io/2020/09/12/dig-ip/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

使用dig确定local DNS使用哪个IP进行DNS查询
2020年9月12日

这里的local DNS实际是指进行递归查询的DNS,recursive resolver
-
虽然客户端知道它正在与哪个local DNS交流,但它不知道local DNS正在使用哪个 IP 地址与权威DNS交流,也不知道local DNS可能传递的 EDNS0 Client Subnet Extension(ECS)信息。
-
也就是说,我们只知道图中蓝色部分客户端进行查询时的 local DNS 的IP,但是很难知道,在红色部分中 local DNS 使用哪个IP,这可能导致local DNS返回错误的结果(例如,返回对应域名的错误运营商的IP,电信的用户返回了移动的IP)
-
local DNS 还经常通过不同于客户端使用的IP版本(IPv4与IPv6)与权威DNS进行对话
-
对于许多Local DNS,客户端通过anycast向其发出查询,但是local DNS将使用本地单播地址来发出查询。
-
而许多CDN的权威DNS(或其他全局流量管理系统和请求裸路由)经常会使用local DNS的请求地址和传递的可能提供更好客户端位置信息ECS数据,来确定如何引导流量
因此我们需要确认local DNS查询时使用的IP是符合预期的
akahelp.net
- Akamai提供了一个DNS tools 用于解决这样的问题
- 提供了local DNS进行dns查询时,使用的单播IP地址
- Dual Stack (recursive resolver chooses the protocol):
1
whoami.ds.akahelp.net
- Force recursion over IPv6 (when available):
1
whoami.ipv6.akahelp.net
- Force recursion over IPv4:
1
whoami.ipv4.akahelp.net
- 还包括了权威DNS看到的ENS0 End User Client Subnet (ECS, RFC7871) 信息,只会响应TXT 记录查询
1
2
3
4
$ dig +short TXT whoami.ds.akahelp.net ok at 11:20:47
"ns" "123.126.126.12"
"ecs" "120.52.147.1/32/24"
"ip" "123.126.126.12"
ns
是local DNS进行单播的IP地址,可能是ipv4和ipv6。并且一些local DNS是服务器集群,所以会有选择的使用不同版本的不同IP地址,因此在 ‘.ds’, ‘.ipv4’, '.ipv6’进行不同的查询。- 如果Local DNS 将ECS信息与查询一起发送,则可能还会出现两个其他记录。
ecs
记录是查询中包含的ECS客户端子网。ip
记录是由Akamai的权威名称服务器从ECS client subnet中随机选择的代表IP地址。 (local DNS 不会发送与local DNS进行通信的实际客户端IP,以减少对ECS的隐私影响。)
Reference
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK