Dns.GetHostAddresses 真的能取回所有注册的 IP 吗?

发布于 2024-09-13 04:26:00 字数 255 浏览 0 评论 0原文

Dns.GetHostAddresses 真的能取回所有注册的 IP 吗?

也就是说,DNS 可以针对一个 DNS 名称注册多个 IP,用于循环类型的目的(例如,多个代理服务器,但使用一个主 DNS 代理服务器名称),

但是 .NET 方法“Dns.GetHostAddresses(hostname)”是否真的能带来所有的结果?这些注册的IP地址回来了吗?

如果没有,还有其他关于如何获取 DNS 名称可能解析到的所有可能 IP 的列表的建议吗?

Does Dns.GetHostAddresses really get back all registered IPs?

That is DNS can have multiple IP's registered against a DNS name for round-robin type purposes (e.g. multiple proxy servers but give use one main DNS proxy server name)

But does the .NET method "Dns.GetHostAddresses(hostname)" really bring all of these registered IP addresses back?

If not, any other suggestions re how to get a list of all possible IP's that a DNS name may resolve to?

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

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

发布评论

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

评论(2

纵性 2024-09-20 04:26:01

Dns.GetHostAddresses 表示

GetHostAddresses 方法向 DNS 服务器查询与主机名关联的 IP 地址。

因此,它将返回它联系的 DNS 服务器可以提供的所有 IP 地址。所以答案是肯定的。但前提是您的代码运行所在的计算机的 DNS 服务器可以获取您正在查询的主机名的完整且正确的 IP 地址列表。

The documentation for Dns.GetHostAddresses indicates that

The GetHostAddresses method queries a DNS server for the IP addresses associated with a host name.

Therefore, it will return all IP addresses that the DNS server it contacts can provide. So the answer is a qualified yes. But only if the DNS server that the machine your code runs on can obtain a full and correct list of IP addresses for the host name you're querying.

我三岁 2024-09-20 04:26:00

对于具有所谓“循环”地址的服务器,它们可以配置为为单个名称提供大量 IP 地址。但是,DNS 响应的大小限制为一定大小,这反过来又限制了一次查询中可以返回的地址数量。因此,通常 DNS 服务器可能会打乱 IP 地址列表并返回适合答案的前 n 个。

进行一个思想实验,问问自己,对 google.com 的单个查询是否可能返回可能为 Google 网页提供服务的所有地址。

For servers that have so-called "round robin" addresses, they may be configured to have a lot of IP addresses offered for a single name. However, the size of a DNS response is limited to a certain size, which in turn limits the number of addresses that can be returned in one query. So typically the DNS server might shuffle the list of IP addresses and return the first n that fit in the answer.

For a thought experiment, ask yourself whether a single query to google.com could possibly return all addresses that might serve Google web pages.

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