加入收藏 | 设为首页 | 会员中心 | 我要投稿 佛山站长网 (https://www.0757zz.com/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 服务器 > 搭建环境 > Linux > 正文

CentOS中NTP服务器的搭建

发布时间:2016-11-04 04:51:04 所属栏目:Linux 来源:网络整理
导读:先简单介绍几个名词 Atomic Clock: 现在计算时间最准确的是使用 原子震荡周期 所计算的物理时钟(Atomic Clock),因此也被定义为标准时间(International Atomic T

udp        0      0 192.168.80.3:123            0.0.0.0:*                               22816/ntpd  

udp        0      0 127.0.0.1:123               0.0.0.0:*                               22816/ntpd  

udp        0      0 0.0.0.0:123                 0.0.0.0:*                               22816/ntpd  

udp        0      0 fe80::20c:29ff:fed4:315f:123 :::*                                    22816/ntpd  

udp        0      0 ::1:123                     :::*                                    22816/ntpd  

udp        0      0 :::123                      :::*                                    22816/ntpd

2.查看系统日志,确定启动过程无报错

# tail -n 20 -f /var/log/messages

Oct 31 10:56:29 CentOS1 ntpd[22815]: ntpd 4.2.4p8@1.1612-o Fri Feb 22 11:23:27 UTC 2013 (1)

Oct 31 10:56:29 CentOS1 ntpd[22816]: precision = 0.052 usec

Oct 31 10:56:29 CentOS1 ntpd[22816]: Listening on interface #0 wildcard, 0.0.0.0#123 Disabled

Oct 31 10:56:29 CentOS1 ntpd[22816]: Listening on interface #1 wildcard, ::#123 Disabled

Oct 31 10:56:29 CentOS1 ntpd[22816]: Listening on interface #2 lo, ::1#123 Enabled

Oct 31 10:56:29 CentOS1 ntpd[22816]: Listening on interface #3 eth0, fe80::20c:29ff:fed4:315f#123 Enabled

Oct 31 10:56:29 CentOS1 ntpd[22816]: Listening on interface #4 lo, 127.0.0.1#123 Enabled

Oct 31 10:56:29 CentOS1 ntpd[22816]: Listening on interface #5 eth0, 192.168.80.3#123 Enabled

Oct 31 10:56:29 CentOS1 ntpd[22816]: Listening on routing socket on fd #22 for interface updates

Oct 31 10:56:29 CentOS1 ntpd[22816]: kernel time sync status 2040

Oct 31 10:56:29 CentOS1 ntpd[22816]: frequency initialized 23.140 PPM from /var/lib/ntp/drift

3.确认已进行时间同步

该命令执行,通常要等10到15分钟,才会显示同步成功

# ntpstat

synchronised to NTP server (202.112.31.197) at stratum 3

  time correct to within 80 ms

  polling server every 128 s

#进行时间校对的NTP服务器

#本地主机与上层NTP服务器的时间差

#下次同步时间

4.查看与上层服务器连接情况

# ntpq -p

    remote           refid      st t when poll reach   delay   offset  jitter

==============================================================================

+dns1.synet.edu. 202.118.1.46     2 u   13   64   77  567.019  132.808  32.883

*dns2.synet.edu. 202.118.1.46     2 u   58   64   37  209.322  -47.016  36.082

remote 本地主机所连接的上层NTP服务器

*目前正在使用的上层NTP

+已连线,可提供时间更新的候补服务器

refid 给上层NTP服务器提供时间校对的服务器

st 就是stratum 上层NTP的级别

when 几秒钟前曾做过时间同步更新

poll 下一次更新在几秒后

reach 已经向上层服务器要求更新的次数

delay 网络传输过程中的延迟时间

offset 本地主机与上层NTP服务器的时间差,该值的绝对值越接近0,与上层服务器的时间就越接近

jitter 一个统计值,这个值的绝对值越小,本地主机的时间就越精确

5.确认无问题后,将服务设为开机启动

# chkconfig --list ntpd

ntpd            0:off   1:off   2:off   3:off   4:off   5:off   6:off

# chkconfig ntpd on

# chkconfig --list ntpd

ntpd            0:off   1:off   2:on    3:on    4:on    5:on    6:off

查看本栏目更多精彩内容:http://www.bianceng.cn/OS/Linux/

(编辑:佛山站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

热点阅读