如何使用 ping 命令获取传输和接收时间

如何使用 ping 命令获取传输和接收时间

如何 ping 计算机/服务器并分别获取传输和接收时间,而不是获取一个往返时间。我使用 hrping,我可以从本地网络上的计算机获取传输和接收时间。

D:\Portable\hrping>hrping 192.168.1.1 -M
This is hrPING v5.07.1148 by cFos Software GmbH -- http://www.cfos.de

Source address is 192.168.1.17; using ICMP timestamp, ID=801c
Pinging 192.168.1.1 [192.168.1.1]
with 0 bytes data (40 bytes IP):

From 192.168.1.1: bytes=40 seq=0001 TTL=64 ID=62f3 time=0.626ms tx=1ms rx=0ms
From 192.168.1.1: bytes=40 seq=0002 TTL=64 ID=62f4 time=0.923ms tx=1ms rx=0ms
From 192.168.1.1: bytes=40 seq=0003 TTL=64 ID=62f5 time=0.336ms tx=1ms rx=-1ms
From 192.168.1.1: bytes=40 seq=0004 TTL=64 ID=62f6 time=0.320ms tx=1ms rx=-1ms

Packets: sent=4, rcvd=4, error=0, lost=0 (0.0% loss) in 1.502086 sec
RTTs in ms: min/avg/max/dev: 0.320 / 0.551 / 0.923 / 0.246
Bandwidth in kbytes/sec: sent=0.106, rcvd=0.106  

但它对互联网上的任何东西都不起作用。

D:\Portable\hrping>hrping google.com -M
This is hrPING v5.07.1148 by cFos Software GmbH -- http://www.cfos.de

Source address is 192.168.1.17; using ICMP timestamp, ID=082b
Pinging google.com [172.217.16.238]
with 0 bytes data (40 bytes IP):

Timeout waiting for seq=0001
Timeout waiting for seq=0002
Timeout waiting for seq=0003
Timeout waiting for seq=0004

Packets: sent=4, rcvd=0, error=0, lost=4 (100.0% loss) in 1.503945 sec
RTTs in ms: min/avg/max/dev: 0.000 / 0.000 / 0.000 / 0.000
Bandwidth in kbytes/sec: sent=0.106, rcvd=0.000   

我从 hrping 收到此消息,并设置了防火墙规则。但仍然没有结果。

hrPing did not get any replies.  This might be due to a firewall setting.

If you use Windows firewall with default settings, you need to add a rule to
allow hrPing full incoming ICMP traffic:

Go to Control Panel, Windows Firewall and click on Advanced settings on the
left.  A new dialog appears: on its left pane right-click 'Inbound Rules' and
select 'New rule...'  In the following wizard select 'Custom', click Next,
select 'All programs', click Next, select 'ICMPv4' as 'Protocol type', click
Next 4 times and enter 'hrPing' as 'Name' and click 'Finish'.

Don't forget to disable or delete this rule when you no longer need it!

答案1

hrping -M使用 ICMP时间戳请求数据包而不是通常的 Echo Request。

许多管理员将其服务器配置为仅允许非常有限的 ICMP 请求类型列表 - 它们通常允许 ICMP Echo(每个人都将其与“ping”关联起来)而不允许其他任何请求。

因此,虽然 hrPing 的消息是正确的,这可能是防火墙问题,但问题出在其他结束,而你对此真的无能为力 – 除了尝试 ping 其他东西。

(例如,“superuser.com”会响应时间戳请求,而“google.com”则不会。我从中下载 hrPing 的“cfos.de”网站也会响应时间戳请求,但方式有点奇怪。)

答案2

您很可能正在 ping 已禁用 ICMP ping 的网络。许多网络出于安全原因禁用 ping,例如为了防止 ping 泛滥。Google 就是这样一家公司。

尝试 ping amazon.com 和 yahoo.com,因为它们目前允许 ping。

相关内容