首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >允许NTP自动大量更新?

允许NTP自动大量更新?
EN

Server Fault用户
提问于 2013-10-03 11:23:26
回答 3查看 2K关注 0票数 3

下面是我的场景:我在工作站上运行多个VM来模拟生产环境。在一天结束的时候,我在下午6点睡我的工作站(后台运行我的VM)。当我第二天早上8点回到办公室,叫醒工作站时,我的所有VM都是下午6点。

厌倦了重新设置NTP或简单地记住强制更新,我将以下内容放在一个5分钟的cron中

service ntp stop && ntpd -gq && service ntp start

这是我的/etc/ntp.conf

代码语言:javascript
复制
tinker panic 0

driftfile /var/lib/ntp/ntp.drift

logfile /var/log/ntpd.log

# Enable this if you want statistics to be logged.
#statsdir /var/log/ntpstats/

statistics loopstats peerstats clockstats
filegen loopstats file loopstats type day enable
filegen peerstats file peerstats type day enable
filegen clockstats file clockstats type day enable

# Specify one or more NTP servers.

# Use servers from the NTP Pool Project. Approved by Ubuntu Technical Board
# on 2011-02-08 (LP: #104525). See http://www.pool.ntp.org/join.html for
# more information.
server 0.ubuntu.pool.ntp.org
server 1.ubuntu.pool.ntp.org
server 2.ubuntu.pool.ntp.org
server 3.ubuntu.pool.ntp.org

# Use Ubuntu's ntp server as a fallback.
server ntp.ubuntu.com

# Access control configuration; see /usr/share/doc/ntp-doc/html/accopt.html for
# details.  The web page <http://support.ntp.org/bin/view/Support/AccessRestrictions>
# might also be helpful.
# 
# Note that "restrict" applies to both servers and clients, so a configuration
# that might be intended to block requests from certain clients could also end
# up blocking replies from your own upstream servers.

# By default, exchange time with everybody, but don't allow configuration.
restrict -4 default kod notrap nomodify nopeer noquery
restrict -6 default kod notrap nomodify nopeer noquery

# Local users may interrogate the ntp server more closely.
restrict 127.0.0.1
restrict ::1

# Clients from this (example!) subnet have unlimited access, but only if
# cryptographically authenticated.
#restrict 192.168.123.0 mask 255.255.255.0 notrust


# If you want to provide time to your local subnet, change the next line.
# (Again, the address is an example only.)
#broadcast 192.168.123.255

# If you want to listen to time broadcasts on your local subnet, de-comment the
# next lines.  Please do this only if you trust everybody on the network!
#disable auth
#broadcastclient

有什么更好的方法来实现这一点吗?

EN

回答 3

Server Fault用户

发布于 2013-10-07 12:48:42

如果您使用的是VMware工作站(或VMware vSphere),则有在您的(Linux)虚拟机上处理计时的具体方法。然而,这还不足以满足你的睡眠状况。客人里面的NTP在这里帮不上忙。

您绝对需要在客户虚拟机上安装VMware客户工具,并确保NTP在主机上运行。这将解决睡眠问题和当客人被暂停时发生的漂移。

编辑:

哦,是Ubuntu..。我发现很多Ubuntu用户没有安装本机VMware工具套件。以下是步骤 (和一个视频)来实现这一点。

票数 3
EN

Server Fault用户

发布于 2013-10-06 13:21:02

你的ntp.conf应该能工作!我发现,有时ntpd需要很长时间才能纠正很大的时间差。(我见过要花12个小时以上才能真正改正)。

您应该发现,如果您在一夜之间离开它(没有您的cron工作),那么它最终将纠正自己。

票数 1
EN

Server Fault用户

发布于 2013-10-07 14:30:55

使用iburst也有助于更快地设置时钟,但这仅在服务启动时才有效。

大多数应用程序可能希望使用服务器命令指定iburst选项。使用此选项,将交换大量信息,以整理数据,并在大约10秒内设置时钟。

您需要找到在APCI简历上重新启动服务的方法。(你可以试试这个。)

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

https://serverfault.com/questions/543540

复制
相关文章

相似问题

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