启动ntp服务、查看状态
1)启动ntp服务
【命令】service ntpd start
2)查看ntp服务器有无和上层ntp连通
【命令】ntpstat

image
查看ntp状态时,可能会出现如下所示情况
① unsynchronised time server re-starting polling server every 8 s

image
② unsynchronised polling server every 8 s

image
这种情况属于正常,ntp服务器配置完毕后,需要等待5-10分钟才能与/etc/ntp.conf中配置的标准时间进行同步。
等一段时间之后,再次使用ntpstat命令查看状态,就会变成如下正常结果:

image
3)查看ntp服务器与上层ntp的状态
【命令】ntpq -p

image
remote:本机和上层ntp的ip或主机名,“+”表示优先,“*”表示次优先
refid:参考上一层ntp主机地址
st:stratum阶层
when:多少秒前曾经同步过时间
poll:下次更新在多少秒后
reach:已经向上层ntp服务器要求更新的次数
delay:网络延迟
offset:时间补偿
jitter:系统时间与bios时间差
4)查看ntpd进程的状态
【命令】watch "ntpq -p"
【终止】按 Ctrl+C 停止查看进程。

image
第一列中的字符指示源的质量。星号 ( * ) 表示该源是当前引用。
remote:列出源的 IP 地址或主机名。
when:指出从轮询源开始已过去的时间(秒)。
poll:指出轮询间隔时间。该值会根据本地时钟的精度相应增加。
reach:是一个八进制数字,指出源的可存取性。值 377 表示源已应答了前八个连续轮询。
offset:是源时钟与本地时钟的时间差(毫秒)。