Ntpd
Christian Külker
version 0.1.1
2022-06-11
Network Time Protocol information and usage
Table Of Contents

The time of a system can be adjusted by various commands. The network time protocol daemon (ntpd) helps in managing the time and in helping to keep the time up to date.

What Is A Stratum?

Time servers are divided into classes. The highest class is 0 and is called stratum 0. A stratum is a bed or layer artificially made. Stratum 0 time servers are usually time servers that have atomic clocks, GPS clocks or radio clocks. The next level is the stratum 1 time servers that take their time from the stratum 0 server. This goes down to stratum 16. This time servers do not propagate the time, but set the local clock.

What Is The Best Practice regarding NTP?

How To Set The Time via Ntpd Manually?

When changing the real time clock battery, or for some other reasons (if the system has no buffered clock for example), the on board time differs much from the real time. Usually ntpd refused to set this. However it possible to force ntpd to set from the network.

The old and short way is:

/etc/init.d/ntp stop
ntpd -gq
/etc/init.d/ntp start

The option -g is the same as --panicgate and allow a to set a time which is much different than the current time. While -q (or --quit) sets the time once and quit. The “modern” way is:

systemctl stop ntp
ntpd --panicgate --quit
systemctl start ntp

If you do not have a network access use date -s 'FORMAT' to set the time. FORMAT can be for example 2021-06-03T14:22:12.

History

Version Date Notes
0.1.0 2022-06-11 Shell->bash, +history
0.1.0 2021-06-03 Initial release