NTPD(8)

πŸ“¦
version 7.9p1 Β· 2 versions
, in ubuntu stonking

✨ NTPD(8) β€” the Network Time Protocol daemon, bestie edition ✨

okay so real quick, before we even get into it: this is the ntpd page from the System Manager's Manual (section 8, system admin stuff, iykyk). buckle up πŸŽ€


🌸 NAME 🌸

ntpd β€” the Network Time Protocol (NTP) daemon. she keeps your clock correct. she's the moment. πŸ’…


πŸ¦‹ SYNOPSIS πŸ¦‹

ntpd [-dnv] [-f file] [-p file]

that's it, that's the whole vibe. three flags can squish together, two of them take a file argument. cute. ✨


πŸ’– DESCRIPTION πŸ’–

so the ntpd daemon does one job and does it iconically: it synchronizes your local clock to one or more remote NTP servers, or to local timedelta sensors. and bestie, that's not even the whole thing β€” ntpd can also be an NTP server herself, redistributing the local time to whoever asks. main character energy fr fr. πŸ‘‘

what does she speak? two dialects:

  • the Simple Network Time Protocol version 4, exactly as described in RFC 5905
  • the Network Time Protocol version 3, exactly as described in RFC 1305

and like, plot twist β€” time can also be fetched from TLS HTTPS servers, which is a whole thing that reduces the impact of unauthenticated NTP man-in-the-middle attacks. no cap, MITM attacks on plain NTP are real and messy. πŸ™ˆ

The options are as follows:

  • -d β€” Do not daemonize. If this option is specified, ntpd will run in the foreground and log to stderr. (foreground mode, she's just standing right there. hi.)
  • -f file β€” Use file as the configuration file, instead of the default /etc/openntpd/ntpd.conf.
  • -n β€” Configtest mode. Only check the configuration file for validity. she's not gonna run, she's just gonna ✨check✨.
  • -v β€” This option allows ntpd to send DEBUG priority messages to syslog.
  • -p file β€” Write pid to file

so here's the mechanics, and this part is genuinely so cool. ntpd uses the adjtime(2) system call to correct the local system time without causing time jumps. no scary clock teleports. 🧚

adjustments of 32ms and greater are logged using syslog(3). and the reason for that threshold value? it's chosen to avoid having local clock drift thrash the log files. like yeah bestie, nobody wants a log file that's just clock drift screaming at 3am. πŸ’€

should ntpd be started with the -d or -v option, all calls to adjtime(2) will be logged. every single one. she's being transparent with you.

At boot, ntpd will stay for a maximum of 15 seconds in the foreground and make efforts to verify and correct the time if constraints are configured and satisfied, or if trusted servers or sensors return results, and if the clock is not being moved backwards. (lots of conditions there β€” respect the conditions, they're load-bearing. 🫢)

After the local clock is synchronized, ntpd adjusts the clock frequency using the adjfreq(2) system call to compensate for systematic drift. frequency, not just offset. she's doing both. she's doing the most, and honestly? it's necessary. πŸ”₯

ntpd is started at boot time by default via ntpd_flags in /etc/rc.conf. See rc(8) and rc.conf(8) for more information on the boot process and enabling daemons.

When ntpd starts up, it reads settings from its configuration file, typically ntpd.conf(5), and its initial clock drift from /var/lib/openntpd/ntpd.drift. Clock drift is periodically written to the drift file thereafter. so like, she remembers. she always remembers. 🌈


πŸŽ€ FILES πŸŽ€

  • /etc/openntpd/ntpd.conf β€” Default configuration file.
  • /var/lib/openntpd/ntpd.drift β€” Drift file.
  • /run/openntpd/ntpd.sock β€” Socket file for communication with ntpctl(8).

⭐ SEE ALSO ⭐

date(1), adjfreq(2), adjtime(2), ntpd.conf(5), ntpctl(8), rc(8), rc.conf(8), rdate(8)

go read those too. that's the syllabus. πŸ“š


🌈 STANDARDS 🌈

  • David L. Mills, Network Time Protocol (Version 3): Specification, Implementation and Analysis, RFC 1305, March 1992.
  • David L. Mills, Jim Martin, Jack Burbank, and William Kasch, Network Time Protocol Version 4: Protocol and Algorithms Specification, RFC 5905, June 2010.

πŸ‘‘ HISTORY πŸ‘‘

The ntpd program first appeared in OpenBSD 3.6. an icon, a legend, and she is the moment. periodt.


and that's the page bestie πŸ’œ this one shipped in the Debian build on March 2, 2023, filed under NTPD(8). go sync something. πŸ•βœ¨

πŸ“¦ where this page comes from