首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >当ntpd.conf中有本地ntpd服务器引用时,如何更新机器时间?

当ntpd.conf中有本地ntpd服务器引用时,如何更新机器时间?
EN

Server Fault用户
提问于 2018-10-29 21:44:32
回答 1查看 490关注 0票数 2

我的FreeIPA服务器的日期时间漂移了大约10分钟,导致登录失败。ntpd服务正在启动和运行。我检查了配置,并注意到freeIPA添加了一个本地服务器来同步ntpd.conf文件中的时间。

这就是ntpd.conf中FreeIPA添加的内容:

代码语言:javascript
复制
### Added by IPA Installer ###
server 127.127.1.0 iburst
fudge 127.127.1.0 stratum 10

我也有标准的百人池。

代码语言:javascript
复制
# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
server 0.centos.pool.ntp.org iburst
server 1.centos.pool.ntp.org iburst
server 2.centos.pool.ntp.org iburst
server 3.centos.pool.ntp.org iburst

但是,ntpd服务不会使用公共ntp池,也不会纠正漂移,因为它查看本地ntpd服务器。

使用FreeIPA添加的行,当我试图强制ntpd更新其时间时,这就是我得到的:

代码语言:javascript
复制
service ntpd stop
ntpd -gq
ntpd: time slew +0.000000s
service ntpd start

删除由ntpd.conf添加到FreeIPA的行可以使更新正常工作:

代码语言:javascript
复制
 service ntpd stop
 ntpd -gq
 ntpd: time set -543.065651s
 service ntpd start

所以我的问题是:

  1. 如何使ntpd正确使用外部ntpd时钟?
  2. FreeIPA似乎也对我的客户机进行了这些更改(它将ntp服务器指向我的ipa服务器,然后设置本地ntpd服务器)。这也导致没有一个客户端进行适当的更新,我将如何正确地修复这个问题?
  3. 这些添加的本地服务器配置是否可以被删除?看来这只是多年前的事了吗?https://www.redhat.com/archives/freeipa-users/2013-February/msg00260.html

完全配置:

代码语言:javascript
复制
# For more information about this file, see the man pages
# ntp.conf(5), ntp_acc(5), ntp_auth(5), ntp_clock(5), ntp_misc(5), ntp_mon(5).

driftfile /var/lib/ntp/drift

# Permit time synchronization with our time source, but do not
# permit the source to query or modify the service on this system.
restrict default nomodify notrap nopeer noquery

# Permit all access over the loopback interface.  This could
# be tightened as well, but to do so would effect some of
# the administrative functions.
restrict 127.0.0.1
restrict ::1

# Hosts on local network are less restricted.
#restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap

# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
server 0.centos.pool.ntp.org iburst
server 1.centos.pool.ntp.org iburst
server 2.centos.pool.ntp.org iburst
server 3.centos.pool.ntp.org iburst

#broadcast 192.168.1.255 autokey        # broadcast server
#broadcastclient                        # broadcast client
#broadcast 224.0.1.1 autokey            # multicast server
#multicastclient 224.0.1.1              # multicast client
#manycastserver 239.255.254.254         # manycast server
#manycastclient 239.255.254.254 autokey # manycast client

# Enable public key cryptography.
#crypto

includefile /etc/ntp/crypto/pw

# Key file containing the keys and key identifiers used when operating
# with symmetric key cryptography.
keys /etc/ntp/keys

# Specify the key identifiers which are trusted.
#trustedkey 4 8 42

# Specify the key identifier to use with the ntpdc utility.
#requestkey 8

# Specify the key identifier to use with the ntpq utility.
#controlkey 8

# Enable writing of statistics records.
#statistics clockstats cryptostats loopstats peerstats

# Disable the monitoring facility to prevent amplification attacks using ntpdc
# monlist command when default restrict does not include the noquery flag. See
# CVE-2013-5211 for more details.
# Note: Monitoring will not be disabled with the limited restriction flag.
disable monitor

### Added by IPA Installer ###

### Added by IPA Installer ###

### Added by IPA Installer ###
server 127.127.1.0 iburst
fudge 127.127.1.0 stratum 10
EN

回答 1

Server Fault用户

发布于 2018-10-30 01:14:20

有了10块软糖,它真的不应该选择当地的时钟。

您可以尝试使用服务器池之一的prefer选项来强制它选择internet时间源:

server 0.centos.pool.ntp.org iburst prefer

在进行更改并重新启动服务之后,在运行ntpq -pn查询服务状态时,应该会在首选池旁边看到星号(*)。

票数 2
EN
页面原文内容由Server Fault提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://serverfault.com/questions/937765

复制
相关文章

相似问题

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