1.\" $OpenBSD: ntpd.8,v 1.49 2023/03/02 17:09:53 jmc Exp $ 2.\" 3.\" Copyright (c) 2003, 2004, 2006 Henning Brauer <henning@openbsd.org> 4.\" 5.\" Permission to use, copy, modify, and distribute this software for any 6.\" purpose with or without fee is hereby granted, provided that the above 7.\" copyright notice and this permission notice appear in all copies. 8.\" 9.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13.\" WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER IN 14.\" AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT 15.\" OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16.\" 17.Dd $Mdocdate: March 2 2023 $ 18.Dt NTPD 8 19.Os 20.Sh NAME 21.Nm ntpd 22.Nd Network Time Protocol (NTP) daemon 23.Sh SYNOPSIS 24.Nm ntpd 25.Bk -words 26.Op Fl dnv 27.Op Fl f Ar file 28.Ek 29.Sh DESCRIPTION 30The 31.Nm 32daemon synchronizes the local clock to one or more remote NTP servers 33or local timedelta sensors. 34.Nm 35can also act as an NTP server itself, 36redistributing the local time. 37It implements the Simple Network Time Protocol version 4, 38as described in RFC 5905, 39and the Network Time Protocol version 3, 40as described in RFC 1305. 41Time can also be fetched from TLS HTTPS servers to reduce the 42impact of unauthenticated NTP 43man-in-the-middle attacks. 44.Pp 45The options are as follows: 46.Bl -tag -width "-f fileXXX" 47.It Fl d 48Do not daemonize. 49If this option is specified, 50.Nm 51will run in the foreground and log to 52.Em stderr . 53.It Fl f Ar file 54Use 55.Ar file 56as the configuration file, 57instead of the default 58.Pa /etc/ntpd.conf . 59.It Fl n 60Configtest mode. 61Only check the configuration file for validity. 62.It Fl v 63This option allows 64.Nm 65to send DEBUG priority messages to syslog. 66.El 67.Pp 68.Nm 69uses the 70.Xr adjtime 2 71system call to correct the local system time without causing time jumps. 72Adjustments of 32ms and greater are logged using 73.Xr syslog 3 . 74The threshold value is chosen to avoid having local clock drift 75thrash the log files. 76Should 77.Nm 78be started with the 79.Fl d 80or 81.Fl v 82option, all calls to 83.Xr adjtime 2 84will be logged. 85.Pp 86At boot, 87.Nm 88will stay for a maximum of 15 seconds in the foreground and make efforts to 89verify and correct the time if constraints are configured and 90satisfied or if trusted servers or sensors return results, 91and if the clock is not being moved backwards. 92.Pp 93After the local clock is synchronized, 94.Nm 95adjusts the clock frequency using the 96.Xr adjfreq 2 97system call to compensate for systematic drift. 98.Pp 99.Nm 100is started at boot time by default via 101.Va ntpd_flags 102in 103.Pa /etc/rc.conf . 104See 105.Xr rc 8 106and 107.Xr rc.conf 8 108for more information on the boot process 109and enabling daemons. 110.Pp 111When 112.Nm 113starts up, it reads settings from its configuration file, 114typically 115.Xr ntpd.conf 5 , 116and its initial clock drift from 117.Pa /var/db/ntpd.drift . 118Clock drift is periodically written to the drift file thereafter. 119.Sh FILES 120.Bl -tag -width "/var/db/ntpd.driftXXX" -compact 121.It Pa /etc/ntpd.conf 122Default configuration file. 123.It Pa /var/db/ntpd.drift 124Drift file. 125.It Pa /var/run/ntpd.sock 126Socket file for communication with 127.Xr ntpctl 8 . 128.El 129.Sh SEE ALSO 130.Xr date 1 , 131.Xr adjfreq 2 , 132.Xr adjtime 2 , 133.Xr ntpd.conf 5 , 134.Xr ntpctl 8 , 135.Xr rc 8 , 136.Xr rc.conf 8 , 137.Xr rdate 8 138.Sh STANDARDS 139.Rs 140.%A David L. Mills 141.%D March 1992 142.%R RFC 1305 143.%T Network Time Protocol (Version 3): Specification, Implementation and Analysis 144.Re 145.Pp 146.Rs 147.%A David L. Mills 148.%A Jim Martin 149.%A Jack Burbank 150.%A William Kasch 151.%D June 2010 152.%R RFC 5905 153.%T Network Time Protocol Version 4: Protocol and Algorithms Specification 154.Re 155.Sh HISTORY 156The 157.Nm 158program first appeared in 159.Ox 3.6 . 160