Here is our simple tip for your healthy server’s date and time:
Immediately synchronize the clock of your computer when using the openntpd (a lightweight version of ntpd with client-only mode).
Use the “-s” (lower “s” letter) to instruct the daemon ntpd to synchronize the clock immediately after it discovers a healthy time server!
-s Try to set the time immediately at startup, as opposed to slowly adjusting the clock. ntpd will stay in the foreground for up to 15 seconds waiting for one of the configured NTP servers to reply.
Find the start-up configuration file in your “/etc” (for your Linux distribution, its name is probably ntpd, for Gentoo it is “/etc/conf.d/ntpd”, the thing is to find the start-up confiuration script, not the ntpd.conf, which is the ntpd configuration file for the daemon) and include “-s” in the NTPD_OPTS:
cat /etc/conf.d/ntpd # /etc/conf.d/ntpd: config file for openntpd's ntpd NTPD_OPTS="-s"
Restart the service.
If you use it in a virtualized environment like containers (docker, lxc, lxd and so on) and qemu, virtualbox, vmware and so on and you often suspend the machine to synchronize the clock when you resume it you must manually restart the openntpd service!!! Or you are going to wait for slowly adjusting the time as usual.
Information status
There is a utility to check what’s going on with the openntpd – ntpctl. It has only three read-only commands:
usage: ntpctl -s all | peers | Sensors | status
Here is the output of “all” option (you should be root):
local ~ # ntpctl -s all 16/20 peers valid, clock synced, stratum 2 peer wt tl st next poll offset delay jitter 77.70.121.24 from pool 0.gentoo.pool.ntp.org 1 10 2 14s 32s -0.512ms 5.184ms 0.287ms 195.238.84.23 from pool 0.gentoo.pool.ntp.org 1 10 3 18s 30s 0.033ms 1.880ms 0.548ms 46.40.123.212 from pool 0.gentoo.pool.ntp.org 1 10 2 9s 32s -1.635ms 8.085ms 0.070ms 185.117.82.71 from pool 0.gentoo.pool.ntp.org 1 10 2 14s 30s 2.922ms 3.936ms 0.279ms 78.128.99.30 from pool 1.gentoo.pool.ntp.org 1 10 2 12s 34s 0.979ms 3.447ms 0.239ms 212.70.148.13 from pool 1.gentoo.pool.ntp.org 1 10 2 11s 33s -0.339ms 5.087ms 0.290ms 84.43.191.2 from pool 1.gentoo.pool.ntp.org 1 10 2 14s 31s 1.658ms 13.987ms 0.229ms 195.85.215.215 from pool 1.gentoo.pool.ntp.org 1 10 2 21s 34s -0.442ms 3.770ms 0.366ms 2a0b:f800:0:1::101 from pool 2.gentoo.pool.ntp.org 1 2 - 6s 15s ---- peer not valid ---- 2001:67c:20d0:c0::acad:123 from pool 2.gentoo.pool.ntp.org 1 2 - 6s 15s ---- peer not valid ---- 2a02:6800:0:99::2 from pool 2.gentoo.pool.ntp.org 1 2 - 6s 15s ---- peer not valid ---- 2001:67c:21bc:1e::1:123 from pool 2.gentoo.pool.ntp.org 1 2 - 6s 15s ---- peer not valid ---- 93.123.39.67 from pool 2.gentoo.pool.ntp.org 1 10 1 11s 31s 0.169ms 4.216ms 0.156ms 195.85.215.8 from pool 2.gentoo.pool.ntp.org * 1 10 1 0s 32s -0.456ms 3.898ms 0.256ms 212.70.148.11 from pool 2.gentoo.pool.ntp.org 1 10 3 3s 33s 1.667ms 3.976ms 0.246ms 185.117.82.70 from pool 2.gentoo.pool.ntp.org 1 10 2 16s 30s 5.331ms 3.789ms 0.225ms 87.97.157.120 from pool 3.gentoo.pool.ntp.org 1 10 3 4s 34s -2.058ms 14.554ms 0.374ms 185.117.82.66 from pool 3.gentoo.pool.ntp.org 1 10 2 3s 32s -1.497ms 3.726ms 0.233ms 85.11.185.61 from pool 3.gentoo.pool.ntp.org 1 10 3 0s 34s -5.923ms 4.309ms 0.905ms 84.54.128.102 from pool 3.gentoo.pool.ntp.org 1 10 2 2s 33s -2.942ms 11.703ms 0.345ms