首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >NTP配置中的时间漂移和错误时区

NTP配置中的时间漂移和错误时区
EN

Unix & Linux用户
提问于 2018-03-26 13:25:42
回答 1查看 3K关注 0票数 1

我们有两个VLAN,每个VLAN都有一个服务器,为其相应的VLAN提供DHCP、DNS和NTP。这3台服务器从本地NTP服务器上花费时间。以下是每个VLAN上NTP客户端和服务器的配置以及每个设置的问题:

VLAN 1:

NTP服务器(科学Linux 7.3)

代码语言:javascript
复制
restrict default kod nomodify notrap nopeer noquery
restrict -6 default kod nomodify notrap nopeer noquery
logfile /var/log/ntp.log
driftfile /var/lib/ntp/drift
includefile /etc/ntp/crypto/pw
keys /etc/ntp/keys
restrict 127.0.0.1
restrict xx.xx.xx.xx mask XX.XX.XX.XX nomodify notrap

NTP客户端(科学Linux 7.3)

代码语言:javascript
复制
driftfile /var/lib/ntp/drift
restrict default kod nomodify notrap nopeer noquery
restrict -6 default kod nomodify notrap nopeer noquery
restrict 127.0.0.1
restrict -6 ::1
includefile /etc/ntp/crypto/pw
keys /etc/ntp/keys
server yy.yy.yy.yy   # added by /sbin/dhclient-script

尽管有正确的时区,此服务器始终向前移动3小时。

VLAN 2:

NTP服务器(科学Linux 6.4)

代码语言:javascript
复制
restrict default kod nomodify notrap nopeer noquery
restrict -6 default kod nomodify notrap nopeer noquery
logfile /var/log/ntp.log
server 127.1.1.0 # local clock
fudge  127.127.1.0
driftfile /var/lib/ntp/drift
restrict 127.0.0.1
restrict xx.xx.xx.xx mask XX.XX.XX.XX nomodify notrap

NTP客户端(科学Linux 6.4)

代码语言:javascript
复制
driftfile /var/lib/ntp/drift
restrict default kod nomodify notrap nopeer noquery
restrict -6 default kod nomodify notrap nopeer noquery
restrict 127.0.0.1
restrict -6 ::1
includefile /etc/ntp/crypto/pw
keys /etc/ntp/keys
server yy.yy.yy.yy   # added by /sbin/dhclient-script

在这里我不能改变时区。它应该是EET,但是不管/etc/localtime链接值如何,它始终是EEST

我已确保:

  1. 没有防火墙规则(iptables -F)
  2. ntpd守护进程正在运行并启用(chckonfig on)
  3. CentOS 7.x使用另一个名为chronyd的时间服务,它阻止ntpd启动。所以我禁用了它(失去了它的源代码:( ) )。

在设置这些服务之后,我们将它们与本地NTP同步一次。通过对每个服务器上的DHCP配置,我们拥有了option ntp-servers xx.xx.xx.xx;,因此NTP信息是通过DHCP分布的。我尝试将本地NTP服务器的地址添加到服务器的/etc/ntp.conf中,但问题仍然存在。

注意,所有服务器都是通过VMWare ESXi虚拟化的。

EN

回答 1

Unix & Linux用户

发布于 2018-03-28 06:56:21

因此,经过与这些服务器的斗争,问题已经得到解决。以下是详细信息:

  1. 对于CentOS 7.X服务器,我禁用了ntpd,并在客户端维护ntpd时使用了chronyd。从chronyd 7.X开始,似乎CentOS将是受支持的NTP守护进程。chronyd配置只需要/etc/chrony.conf中的server xx.xx.xx.xx prefer iburstallow yy.yy.yy.yy/ZZ
  2. 对于CentOS 6.4服务器,我必须安装tzdata 这里的新版本,然后将/etc/localtime链接到相应的时区,在我的例子中是Asia/Amman

我发现了一些陷阱:

  • 通过停止no server suitable for synchronization found,运行ntpdate,然后启动ntpd,解决了CentOS 6.4客户机上的可怕错误ntpd
  • 由于某些原因,我不记得了,在CentOS 6.4中,我不得不将restrict 127.0.0.1改为restrict localhost
票数 0
EN
页面原文内容由Unix & Linux提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://unix.stackexchange.com/questions/433604

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档