clockdiff
用来检查 linux 主机之间的时间差
安装
apt install iputils-clockdiff
help
$ clockdiff
Usage:
clockdiff [options] <destination>
Options:
without -o, use ip timestamp only
-o use ip timestamp and icmp echo
-o1 use three-term ip timestamp and icmp echo
-V print version and exit
<destination> dns name or ip address
For more details see clockdiff(8).
ping 检测时差
172.20.0.142
为本机IP,所以时差为 0
$ ping -T tsandaddr -c 1 172.20.0.142
PING 172.20.0.142 (172.20.0.142) 56(124) bytes of data.
64 bytes from 172.20.0.142: icmp_seq=1 ttl=64 time=0.052 ms
TS: 172.20.0.142 43363558 absolute
172.20.0.142 0
172.20.0.142 0
172.20.0.142 0
--- 172.20.0.142 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.052/0.052/0.052/0.000 ms
clockdiff 示例
$ clockdiff -o 172.20.0.142
..................................................
host=172.20.0.142 rtt=0(0)ms/0ms delta=0ms/0ms Sun Jun 4 20:04:15 2023