ntp.conf pool vs server directives

Solution 1:

The answer was given by mboehn. To clarify more: See the document he mentioned. Especially the last lines:

The pool scheme is configured using one or more pool commands with DNS names indicating the pool from which to draw. The pool command can be used more than once; duplicate servers are detected and discarded. In principle, it is possible to use a configuration file containing a single line pool pool.ntp.org. The NTP Pool Project offers instructions on using the pool with the server command, which is suboptimal but works with older versions of ntpd predating the pool command. With recent ntpd, consider replacing the multiple server commands in their example with a single pool command

My config is:

# 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

I now have multiple ntp servers close to my geographic location (The Netherlands) when I check

$ 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

Solution 2:

As far as I can see in the sources, ntpd handles both a member of a pool and individual servers roughly in the same way: it adds them to the list of peers.

All these peers are used by ntpd.

The magic of the pool mechanism is in round-robin DNS: as ntpd resolves the pool name through DNS, the response from the DNS query is a single node, which may be different every time resolution is asked.

Tags:

Ntp

Ntpd