为什么“ping”有效,但“ping -R”失败?

Let*_*ion 5 networking

Ping www.google.com 有效,但 ping -R www.google.com 失败。为什么?

Mar*_*ied 6

它对我有用,也对我有用。

根据手册页:

"Note that the IP header is only large enough for nine such routes.  
 Many hosts ignore or discard this option."
Run Code Online (Sandbox Code Playgroud)

因此,如果路由超过 9 跳,包括您的本地机器,那么您将看到的只是前 9 跳。


ish*_*ish 6

ping -R是一种穷人的跟踪路由,它RECORD_ROUTE在发送的数据包中设置标志,要求沿途的每个主机返回数据包在该点所采用的路径。

正如 Marty 所指出的,可以记录的最大长度是 9 跳,许多主机可能会忽略这个标志。

尝试traceroutemtr代替,如果你想找出路线的ICMP(ping)数据包正在赶路到google.com


Joh*_*ber 5

某些站点可能会将此类请求视为潜在的安全问题,因为它们会揭示可能对攻击者有用的网络连接信息。因此,它们可能会默默地丢弃数据包。

出于同样的原因,许多站点也不允许使用 traceroute 功能。