How can I deny in my /etc/ntp/ntp.conf to sync with the NTP server with specific stratum level (e.g. more than 5 )?
I have a bad NTP server in my local network and sometimes is going really wrong after starting offline. I don't have internet and I cannot use public NTP servers for adjust time in my server.
This NTP server is not my server and I cannot rights to change config on it. In this case, NTP server cannot connect to other NTP servers online, so it is have not the exact time, and stratum level is changing from level 2 (then it is good) to level 9 (then it is bad).

Syncing time with bad NTP server with stratum 9:

root@ubuntuserver1604lts:~# ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
*       9 u   60   64  397    0.565  -53.519   2.984
 LOCAL(0)        .LOCL.          10 l   9h   64    0    0.000    0.000   0.000

I want to filter out temporarily NTP servers then stratum is "9" (or 4 or more) and syncronize time only then stratum is "4" or lower.


One thing which might work (I haven't tested it) is to use orphan mode. Add this to your /etc/ntp.conf:

tos orphan 6

Where 6 is the stratum at which you want orphan mode to take effect. If your source goes to a stratum greater than or equal to 6, your local server should start serving its own local clock's time instead of the upstream server.

Orphan mode is designed for scenarios where you have more than one local NTP server, but it might be useful in this case as well.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.