ntp.conf池vs服务器指令

我遇到了一个指定池指令的ntp.conf文件:

# 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. pool 0.ubuntu.pool.ntp.org pool 1.ubuntu.pool.ntp.org pool 2.ubuntu.pool.ntp.org pool 3.ubuntu.pool.ntp.org 

然而,它也在同一个文件中有服务器指令,这是我更熟悉的。

阅读关于池,我看到它是用来代替服务器。 你应该使用一个或另一个。

但是,如果ntp.conf同时发生了什么呢? 一套优先于另一套,还是全部使用?

这是在Ubuntu 14.04上,ntpd是4.2.6p5版本。

就我所见,在源代码中, ntpd大体上以相同的方式处理池的成员和个人服务器:它将它们添加到对等列表中。

所有这些同行都被ntpd

池机制的神奇之处在于循环式DNS:由于ntpd通过DNSparsing池名,所以来自DNS查询的响应是单个节点,每次parsing时都会有所不同。

答案是mboehn。 澄清更多:看他提到的文件 。 特别是最后一行:

池scheme使用一个或多个带有DNS名称的池命令进行configuration,以指示要从中进行绘制的池。 pool命令可以多次使用; 检测并丢弃重复的服务器。 原则上,可以使用包含单个线路池pool.ntp.org的configuration文件。 NTP池项目提供了有关使用服务器命令的池的说明 ,这是次优的,但适用于早于版本的ntpd,在池命令之前。 在最近的ntpd中,考虑用一个池命令replace它们的例子中的多个服务器命令

我的configuration是:

 # Specify one or more NTP servers. pool 0.pool.ntp.org iburst pool 1.pool.ntp.org iburst pool 2.pool.ntp.org iburst pool 3.pool.ntp.org iburst # Provide your current local time as a default should you temporarly lose Internet connectivity server 127.127.1.0 fudge 127.127.1.0 stratum 10 

我现在有多个ntp服务器在我的地理位置附近(荷兰),当我检查

 $ ntpq -4np remote refid st t when poll reach delay offset jitter ============================================================================== 0.pool.ntp.org .POOL. 16 p - 64 0 0.000 0.000 0.000 1.pool.ntp.org .POOL. 16 p - 64 0 0.000 0.000 0.000 2.pool.ntp.org .POOL. 16 p - 64 0 0.000 0.000 0.000 3.pool.ntp.org .POOL. 16 p - 64 0 0.000 0.000 0.000 127.127.1.0 .LOCL. 10 l - 64 0 0.000 0.000 0.000 -85.255.214.66 193.190.230.66 2 u 5 64 177 6.937 1.588 1.645 -5.39.184.5 91.148.192.49 3 u 64 64 77 8.907 1.197 1.635 -91.198.87.229 193.79.237.14 2 u 5 64 177 8.447 -0.042 0.894 +37.34.57.151 193.79.237.14 2 u 1 64 177 7.463 0.168 0.297 *91.198.87.118 192.87.110.2 2 u 2 64 177 8.593 0.070 0.384 +88.159.1.197 80.94.65.10 2 u 2 64 177 10.497 0.454 0.213 +213.154.236.182 213.136.0.252 2 u 67 64 77 8.793 0.455 2.391 #178.21.23.127 91.121.157.10 3 u 66 64 77 9.129 -0.911 1.541 #213.109.127.195 193.79.237.14 2 u 66 64 77 11.766 -7.330 1.501 +213.154.229.24 80.50.231.226 2 u 4 64 177 8.496 0.121 0.538 -217.77.132.1 213.136.0.252 2 u 2 64 177 7.026 -0.782 1.253 #87.253.148.92 195.13.1.153 3 u 4 64 177 7.338 -3.859 0.964 -94.228.220.14 193.67.79.202 2 u - 64 177 8.347 2.797 1.019 

为了使NTP正确地请求一个时间服务器池,并且在任何故障切换​​场景中利用时间服务器的可用性, ntp.conf应该这样configuration:

  • 使用pool命令声明池的域名(而不是server

  • 允许池调动一个关联(即添加一个“ restrict source ”,不包括nopeer指令)