如何在Ping中使用时间戳选项


8

我注意到ping帮助中有一个时间戳选项-T。但是我不知道如何使用它。

我试过了:

ping www.google.com -T

这是我得到的:

Invalid timestamp type

时间戳记类型是什么,如何使用?

Answers:


10

-T选项用于询问跃点在收到ping后将时间戳插入IP数据包中。它通过使用RFC791TS指定的IP数据包选项来工作

ping -T需要一个参数:一tsonlytsandaddrtsprespec。您可以在线阅读手册或通过运行man ping获取有关用法的更多信息。

这是用法示例:

$ ping -T tsandaddr 192.168.1.1
PING 192.168.1.1 (192.168.1.1) 56(124) bytes of data.
64 bytes from 192.168.1.1: icmp_seq=1 ttl=64 time=3.22 ms
TS:     192.168.1.3 63668917 absolute
    192.168.1.1 534841740 absolute not-standard
    192.168.1.1 1 not-standard
    192.168.1.3 3

64 bytes from 192.168.1.1: icmp_seq=2 ttl=64 time=6.59 ms
TS:     192.168.1.3 63669919 absolute
    192.168.1.1 534842745 absolute not-standard
    192.168.1.1 0 not-standard
    192.168.1.3 6

64 bytes from 192.168.1.1: icmp_seq=3 ttl=64 time=3.20 ms
TS:     192.168.1.3 63670920 absolute
    192.168.1.1 534843743 absolute not-standard
    192.168.1.1 1 not-standard
    192.168.1.3 3

^C
--- 192.168.1.1 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2002ms
rtt min/avg/max/mdev = 3.207/4.343/6.599/1.595 ms

请注意,我已经在LAN上尝试过了。互联网上的某些跃点可能会使用timestamp选项拒绝IP数据包。(实际上,我无法使用ping通任何Internet主机-T,可能是因为ISP拒绝了我的数据包。)

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.