ping 8.8.8.8

今天某在米国挂了独立博客的同事惊叹:
ping google的DNS服务器如此之快。

jxncct50:~ # ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=43 time=40.6 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=43 time=47.6 ms
64 bytes from 8.8.8.8: icmp_seq=3 ttl=43 time=40.8 ms
64 bytes from 8.8.8.8: icmp_seq=4 ttl=43 time=44.5 ms
64 bytes from 8.8.8.8: icmp_seq=5 ttl=43 time=45.7 ms
64 bytes from 8.8.8.8: icmp_seq=6 ttl=43 time=46.0 ms
64 bytes from 8.8.8.8: icmp_seq=7 ttl=43 time=40.7 ms

jxncct50:~ # ping www.google.com
PING www.l.google.com (74.125.128.99) 56(84) bytes of data.
64 bytes from hg-in-f99.1e100.net (74.125.128.99): icmp_seq=1 ttl=43 time=72.3 ms
64 bytes from hg-in-f99.1e100.net (74.125.128.99): icmp_seq=2 ttl=43 time=64.9 ms
64 bytes from hg-in-f99.1e100.net (74.125.128.99): icmp_seq=3 ttl=43 time=60.9 ms
64 bytes from hg-in-f99.1e100.net (74.125.128.99): icmp_seq=4 ttl=43 time=40.6 ms
64 bytes from hg-in-f99.1e100.net (74.125.128.99): icmp_seq=5 ttl=43 time=53.6 ms



ping 8.8.8.8 和 www.google.com 都是要穿越太平洋海底光缆的,按说,这个速度不能这么快。
网传…..
因为中美距离是半个地球,光一秒钟30 万公里,绕地球7.5圈,1秒钟=1000毫秒,则绕地球半圈速度是1000/15=66毫秒,数据返回需要同样的时间。
ping美国一台服务器,数据请求过去,再回来,所需要的时间,就是我们常说的ping值。数据仅仅从海底光缆这头到那头,就已经需要133ms应答和传送时间了。所以ping值小于133ms的主机不可能位于美国。

于是我试了试 ping yahoo

jxncct50:~ # ping www.yahoo.com :
PING any-fp3-real.wa1.b.yahoo.com (72.30.38.140) 56(84) bytes of data.
64 bytes from ir1.fp.vip.sp2.yahoo.com (72.30.38.140): icmp_seq=1 ttl=46 time=235 ms
64 bytes from ir1.fp.vip.sp2.yahoo.com (72.30.38.140): icmp_seq=2 ttl=46 time=254 ms
64 bytes from ir1.fp.vip.sp2.yahoo.com (72.30.38.140): icmp_seq=3 ttl=46 time=256 ms
64 bytes from ir1.fp.vip.sp2.yahoo.com (72.30.38.140): icmp_seq=4 ttl=46 time=236 ms
64 bytes from ir1.fp.vip.sp2.yahoo.com (72.30.38.140): icmp_seq=5 ttl=46 time=255 ms
64 bytes from ir1.fp.vip.sp2.yahoo.com (72.30.38.140): icmp_seq=6 ttl=46 time=298 ms

这才是正常情况嘛,于是google了一下,有如下发现:

Anycast最初是在RFC1546中提出并定义的,它的最初语义是,在IP网络上通过一个Anycast地址标识一组提供特定服务的主机,同时 服务访问方并不关心提供服务的具体是哪一台主机(比如DNS或者镜像服务),访问该地址的报文可以被IP网络路由到这一组目标中的任何一台主机上,它提供 的是一种无状态的、尽力而为的服务。目前对于Anycast的中文译称主要有,”任播”、”泛潘”、”选播”等,本文一律使用”任播”一词,或者直接使用 英文单词”Anycast”。

Anycast is a network addressing and routing methodology in which datagrams from a single sender are routed to the topologically nearest node in a group of potential receivers all identified by the same destination address.
http://en.wikipedia.org/wiki/Anycast

原文地址:https://www.cnblogs.com/cloudstorage/p/2588135.html