linux一直ping -t,linux – -T选项导致ping命令

我正在学习ping命令.

我无法通过-T tsonly和-T tsandaddr了解ping命令的输出.

输出是:

$ping -T tsonly 192.168.1.52

PING 192.168.1.52 (192.168.1.52) 56(124) bytes of data.

64 bytes from 192.168.1.52: icmp_req=1 ttl=63 time=0.470 ms

TS: 43448298 absolute

1

31

0

-31

0

$ping -T tsandaddr 192.168.1.52

PING 192.168.1.52 (192.168.1.52) 56(124) bytes of data.

64 bytes from 192.168.1.52: icmp_req=1 ttl=63 time=0.434 ms

TS: 192.168.2.64 43461227 absolute

192.168.2.10 0

192.168.1.52 32

192.168.1.52 0

我用谷歌搜索.但我没有找到答案.在手册页中我也找不到答案.

我知道它打印的绝对时间是从24小时午夜时间戳开始的毫秒数.

除此之外,剩下的三次是什么时候?为什么在两个ping输出中打印?有什么用?

解决方法:

-T选项要求节点(每个跃点)在接收到ping时在IP数据包中插入时间戳.它的工作原理是使用由RFC791指定的IP数据包的TS选项.

ping -T需要一个tsonly,tsandaddr或tsprespec的参数. tsonly只返回时间戳. tsandaddr返回timstamp和发送数据包的地址.

从手册页:

-T timestamp option

Set special IP timestamp options. timestamp option may be

either tsonly (only timestamps), tsandaddr (timestamps and

addresses) or tsprespec host1 [host2 [host3 [host4]]] (timestamp

prespecified hops).

例如,当我从192.168.1.191在我的本地网络上ping 192.168.1.10时,我收到以下输出:

ping -T tsandaddr 192.168.1.10

PING 192.168.1.10 (192.168.1.10) 56(124) bytes of data.

64 bytes from 192.168.1.10: icmp_seq=1 ttl=64 time=4.32 ms

TS: 192.168.1.191 31636378 absolute

192.168.1.10 6

192.168.1.10 0

192.168.1.191 -1

更新01

发出tsandaddr标志时返回四个时间值.在下面的示例中,我们看到31636378绝对值,6,0和-1.

ping -T tsandaddr 192.168.1.10

PING 192.168.1.10 (192.168.1.10) 56(124) bytes of data.

64 bytes from 192.168.1.10: icmp_seq=1 ttl=64 time=4.32 ms

TS: 192.168.1.191 31636378 absolute

192.168.1.10 6

192.168.1.10 0

192.168.1.191 -1

大值(31636378)是自UTC午夜以来的毫秒数,这就是使用-T标志时第一个数字继续向上计数的原因.这个大数字是参考时间.

第一个值(6)是以毫秒为单位传输ping所花费的时间.第二个值(0)是目标接收ping所用的时间(以毫秒为单位).第三个值(-1)是将回复发送给发件人所花费的时间.

我相信0和-1毫秒的值表明我所瞄准的目标没有响应,因此我得到无用的值.

随意在某些网站上测试此命令,有些回复合法的值.

–timestamp Send ICMP_TIMESTAMP packets, thereby requesting a timed response from the targetted host.

In successful cases three time values are returned. All are expected

to state the number of milliseconds since midnight UTC. The first of

these, ‘icmp_otime’, contains the original time of sending the

request. Then comes ‘icmp_rtime’, the time of reception by the target,

and finally, ‘icmp_ttime’, the time of transmitting an answer back to

the originator.

标签:linux,ping

来源: https://codeday.me/bug/20190810/1637567.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值