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 的操作 ...
随机推荐
- ios隐藏键盘
1.点击页面空白处隐藏键盘 给viewController里面复写-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event方法,在 ...
- 递归绑定将数据表中的数据按层级更新到 TreeView节点上
private void bindTreeView1() { string sql = "select * from dm_category&quo ...
- SparkContext源码阅读
SparkContext是spark的入口,通过它来连接集群.创建RDD.广播变量等等. class SparkContext(config: SparkConf) extends Logging w ...
- vim(5)vim下wimrc的配置,解决中文乱码问题
解决linux下vim乱码的情况:(修改vimrc的内容) 全局的情况下:即所有用户都能用这个配置 文件地址:/etc/vimrc 在文件中添加: ,ucs-bom,gb18030,gbk,gb231 ...
- javascript里for循环的一些事情
今天在给一个学妹调她的代码BUG时,她的问题就是在一个for循环里不清楚流程的具体流向,所以导致了页面怎么调都是有问题,嗯确实你如果不清楚语句流向很轻易就会出问题,所以说for循环不会用或者说用的不恰 ...
- android Tab 类型切换界面
实现方案:viewpager + fragment + FragmentPagerAdapter 效果图: 可以左右滑动切换选项卡,或者点击: 如果想使用fragment的时候又想可以左右滑动,就可以 ...
- 3,SFDC 管理员篇 - 区域划分
1,销售区域划分 Setup | Administrator | Manage Territory Territory Type : 帮助用户建立大的销售区域分类,分类顺序按照Priority进行显示 ...
- zedboard如何从PL端控制DDR读写(四)
PS-PL之间的AXI 接口分为三种:• 通用 AXI(General Purpose AXI) — 一条 32 位数据总线,适合 PL 和 PS 之间的中低速通信.接口是透传的不带缓冲.总共有四个通 ...
- Python自动化 【第八篇】:Python基础-Socket编程进阶
本节内容: Socket语法及相关 SocketServer实现多并发 1. Socket语法及相关 sk = socket.socket(socket.AF_INET,socket.SOCK_STR ...
- Egret 摇一摇功能
一 什么是重力感应 二 什么是陀螺仪 三 Egret中的摇一摇是利用什么原理实现的 四 摇一摇代码 一 什么是重力感应 二 什么是陀螺仪 三 Egret中的摇一摇是利用什么原理实现的 大概是利用手机 ...