我正在设置一个NTP服务器(集群中的五台服务器之一)。我的配置文件:
restrict default kod nomodify notrap
driftfile /var/lib/ntp/drift
server tick.usno.navy.mil
server ntp.colby.edu
server tick.gatech.edu
#peer local-ntp.server.2
#peer local-ntp.server.3
#peer local-ntp.server.4
#peer local-ntp.server.5这些对等点被注释掉是因为:( a)它们尚未配置;( b)我不确定是否应该使用它们。
这样做的想法是,我所配置的每个NTP服务器都将同步到USNO源。如果我们的出站连接中断,它们就会为了网络上一致的时间而彼此同步。每个客户端将被配置为与所有五个本地NTP服务器一起作为server指令在其ntp.conf中。
最终,使用密钥身份验证将变得更加复杂,但现在我开始非常简单。我做得对吗?
发布于 2015-01-23 00:27:38
这样做的想法是,我所配置的每个NTP服务器都将同步到USNO源。
所以每个人都有一个server行给他们。这有点合理。
如果我们的出站连接中断,它们就会为了网络上一致的时间而彼此同步。
他们将尝试彼此同步,但这是行不通的。所有的时钟源都消失了,所以服务器最终将停止分配时间。只要停电时间不长,这可能就没问题了。
如果你想要一个互联网备份(你甚至不想放一个廉价的收音机/GPS时钟),那么你可以回到服务器上的本地时钟。最简单的方法是选择一个服务器并添加:
server 127.127.1.0
fudge 127.127.1.0 stratum 10如果所有其他时钟源消失,该服务器就会成为后盾,每个人都会跟随它。NTP不允许您设置一组机器并将它们同步在一起。相反,它正试图分发某种“实时”来源。CPU时钟通常不被认为是这样的,所以上面的行使它发生。
现在,如果你把同样的东西放在所有的服务器上,每个服务器都会认为它的本地时钟比邻居的好,它们不会一起漂移。
发布于 2015-01-22 04:04:46
这只是来自我自己的NTP服务器的一些例子,有很多不同的方法可以这样做,但这里是我的:
# Permit time synchronization with our time source, but do not
# permit the source to query or modify the service on this system.
restrict default kod nomodify notrap noquery
restrict -6 default kod nomodify notrap noquery
# Set nopeer when not configuring a peer node.
#restrict default kod nomodify notrap nopeer noquery
#restrict -6 default kod nomodify notrap nopeer noqueryrestrict 192.168.1.0 mask 255.255.255.0 nomodify notrap
restrict 127.0.0.1 #This is optional depending on your local machine's requirements服务器与对等
差异
server 0.pool.ntp.org iburst
server 1.pool.ntp.org iburst
peer myntp.server.bserver 2.pool.ntp.org iburst
server 3.pool.ntp.org iburst
peer myntp.server.a对于网络上将连接到ntp服务器的其他服务器,还可以使用prefer选项:
server 192.168.1.125 prefer # Prefer your own NTP server over others listed多服务器/对等ntp网络的一个例子。请注意,每个ntp都没有列出相同的servers。这是为了更好地使用对等同步。因此,对等同步可以匹配不同的时间结果。
1a 1b 1c 1d 1e 1f outside
. \ / ...... \ / ...... \ / ..............
2a ---p--- 2b ---p--- 2c inside
/|\ /|\ /|\
/ | \ / | \ / | \
3a 3b 3c 3e 3f 3g 3h 3i 3j
Key: 1 = stratum-1, 2 = stratum-2, 3 = stratum-3, p = peer
#Diagram + more info: http://www.ntp.org/ntpfaq/NTP-s-config-adv.htm更多信息:http://doc.ntp.org/4.1.1/confopt.htm
希望这能帮上忙。
https://unix.stackexchange.com/questions/180393
复制相似问题