如何通过DNS协议检测两台主机之间的网络延迟?

发布于 2024-08-12 02:27:52 字数 279 浏览 3 评论 0原文

  H1------------------H2
   \                  /
    \                /
     \              /
      \            /
          x (me)

假设我在点x,有两个任意宿主点H1、H2。我可以通过 ping 得到 H1 和我之间的延迟,同样我也可以通过 ping 得到 H2 和我之间的延迟(因为有时间戳),问题是,如何使用 DNS 协议得到 H1 和 H2 之间的延迟?

  H1------------------H2
   \                  /
    \                /
     \              /
      \            /
          x (me)

Suppose I'm in the point x, and there're two arbitrary host points, H1, H2. I can get the delay between H1 and me by ping, same I can also get the delay between H2 and me by ping (because there's time stamp), the question is, how to get the delay between H1 and H2 using DNS protocol?

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

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

发布评论

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

评论(3

笑饮青盏花 2024-08-19 02:27:52

怎么样:将 H1 定义为某个域的权威名称服务器,然后要求 H2 解析该域。然后计算解析时间(可能会给出“我不知道”响应)并减去 H2 的 ping 时间。

PS 告诉你的朋友,作弊者永远不会成功。

编辑以删除我认为这是愚蠢的说法。我认为这个问题毕竟不是毫无意义的——记住这是一个学术练习。这可能不是很实用,但我认为这是可能的,也许通过我的解决方案。 (一般来说,三角测量可能是一个更好的主意,但它需要机器位于正确的位置。)

另外,是的,我应该提到这需要两台机器都运行 DNS 服务器。然而,可能没有使用 DNS 的解决方案不这样做。这个问题是二手的,可能最初就有这样的规定。

What about this: define H1 as the authoratative nameserver for some domain, then ask H2 to resolve that domain. Then time the resolve (perhaps with an "I don't know" response) and subtract ping time to H2.

P.S. Tell your friend that cheaters never prosper.

EDITED to remove my claim that this was idiotic. I think this question isn't senseless after all - remember that this is an academic exercise. It may not be very practical, but I think it might be possible, and maybe through my solution. (Triangulating is probably a better idea in general, but it requires machines in the right places.)

Also, yes, I should have mentioned that this requires both machines to be running DNS servers. Probably there's no solution using DNS that does not, however. This question is second-hand and may have originally had that stipulation.

日久见人心 2024-08-19 02:27:52

她的问题毫无意义。

DNS 用于将主机名(例如,google.comsstatic.net)转换为 IP 地址(例如,64.233.169.104>69.59.196.213)。

它与各个服务器的物理位置或网络连接无关。

一般来说,不可能远程确定两个任意服务器之间的链接速度。如果您可以连接到其中一台服务器并使其直接 ping 另一台服务器,您就可以通过这种方式获得它们的链接速度,但否则这是不可能的。

Her question makes no sense.

DNS is used to turn hostnames (eg, google.com or sstatic.net) into IP addresses (eg, 64.233.169.104 or 69.59.196.213).

It has nothing to do with the physical location or network connectivity of individual servers.

In general, it's not possible to determine the link speed between two arbitrary servers remotely. If you can connect to one of the servers and make it ping the other one directly, you can get their link speed that way, but otherwise, it's impossible.

何止钟意 2024-08-19 02:27:52

首先,DNS 绝对不能在这里提供任何线索
编辑:[遵循 Grumdrig 的评论] ...除了与 DNS 消息执行往返这些服务器的时间相关的线索之外。我最初的说法的意思是,DNS 协议没有任何内在的东西比 HTTP、ICMP、FTP 或任何协议更适合此目的可能会导致服务器返回一些消息。

其次,实现此目的的简单方法是在 H1 或 H2 上直接拥有软件/访问权限,但我假设问题的实质是:

我们如何< em>估算 H1 和 H2 之间的延迟,无需直接访问任一主机

估算可以通过使用 H1 或 H2 与多个工作站(不仅仅是一个)之间的读数(时间和路线)来完成。 (以及在这些许多工作站之间建立路线)。

这个过程类似于三角测量,用于在简单的 2D 或 3D 欧几里德空间中查找距离或位置,但当然,请记住

  • 网络路线是动态的(与几何中的线段不同)
  • 距离不是那么线性;-)

另一种可能的技巧可以在特殊情况下估计此距离:
- 如果 H1 或 H2 恰好是可以从第三位置查询的服务器

- 如果该服务器需要其他主机的服务来满足此类请求。

例如,如果 H1 是一个 Web 服务器,它使用位于 H2 上的 Web 服务来生成特定的网页。通过对 H1 的此类请求进行多次测量,并扣除 H1 和我们的工作站之间的距离/延迟,我们可以估计 H1 和 H2 之间的距离/延迟。我们需要小心地

  • 进行多次测量,以便对许多因素进行平均,包括该链的非网络部分(比如 Web 服务器解析请求所需的时间,处理一些数字等等......)
  • 考虑各种可能性,例如可能的缓存等...
  • 估计链的非网络相关部分

这种特殊情况的特殊情况是,如果碰巧 H1 [或 H2] 位于第三点和 H2 之间的路线上[或H1]。在这种情况下,假设与跟踪路由相关的 ICMP 数据包在途中没有被过滤/停止,一个简单的跟踪路由就可以回答这个问题。然而这种情况相对不太可能......

First off, DNS can absolutely NOT provide any clue here.
Edit: [following Grumdrig's remark] ... other than the the clues associated with the timing of DNS messages to perform a round trip to these servers. What I mean by the original statement is that there is nothing intrinsic to the DNS protocol that makes it more suited for this purpose than say HTTP, ICMP, FTP or whatever protocol may cause the server to return some message.

Second, the easy way to do this is to have software/access, directly on either H1 or H2, but I'm assuming that's the spirit of the question really is:

How can we estimate the delay between H1 and H2, without having direct access to either host?

An estimation can be done, by using the readings (timing and routes) between H1 or H2 and several workstations (not just one). (as well as having the routes between these many workstations).

This process would be akin to triangulating for finding distances or positions in a plain 2D or 3D euclidean space, but of course, remembering that

  • network routes are dynamic (unlike segments in geometry)
  • distances are not so linear ;-)

Another possible trick to estimate this distance is available, in a special case:
- if H1 or H2 happens to be a server which can be queried from a third location
and
- if this server requires the services of the other host to honor such request.

For example if H1 is a web server which uses a webservices located on H2 to produce a particular web page. By taking multiple measurements for such requests to H1, and by deducting the distance/delay between H1 and our workstation, we can probably estimate the distance/delay between H1 and H2. We need to be careful to

  • take multiple measurements for the purpose of averaging many factors, including the non-network portions of the this chain (say the time it takes for the web server to parse the request, crunch some numbers whatever...)
  • take into various possibilities such as possible caching etc...
  • estimate the non-network related portion of the chain

A special case of this special case, is if by chance H1 [or H2] is on the very route between the third point and H2 [or H1]. In that case, and assuming that the ICMP packets associated with traceroute are not filtered/stopped on the way, a simple traceroute would answer the question. This situation is however relatively unlikely...

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