ntp -q 输出说明
-bash-3.00# ntpq -p
remote refid st t when poll reach delay offset disp
==============================================================================
*10.0.2.71 LOCAL(0) 4 u 4 64 377 0.58 -0.584 0.09
前导符:
The character in the left margin indicates the fate of this peer in the clock selection process. The codes mean:
SPACE Discarded due to high stratum and/or failed sanity checks.
x Designated falsticker by the intersection algorithm.
. Culled from the end of the candidate list.
- Discarded by the clustering algorithm.
+ Included in the final selection set.
# Selected for synchronization; but distance exceeds maximum.
* Selected for synchronization.
remote:
the hostname or IP of the remote machine. (ntp.conf文件中配置的server和peer主机)
refid:
the identification of the time source to which the remote machines is synced. (0.0.0.0 if the ref ID is unknown) (远程主机的NTP Server地址)
st:
the stratum of the remote machine. 16 is "unsynchronized". 0 is the best value, that could be (for example) a radio clock or the ntp servers private caesium clock.
NTP采用分层同步方式,一般第n+1级与第n级时钟源进行同步。NTP最多支持16层同步,即0-15层。多于16层将无法同步。注意st的值表示的是远程主机的层级。如果远程主机是当前主机的NTP Server的话,一般情况下本级主机的层级是st+1。
t:
The type of the peer (local, unicast, multicast or broadcast) when the last packet was received.
l local (such as a GPS clock)
u unicast (this is the common type) (单播,即NTP client向NTP server发送NTP请求,NTP server回复的模式)
m multicast (多播,可跨子网。)
b broadcast (广播,不可跨子网。NTP server定时向广播地址发送NTP包,NTP client通过广播地址获取NTP包,同步本地时钟)
- netaddr (usually 0)
when:
how many seconds since the last poll of the remote machine.
自上次时钟同步以来经过了多少秒。当when=poll时,进行一次时钟同步,同时when被清零,从头开始计时。通过when可以知道上一次同步时间(当前时间-when)和下一次同步时间(当前时间+poll-when)。
poll:
polling interval to the remote host, defined with the "minpoll" value in ntp.conf file
时钟同步时间间隔。ntp服务刚启动时,缺省的最小同步间隔是64(minpoll=6)秒,然后依次增加,128, 256, ……, 1024。缺省的最大值是1024(maxpoll=10)秒。这两个值分别可以通过minpoll和maxpoll参数修改。
reach:
an 8-bit left-rotating register. Any 1 bit means that a "time packet" was received.
八进制数,表示最近8次时钟同步包接收情况。1表示接收成功,0表示接收失败。每接收一个包左移一位。对于一个运行较长时间的NTP client而言,这个值应该是377->11,111,111,即最近8次包接收均成功;否则表示有丢包情况发生。NTP启动后reach值的变化如下:
1->00,000,001
3->00,000,011
7->00,000,111
17->00,001,111
37->00,011,111
77->00,111,111
177->01,111,111
377->11,111,111
……
377->11,111,111
如果最近的一次包接收失败,则变化情况如下:
376->11,111,110
375->11,111,101
373->11,111,011
……
177->01,111,111
377->11,111,111
delay:
roundtrip delay, the time delay (in milliseconds) to communicate with the remote.
表示NTP client从发出NTP请求到接收到NTP服务器回复所经过的时间。
offset:
the offset (in milliseconds) between our time and that of the remote.
即NTP client的本地时间与NTP服务器时间的差异。也就是NTP client需要调整的时间差异。
disp:
DISP=indicates the difference in the offset measurement between two samples. This is an error-bound estimate. The dispersion is a primary measure of the network service quality.
表示两次时钟同步之间的offset的差值。
Note: According to Sun, NTP can only sync time if it is off by no more than 17 minutes. Furthermore, adjusting time being off by seconds will take several minutes because NTP is architected to slowly adjust to the NTP master's time.(时钟差异超过17分钟将无法同步)
如果在solaris10上出现了因为时钟差异较大而无法进行时钟同步,最简单的方式就是重启一下NTP client端的ntp服务。
#> svcadm restart ntp
ntp的启动脚本中使用了ntpdate命令先与NTP server同步一次时间,然后再启动xntpd进程。
ntp服务的启动脚本:/lib/svc/method/xntp
……
# Run ntpdate to sync system to peer before starting xntpd
[ -n "$ARGS" ] && /usr/sbin/ntpdate $ARGS
/usr/lib/inet/xntpd
在solaris上使用snoop查看时钟同步包
-bash-3.00# snoop -d e1000g0 udp port 123
Using device /dev/e1000g0 (promiscuous mode)
node2 -> 10.0.2.71 NTP client [st=5] (2011-12-06 16:52:18.57994)主机node2(NTP client)向10.0.2.71发NTP请求包, node2层级是5, 包中是node2本地时间
10.0.2.71 -> node2 NTP server [st=4] (2011-12-06 16:52:18.57914)10.0.2.71(NTP server)向node2回复,10.0.2.71层级是4,包中是10.0.2.71的本地时间
node2 -> 10.0.2.71 NTP client [st=5] (2011-12-06 16:53:22.57963)
10.0.2.71 -> node2 NTP server [st=4] (2011-12-06 16:53:22.57871)
node2 -> 10.0.2.71 NTP client [st=5] (2011-12-06 16:54:26.57921)
10.0.2.71 -> node2 NTP server [st=4] (2011-12-06 16:54:26.57825)……
-bash-3.00# snoop -V port 123
Using device /dev/e1000g0 (promiscuous mode)
________________________________
node2 -> 10.0.2.71 ETHER Type=0800 (IP), size = 90 bytes
node2 -> 10.0.2.71 IP D=10.0.2.71 S=10.0.2.72 LEN=76, ID=61706, TOS=0x0, TTL=255
node2 -> 10.0.2.71 UDP D=123 S=123 LEN=56
node2 -> 10.0.2.71 NTP client [st=5] (2011-12-06 16:58:42.57762)
________________________________
10.0.2.71 -> node2 ETHER Type=0800 (IP), size = 90 bytes
10.0.2.71 -> node2 IP D=10.0.2.72 S=10.0.2.71 LEN=76, ID=12572, TOS=0x0, TTL=255
10.0.2.71 -> node2 UDP D=123 S=123 LEN=56
10.0.2.71 -> node2 NTP server [st=4] (2011-12-06 16:58:42.57666)
ntp -q 输出说明的更多相关文章
- GPS北斗NTP校时服务器原理及功能介绍
在科技的发展下GPS北斗NTP校时服务器也得到了广泛应用,比如工业.科研.航空航天.公共场所等领域都用到了GPS北斗NTP校时服务器,该时间服务器以卫星时间为基准授时准确,替代了传统钟表授时的单一和时 ...
- [转]网络时间的那些事及 ntpq 详解
Gentoo(也许其他发行版也是?)中 "ntpq -p" 的 man page 只有简短的描述:“打印出该服务器已知的节点列表和它们的状态概要信息.” 我还没见到关于这个命令的说 ...
- /etc/init.d/sshd配置SSHD路径忘记修改导致启动失败
[root@lnlte2dmr3 ~]# bash[root@lnlte2dmr3 ~]# install -v -m700 -d /var/empty/sshdinstall: 正在创建目录&quo ...
- Linux基础命令---ntpdate网络时间服务器
ntpdate ntpdate指令通过轮询指定为服务器参数的网络时间协议(NTP)服务器来设置本地日期和时间,从而确定正确的时间. 此命令的适用范围:RedHat.RHEL.Ubuntu.CentOS ...
- Jvm --- 常用工具
jps:虚拟机进程状况工具 JVM Process Status Tool. 可以列出所有目前正在运行虚拟机的进程. jps -l 详细参数: -q 输出LVMID,省略主类名称 -m 输出虚拟机进程 ...
- Linux 系统命令笔记
前言 翻出N年前学习笔记,感觉还有点用,放到博客备忘,自己查看用. 一. 系统命令笔记 1.系统 % /etc/issue # 查看操作系统版本 % # 观察系 ...
- [BZOJ1014][JSOI2008]火星人prefix
[BZOJ1014][JSOI2008]火星人prefix 试题描述 火星人最近研究了一种操作:求一个字串两个后缀的公共前缀.比方说,有这样一个字符串:madamimadam,我们将这个字符串的各个字 ...
- [COJ2201][KOJ0223][KOJ0250]花园
[KOJ0223][KOJ0250]花园 试题描述 小奇的花园有n个温室,标号为1到n,温室以及以及温室间的双向道路形成一棵树. 每个温室都种植着一种花,随着季节的变换,温室里的花的种类也在不断发生着 ...
- C#基础:LINQ 查询函数整理
1.LINQ 函数 1.1.查询结果过滤 :where() Enumerable.Where() 是LINQ 中使用最多的函数,大多数都要针对集合对象进行过滤,因此Where()在LINQ 的操作 ...
随机推荐
- JAVA为什么要配置环境变量,怎样配置
自己总结些再加抄点:安装JDK后要配置环境变量,主要有三个:1 JAVA_HOME ->为JDK的安装目录,如:F:\JAVA\jdk1.6.0_042 CLASSPATH ->到哪里找需 ...
- 113、ScrollView滑动到了最底部
ScrollView使用 http://www.cnblogs.com/androidsj/archive/2012/03/04/2379387.html 滚动到顶部判断:getScrollY() = ...
- tracer
http://people.canonical.com/~acelan/coscup-2010/Debugging%20Linux%20Kernel%20by%20Ftrace.pdf http:// ...
- HTML中行内元素与块级元素的区别
块级元素:独占一行,可设宽高,内外边距:块级元素有form,p,h1到h6,ol ,ul ,dl和dd和dt ,hr,li,pre,caption ,div ,table ,tr ,td ,th等. ...
- MFC之动态创建按钮
打开VS 创建MFC基于对话框的工程,在对话框初始化方法中动态创建一个按钮实例: 1> CButton *pMyButton = new CButton();CEdit *pMyEdit = n ...
- 不让Win7休眠的设置
1:原因 目前有一个项目是采用微服务的架构搭建的,其中一个微服务的数据库是在一位同事的电脑上(Win7系统),一旦这台电脑休眠,对应的数据库服务就访问不了,所以,需要保持此台电脑永不休眠. 2:傻瓜式 ...
- openldap加密传输sssd
http://blog.father.gedow.net/2015/09/29/sssd-ldap-sudo/ yum -y install openldap-clients sssd authcon ...
- xml 中转意字符&\/使用方法
所有 XML 元素都须有关闭标签 在 HTML,经常会看到没有关闭标签的元素: <p>This is a paragraph <p>This is another paragr ...
- APK Downgrade Method working fine on LINE latest version 6.7.1
Line is one of the most popular messaging Apps, especially in Asia. On March 3 I downgraded the app ...
- Redis的主从同步复制
先来看一下Redis的主从同步复制的原理: 在Slave启动并连接到Master之后,它将主动发送一条SYNC命令.此后Master将启动后台存盘进程,同时收集所有接收到的用于修改数据集的命令,在后台 ...