gpt4 book ai didi

dns - 如何让 DNS 从本地主机解析与从远程主机解析相同的内容?

转载 作者:行者123 更新时间:2023-12-05 07:48:01 27 4
gpt4 key购买 nike

我正在尝试创建一个家庭自动化系统,它可以在我工作的白天照看我的狗。我在这个项目中的目标是学习一些关于 DNS、文件服务和 RaspberryPi 的知识。

我的硬件设置是这样的:

  • 1 个 RaspberryPi(启用摄像​​头,并计划将其用作我家路由器后面的网络服务器)。
  • 1 个 digital ocean 迷你实例(ubuntu12.04,DNS 通过 BIND 提供)。
  • 1 台 macbook(暂时用它测试 DNS,但以后会最常使用 iPhone)。

我想使用 bubby.com 作为域名。这在我从我的 digital ocean 服务器查询时有效。但是,如果我从我的笔记本电脑上尝试,我会得到一个不同的 ip。

来自 digital ocean 实例的测试:

  1. dns 设置(/etc/resolv.conf 的内容) 名称服务器 x.x.x.x 名称服务器 8.8.8.8 名称服务器 8.8.4.4
  2. bubby.com 的 nslookup
    nslookup bubby.com

    Server:     x.x.x.x
    Address: x.x.x.x#53
    Name: bubby.com
    Address: y.y.y.y

    (据我所知,1 和 2 是正确的)

来自 macbook 的测试

  1. wifi 的 DNS 设置(从网络偏好设置中检索):名称服务器 x.x.x.x,8.8.8.8

  2. bubby.com 的 nslookup
    nslookup bubby.com

    Server:     x.x.x.x
    Address: x.x.x.x#53
    Non-authoritative answer:
    Name: bubby.com
    Address: 216.21.239.197

谁能帮我解释为什么我从显示不同地址的同一个 dns 服务器得到不同的结果,即使 dns 服务器的服务器/地址是正确的?

更新 1:重新运行 nslookup 测试
日期 && nslookup bubby.com

    Sat Aug 20 05:57:01 PDT 2016
Server: x.x.x.x
Address: x.x.x.x#53
Non-authoritative answer:
Name: bubby.com
Address: 216.21.239.197

从笔记本电脑上挖掘 bubby.com
日期 && dig bubby.com @192.241.227.149

    Sat Aug 20 06:06:27 PDT 2016

; <<>> DiG 9.8.3-P1 <<>> bubby.com @x.x.x.x
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 18813
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;bubby.com. IN A

;; ANSWER SECTION:
bubby.com. 3600 IN A 216.21.239.197

;; Query time: 132 msec
;; SERVER: x.x.x.x#53(x.x.x.x)
;; WHEN: Sat Aug 20 06:06:27 2016
;; MSG SIZE rcvd: 43

使用 dns 从 digital ocean 服务器中挖掘 hubby.com
约会 && dig bubby.com @x.x.x.x

    Sat Aug 20 13:12:36 UTC 2016

; <<>> DiG 9.8.1-P1 <<>> bubby.com @x.x.x.x
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 38404
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 1

;; QUESTION SECTION:
;bubby.com. IN A

;; ANSWER SECTION:
bubby.com. 604800 IN A y.y.y.y

;; AUTHORITY SECTION:
bubby.com. 604800 IN NS ns.bubby.com.

;; ADDITIONAL SECTION:
ns.bubby.com. 604800 IN A y.y.y.y

;; Query time: 2 msec
;; SERVER: x.x.x.x#53(x.x.x.x)
;; WHEN: Sat Aug 20 13:12:36 2016
;; MSG SIZE rcvd: 76

更新 2:在指定另一台 DNS 服务器时从笔记本电脑进行 DNS 查找
日期 && nslookup ip.smartydns.com 87.117.205.40

    Sat Aug 20 09:12:09 PDT 2016
Server: 87.117.205.40
Address: 87.117.205.40#53
Non-authoritative answer:
Name: ip.smartydns.com
Address: 82.196.5.38

最佳答案

查看笔记本电脑的 dig 输出,注意 AUTHORITY: 0。这样做的原因是因为这个答案不是来自您的 Digital Ocean 实例(我已经从几个不同的位置进行了测试,并且我总是得到与您从实例本身进行测试时得到的结果相同的结果),而是来自其他一些 DNS 服务器这不是 bubby.com 的权威。

决赛smartyDNS测试证实了这一点:你和互联网其余部分之间的某人/某物(很可能是你的 ISP 或受损的家庭路由器)正在充当 'Transparent DNS proxy' ,拦截您的 DNS 查询并将它们重定向到他们自己的 DNS 服务器。

如果您想确定,因为可能只有 UDP/TCP 端口 53 被拦截,您可以尝试将 BIND 更改为 listen at some other port ,然后通过查询新端口的 dig 从数字 Ocean 实例和您的笔记本电脑进行测试:

dig bubby.com @192.241.227.149 -p 5555

这次您应该会得到相同的结果。

关于dns - 如何让 DNS 从本地主机解析与从远程主机解析相同的内容?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39050737/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com