在 Windows XP 上,什么情况下 NSLOOKUP 和 PING 返回不同的 IP 地址?

发布于 2024-07-15 13:23:45 字数 1459 浏览 1 评论 0原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

流绪微梦 2024-07-22 13:23:45

nslookup 仅使用 DNS,而 ping 将首先查找 hosts 文件。

示例:

nslookup localhost
Server:         208.67.220.220
Address:        208.67.220.220#53

Non-authoritative answer:
Name:   localhost.local.lan
Address: 67.215.65.132  

67.215.65.132 表示不存在的域 OpenDNS (hit-nxdomain.opendns.com)

ping localhost
PING localhost (127.0.0.1) 56(84) bytes of data.
...

nslookup uses only DNS, while ping will first look in hosts file.

Example:

nslookup localhost
Server:         208.67.220.220
Address:        208.67.220.220#53

Non-authoritative answer:
Name:   localhost.local.lan
Address: 67.215.65.132  

67.215.65.132 means non-existent domain OpenDNS (hit-nxdomain.opendns.com)

ping localhost
PING localhost (127.0.0.1) 56(84) bytes of data.
...
橘虞初梦 2024-07-22 13:23:45

在您的计算机上运行 wireshark 的副本,并跟踪正在离开的 DNS 查询您的系统,看看它们之间有什么不同。

请记住,nslookup 根据定义仅查询 DNS。 其他应用程序将使用替代的查找机制(例如hosts 文件)。

Run a copy of wireshark on your machine and trace the DNS queries that are leaving your system and see what's different between them.

Bear in mind that nslookup by definition only queries the DNS. Other applications will use alternative lookup mechanisms (e.g. the hosts file).

梦纸 2024-07-22 13:23:45

下载wireshark 非常有帮助,但如果这对某人有帮助,我在Windows 网络上遇到了这种性质的问题。 Nslookup 总是会返回我想要的 IP,但 ping 不会。 我的问题是 DNS 设置为将未知域转发到外部 DNS 服务器。

如果我使用 DNS 服务器 ping mysite.dev 而不进行转发,则第一次 DNS 查找将失败,然后使用 mysite.dev.mydomain.com 重试并成功。

如果我使用具有转发功能的 DNS 服务器 ping mysite.dev,它会转发 URL(因为它是“未知域”)并从转发的 DNS 服务器取回一些垃圾 IP。 它返回的 IP 将您带到某个ask.com 搜索页面作为 404 的替代页面。 我猜想 ISP 一定是靠这个赚钱的。 这可以防止 DNS 客户端在添加我们的域 DNS 后缀的情况下重试。

请注意,还有另一个问题,其内部 URL 类似于 mysite.dev。 在 Windows Vista(可能还有 Windows 7)上,听起来您可能需要显式配置 DNS 客户端才能尝试将 DNS 后缀应用于 mysite.dev 之类的 URL:

http://blogs.technet.com/ b/networking/archive/2009/04/16/dns-client-name-resolution-behavior-in-windows-vista-vs-windows-xp.aspx

Downloading wireshark is very helpful, but in case this helps someone, I had a problem of this nature on a Windows network. Nslookup would always return the IP I wanted, but ping would not. The problem in my case was DNS was set up to forward unknown domains to an external DNS server.

If I pinged mysite.dev using the DNS server without forwarding, the DNS lookup would fail the first time, then try again using mysite.dev.mydomain.com and succeed.

If I pinged mysite.dev using the DNS server with forwarding, it'd forward the URL (since it was an "unknown domain") and get back some garbage IP from the forwarded DNS server. The IP that it returned put you on some ask.com search page as a 404 substitute. I assume the ISP was making money off this somehow. This prevented the DNS client from retrying with our domain DNS suffix added.

Note there is another gotcha with internal urls similar to mysite.dev. On Windows Vista (and possibly Windows 7) it sounds like you might need to explicitly configure your DNS clients to try applying DNS suffixes to urls like mysite.dev:

http://blogs.technet.com/b/networking/archive/2009/04/16/dns-client-name-resolution-behavior-in-windows-vista-vs-windows-xp.aspx

与风相奔跑 2024-07-22 13:23:45

从您的 ipconfig 示例中,我假设您使用 Windows。

nslookup 仅是 DNS。

主机将使用您系统上的正常解析过程。 这可能包括(但不限于:主机、Windows 命名和 DNS)。

如何获取 Firefox 使用的 IP 地址? 如果它出现在 URL 中,您应该忽略它,因为该级别可能会发生很多事情。

From your ipconfig example, I am assuming you using Windows.

nslookup is DNS only.

hosts will use the normal resolution process on your system. This could include (but is not limited to: hosts, Windows naming, and DNS).

How are you getting the IP address that Firefox uses? If it appears in the URL, you should ignore that, many things could be happening at that level.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文