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

CentOS中NTP服务器的搭建

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

先简单介绍几个名词

Atomic Clock: 现在计算时间最准确的是使用 原子震荡周期 所计算的物理时钟(Atomic Clock),因此也被定义为标准时间(International Atomic Time)

UTC(coordinated Universal Time): 协和标准时间 就是利用 Atomic Clock 为基准定义出来的正确时间

硬件时钟: 硬件时钟是指嵌在主板上的特殊的电路, 它的存在就是平时我们关机之后还可以计算时间的原因

系统时钟: 就是操作系统的kernel所用来计算时间的时钟. 它从1970年1月1日00:00:00 UTC时间到目前为止秒数总和的值

搭建 NTP 服务之前的准备

1.检查系统时区是否正确

在中国,正确的时区应为 CST(Chinese Standard Time),也就是我们通常所说的北京时间.

那么中国当地的时间晚上8点的话,我们可以有下面两种表示方式

20:00 CST

12:00 UTC

因为中国处在UTC+8时区,依次类推,在UTC标准时间,就是12:00了.

不管通过任何渠道我们想要同步系统的时间,通常提供方只会给出UTC+0的时间值而不会提供时区(因为它不知道你在哪里).所以当我们设置系统时间的时候,设置好时区是首先要做的工作

# date

Thu Oct 31 11:22:45 EDT 2013

如果发现时区不正确,修改方法见本文 附1

2.检查 NTP 是否安装

# rpm -qa |grep ^ntp

ntp-4.2.4p8-3.el6.centos.x86_64

ntpdate-4.2.4p8-3.el6.centos.x86_64

如上所示就是正确安装了

3.检查上层 NTP 服务器是否正常连通

直接使用国家对时服务器

1.cn.pool.ntp.org

2.cn.pool.ntp.org

为了防止出现上层对时服务器故障,无法正确提供时间同步,一般建议配置两个或以上时间同步服务器.下面分别测试两个时钟服务是否正常可用

# ntpdate -q 1.cn.pool.ntp.org

server 202.112.10.36, stratum 2, offset -1.883582, delay 0.18350

server 202.112.29.82, stratum 2, offset -1.860654, delay 0.23692

server 202.112.31.197, stratum 2, offset -1.812637, delay 0.13278

server 218.75.4.130, stratum 2, offset -1.837221, delay 0.04099

31 Oct 09:07:03 ntpdate[1625]: step time server 218.75.4.130 offset -1.837221 sec

# ntpdate -q 2.cn.pool.ntp.org

server 202.112.10.36, stratum 2, offset -1.834295, delay 0.07317

server 202.112.29.82, stratum 2, offset -1.810122, delay 0.12784

server 202.112.31.197, stratum 2, offset -1.838527, delay 0.07227

server 218.75.4.130, stratum 2, offset -1.833332, delay 0.04346

31 Oct 09:12:36 ntpdate[22558]: step time server 218.75.4.130 offset -1.833332 sec

如上所示,就是正常的,如果上层服务器不可用,一般如下显示

server 10.32.196.60, stratum 0, offset 0.000000, delay 0.00000

26 Oct 15:01:17 ntpdate[23338]: no server suitable for synchronization found

(编辑:佛山站长网)

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

热点阅读