我们使用centos.pool.ntp.org实现服务器之间的时钟同步。现在我们做了一个本地ntp服务器,但问题是服务器正在使用旧的NTP。从centos.pool.ntp.org我们可以看到,
*202.71.136.67 211.39.136.4 3 u 29 64 377 43.005 233594. 18.806
+120.88.47.10 193.79.237.14 2 u 9 64 377 49.654 233581. 16.692
2401:db00:100:1 .STEP. 16 - - 512 0 0.000 0.000 0.000
192.168.100.20 192.168.100.20 15 u 36 64 377 0.799 -6.803 3.360如何刷新外部NTP服务并指示我的机器与本地ntp服务器联系?
发布于 2014-01-13 05:18:22
我为在另一个答复上发表这么多评论而道歉。有很多有问题的设置,你没有问过,即使你问了,我也会警惕其中的一些建议。
简单的解决办法是编辑客户端上的ntp.conf文件,并更改看起来类似的行(我面前没有一个centos示例,对不起,我不能说得更具体):
server centos.pool.ntp.org ...或
pool centos.pool.ntp.org...把这个设置为
server ntp.example.org iburst在一个完美的世界中,您应该在ntp.conf中列出3个或更多的时间服务器,需要注意的是,如果您的本地时间服务器崩溃,您的客户端将没有任何上游时间源。另一个答案试图解决失去本地时间服务器的问题与孤儿的疯狂,但我认为你应该避免目前。如果你想做孤儿的设置,你需要做更多的阅读。
如果希望让所有本地客户端使用本地服务器,然后返回到ntp.org服务器,以防其崩溃或开始疯狂,请使用以下内容之一。第一个是4.2.6p5和更早版本。第二个版本是4.2.7和任何未来的版本,除非进行更改。
# for 4.2.6p5 and earlier (server directive acts differently depending on ver)
# This is the easiest way to deal with all versions
#prefer our local if its up and not a falseticker
server ntp.example.org iburst prefer
# fallback to these if things are bad with ntp.e.o
server 0.YOUR-COUNTRY-CODE.pool.ntp.org iburst
server 1.YOUR-COUNTRY-CODE.pool.ntp.org iburst
server 2.YOUR-COUNTRY-CODE.pool.ntp.org iburst
server 3.YOUR-COUNTRY-CODE.pool.ntp.org iburst备选案文2:
# this is the future
#prefer our local if its up and not a falseticker
server ntp.example.org iburst prefer
# fallback to pool.n.o if things are bad with ntp.e.o
pool YOUR-COUNTRY-CODE.pool.ntp.org iburst注意我把centos.pool改成了你的国家代码池。如果你在美国使用us.pool.ntp.org。这将意味着您不会像使用供应商池指令那样从另一个大陆/国家获得服务器。
您还可以考虑将ntp服务器地址作为dhcp响应的一部分。我不确定centos是否支持这一点,但有些发行版/系统将遵循dhcp中的ntp-server选项。
https://serverfault.com/questions/514018
复制相似问题