1310419Sdelphij.Dd November 21 2016
2290001Sglebius.Dt NTPD 8 User Commands
3290001Sglebius.Os
4290001Sglebius.\"  EDIT THIS FILE WITH CAUTION  (ntpd-opts.mdoc)
555857Ssheldonh.\"
655857Ssheldonh.\" $FreeBSD: releng/9.3/usr.sbin/ntp/doc/ntpd.8 310419 2016-12-22 16:19:05Z delphij $
755857Ssheldonh.\"
8310419Sdelphij.\"  It has been AutoGen-ed  November 21, 2016 at 08:02:08 AM by AutoGen 5.18.5
9290001Sglebius.\"  From the definitions    ntpd-opts.def
10290001Sglebius.\"  and the template file   agmdoc-cmd.tpl
1155857Ssheldonh.Sh NAME
1255857Ssheldonh.Nm ntpd
13290001Sglebius.Nd NTP daemon program
1455857Ssheldonh.Sh SYNOPSIS
1568965Sru.Nm
16290001Sglebius.\" Mixture of short (flag) options and long options
17290001Sglebius.Op Fl flags
18290001Sglebius.Op Fl flag Op Ar value
19290001Sglebius.Op Fl \-option\-name Ns Oo Oo Ns "=| " Oc Ns Ar value Oc
20290001Sglebius[ <server1> ... <serverN> ]
21290001Sglebius.Pp
2255857Ssheldonh.Sh DESCRIPTION
2382501SsheldonhThe
2455857Ssheldonh.Nm
2599968Scharnierutility is an operating system daemon which sets
2682501Ssheldonhand maintains the system time of day in synchronism with Internet
2782501Ssheldonhstandard time servers.
2882501SsheldonhIt is a complete implementation of the
29290001SglebiusNetwork Time Protocol (NTP) version 4, as defined by RFC\-5905,
30290001Sglebiusbut also retains compatibility with
31290001Sglebiusversion 3, as defined by RFC\-1305, and versions 1
32290001Sglebiusand 2, as defined by RFC\-1059 and RFC\-1119, respectively.
3382501Ssheldonh.Pp
3499968ScharnierThe
3555857Ssheldonh.Nm
36290001Sglebiusutility does most computations in 64\-bit floating point
37290001Sglebiusarithmetic and does relatively clumsy 64\-bit fixed point operations
3882501Ssheldonhonly when necessary to preserve the ultimate precision, about 232
3982501Ssheldonhpicoseconds.
40168248SchinsanWhile the ultimate precision is not achievable with
4182501Ssheldonhordinary workstations and networks of today, it may be required
4282501Ssheldonhwith future gigahertz CPU clocks and gigabit LANs.
4355857Ssheldonh.Pp
4455857SsheldonhOrdinarily,
4555857Ssheldonh.Nm
4655857Ssheldonhreads the
4755895Ssheldonh.Xr ntp.conf 5
4882501Ssheldonhconfiguration file at startup time in order to determine the
4982501Ssheldonhsynchronization sources and operating modes.
5082501SsheldonhIt is also possible to
5182501Ssheldonhspecify a working, although limited, configuration entirely on the
5282501Ssheldonhcommand line, obviating the need for a configuration file.
5382501SsheldonhThis may
5482501Ssheldonhbe particularly useful when the local host is to be configured as a
5582501Ssheldonhbroadcast/multicast client, with all peers being determined by
5682501Ssheldonhlistening to broadcasts at run time.
5755857Ssheldonh.Pp
5855857SsheldonhIf NetInfo support is built into
5968965Sru.Nm ,
6055857Ssheldonhthen
6155857Ssheldonh.Nm
6282501Ssheldonhwill attempt to read its configuration from the
6382501SsheldonhNetInfo if the default
6482501Ssheldonh.Xr ntp.conf 5
6582501Ssheldonhfile cannot be read and no file is
6682501Ssheldonhspecified by the
6755857Ssheldonh.Fl c
6855857Ssheldonhoption.
6955857Ssheldonh.Pp
7082501SsheldonhVarious internal
7155857Ssheldonh.Nm
7282501Ssheldonhvariables can be displayed and
7382501Ssheldonhconfiguration options altered while the
7482501Ssheldonh.Nm
7582501Ssheldonhis running
7682501Ssheldonhusing the
7755857Ssheldonh.Xr ntpq 8
7855857Ssheldonhand
7955857Ssheldonh.Xr ntpdc 8
8082501Ssheldonhutility programs.
8155857Ssheldonh.Pp
8255857SsheldonhWhen
8355857Ssheldonh.Nm
8455857Ssheldonhstarts it looks at the value of
85290001Sglebius.Xr umask 2 ,
8682501Ssheldonhand if zero
8782501Ssheldonh.Nm
8882501Ssheldonhwill set the
89290001Sglebius.Xr umask 2
9082501Ssheldonhto 022.
91290001Sglebius.Sh "OPTIONS"
92290001Sglebius.Bl -tag
93290001Sglebius.It  Fl 4 , Fl \-ipv4 
94290001SglebiusForce IPv4 DNS name resolution.
95290001SglebiusThis option must not appear in combination with any of the following options:
96290001Sglebiusipv6.
97290001Sglebius.sp
98290001SglebiusForce DNS resolution of following host names on the command line
99290001Sglebiusto the IPv4 namespace.
100290001Sglebius.It  Fl 6 , Fl \-ipv6 
101290001SglebiusForce IPv6 DNS name resolution.
102290001SglebiusThis option must not appear in combination with any of the following options:
103290001Sglebiusipv4.
104290001Sglebius.sp
105290001SglebiusForce DNS resolution of following host names on the command line
106290001Sglebiusto the IPv6 namespace.
107290001Sglebius.It  Fl a , Fl \-authreq 
108290001SglebiusRequire crypto authentication.
109290001SglebiusThis option must not appear in combination with any of the following options:
110290001Sglebiusauthnoreq.
111290001Sglebius.sp
112158688SpavRequire cryptographic authentication for broadcast client,
113158688Spavmulticast client and symmetric passive associations.
114158688SpavThis is the default.
115290001Sglebius.It  Fl A , Fl \-authnoreq 
116290001SglebiusDo not require crypto authentication.
117290001SglebiusThis option must not appear in combination with any of the following options:
118290001Sglebiusauthreq.
119290001Sglebius.sp
120158688SpavDo not require cryptographic authentication for broadcast client,
121158688Spavmulticast client and symmetric passive associations.
122158688SpavThis is almost never a good idea.
123290001Sglebius.It  Fl b , Fl \-bcastsync 
124290001SglebiusAllow us to sync to broadcast servers.
125290001Sglebius.sp
126290001Sglebius.It  Fl c Ar string , Fl \-configfile Ns = Ns Ar string 
127290001Sglebiusconfiguration file name.
128290001Sglebius.sp
129290001SglebiusThe name and path of the configuration file,
130290001Sglebius\fI/etc/ntp.conf\fP
131290001Sglebiusby default.
132290001Sglebius.It  Fl d , Fl \-debug\-level 
133290001SglebiusIncrease debug verbosity level.
134290001SglebiusThis option may appear an unlimited number of times.
135290001Sglebius.sp
136290001Sglebius.It  Fl D Ar number , Fl \-set\-debug\-level Ns = Ns Ar number 
137290001SglebiusSet the debug verbosity level.
138290001SglebiusThis option may appear an unlimited number of times.
139290001SglebiusThis option takes an integer number as its argument.
140290001Sglebius.sp
141290001Sglebius.It  Fl f Ar string , Fl \-driftfile Ns = Ns Ar string 
142290001Sglebiusfrequency drift file name.
143290001Sglebius.sp
144290001SglebiusThe name and path of the frequency file,
145290001Sglebius\fI/etc/ntp.drift\fP
146290001Sglebiusby default.
147158688SpavThis is the same operation as the
148290001Sglebius\fBdriftfile\fP \fIdriftfile\fP
149290001Sglebiusconfiguration specification in the
150290001Sglebius\fI/etc/ntp.conf\fP
151290001Sglebiusfile.
152290001Sglebius.It  Fl g , Fl \-panicgate 
153290001SglebiusAllow the first adjustment to be Big.
154290001SglebiusThis option may appear an unlimited number of times.
155290001Sglebius.sp
15682501SsheldonhNormally,
157290001Sglebius\fBntpd\fP
158290001Sglebiusexits with a message to the system log if the offset exceeds the panic threshold, which is 1000 s by default. This option allows the time to be set to any value without restriction; however, this can happen only once. If the threshold is exceeded after that,
159290001Sglebius\fBntpd\fP
160290001Sglebiuswill exit with a message to the system log. This option can be used with the
161290001Sglebius\fB\-q\fP
162158688Spavand
163290001Sglebius\fB\-x\fP
164162806Sruoptions.
165162806SruSee the
166290001Sglebius\fBtinker\fP
167290001Sglebiusconfiguration file directive for other options.
168290001Sglebius.It  Fl G , Fl \-force\-step\-once 
169290001SglebiusStep any initial offset correction..
170290001Sglebius.sp
171290001SglebiusNormally,
172290001Sglebius\fBntpd\fP
173290001Sglebiussteps the time if the time offset exceeds the step threshold,
174290001Sglebiuswhich is 128 ms by default, and otherwise slews the time.
175290001SglebiusThis option forces the initial offset correction to be stepped,
176290001Sglebiusso the highest time accuracy can be achieved quickly.
177290001SglebiusHowever, this may also cause the time to be stepped back
178290001Sglebiusso this option must not be used if
179290001Sglebiusapplications requiring monotonic time are running.
180290001SglebiusSee the \fBtinker\fP configuration file directive for other options.
181290001Sglebius.It  Fl i Ar string , Fl \-jaildir Ns = Ns Ar string 
182290001SglebiusJail directory.
183290001Sglebius.sp
184290001SglebiusChroot the server to the directory
185290001Sglebius\fIjaildir\fP
186290001Sglebius.
187290001SglebiusThis option also implies that the server attempts to drop root privileges at startup.
188290001SglebiusYou may need to also specify a
189290001Sglebius\fB\-u\fP
190290001Sglebiusoption.
191290001SglebiusThis option is only available if the OS supports adjusting the clock
192290001Sglebiuswithout full root privileges.
193290001SglebiusThis option is supported under NetBSD (configure with
194290001Sglebius\fB\-\-enable\-clockctl\fP) or Linux (configure with
195290001Sglebius\fB\-\-enable\-linuxcaps\fP) or Solaris (configure with \fB\-\-enable\-solarisprivs\fP).
196290001Sglebius.It  Fl I Ar iface , Fl \-interface Ns = Ns Ar iface 
197290001SglebiusListen on an interface name or address.
198290001SglebiusThis option may appear an unlimited number of times.
199290001Sglebius.sp
200290001SglebiusOpen the network address given, or all the addresses associated with the
201290001Sglebiusgiven interface name.  This option may appear multiple times.  This option
202290001Sglebiusalso implies not opening other addresses, except wildcard and localhost.
203290001SglebiusThis option is deprecated. Please consider using the configuration file
204290001Sglebius\fBinterface\fP command, which is more versatile.
205290001Sglebius.It  Fl k Ar string , Fl \-keyfile Ns = Ns Ar string 
206290001Sglebiuspath to symmetric keys.
207290001Sglebius.sp
208290001SglebiusSpecify the name and path of the symmetric key file.
209290001Sglebius\fI/etc/ntp.keys\fP
210290001Sglebiusis the default.
211158688SpavThis is the same operation as the
212290001Sglebius\fBkeys\fP \fIkeyfile\fP
213290001Sglebiusconfiguration file directive.
214290001Sglebius.It  Fl l Ar string , Fl \-logfile Ns = Ns Ar string 
215290001Sglebiuspath to the log file.
216290001Sglebius.sp
21755857SsheldonhSpecify the name and path of the log file.
218158688SpavThe default is the system log file.
219158688SpavThis is the same operation as the
220290001Sglebius\fBlogfile\fP \fIlogfile\fP
221290001Sglebiusconfiguration file directive.
222290001Sglebius.It  Fl L , Fl \-novirtualips 
223290001SglebiusDo not listen to virtual interfaces.
224290001Sglebius.sp
225290001SglebiusDo not listen to virtual interfaces, defined as those with
226290001Sglebiusnames containing a colon.  This option is deprecated.  Please
227290001Sglebiusconsider using the configuration file \fBinterface\fP command, which
228290001Sglebiusis more versatile.
229290001Sglebius.It  Fl M , Fl \-modifymmtimer 
230290001SglebiusModify Multimedia Timer (Windows only).
231290001Sglebius.sp
232290001SglebiusSet the Windows Multimedia Timer to highest resolution.  This
233290001Sglebiusensures the resolution does not change while ntpd is running,
234290001Sglebiusavoiding timekeeping glitches associated with changes.
235290001Sglebius.It  Fl n , Fl \-nofork 
236141846SruDo not fork.
237290001SglebiusThis option must not appear in combination with any of the following options:
238290001Sglebiuswait\-sync.
239290001Sglebius.sp
240290001Sglebius.It  Fl N , Fl \-nice 
241290001SglebiusRun at high priority.
242290001Sglebius.sp
243290001SglebiusTo the extent permitted by the operating system, run
244290001Sglebius\fBntpd\fP
245158688Spavat the highest priority.
246290001Sglebius.It  Fl p Ar string , Fl \-pidfile Ns = Ns Ar string 
247290001Sglebiuspath to the PID file.
248290001Sglebius.sp
249290001SglebiusSpecify the name and path of the file used to record
250290001Sglebius\fBntpd\fP's
251158688Spavprocess ID.
252158688SpavThis is the same operation as the
253290001Sglebius\fBpidfile\fP \fIpidfile\fP
254290001Sglebiusconfiguration file directive.
255290001Sglebius.It  Fl P Ar number , Fl \-priority Ns = Ns Ar number 
256290001SglebiusProcess priority.
257290001SglebiusThis option takes an integer number as its argument.
258290001Sglebius.sp
259290001SglebiusTo the extent permitted by the operating system, run
260290001Sglebius\fBntpd\fP
261290001Sglebiusat the specified
262290001Sglebius\fBsched_setscheduler(SCHED_FIFO)\fP
263290001Sglebiuspriority.
264290001Sglebius.It  Fl q , Fl \-quit 
265290001SglebiusSet the time and quit.
266290001SglebiusThis option must not appear in combination with any of the following options:
267290001Sglebiussaveconfigquit, wait\-sync.
268290001Sglebius.sp
269290001Sglebius\fBntpd\fP
270290001Sglebiuswill not daemonize and will exit after the clock is first
271290001Sglebiussynchronized.  This behavior mimics that of the
272290001Sglebius\fBntpdate\fP
273290001Sglebiusprogram, which will soon be replaced with a shell script.
27482501SsheldonhThe
275290001Sglebius\fB\-g\fP
27682501Ssheldonhand
277290001Sglebius\fB\-x\fP
278290001Sglebiusoptions can be used with this option.
279158688SpavNote: The kernel time discipline is disabled with this option.
280290001Sglebius.It  Fl r Ar string , Fl \-propagationdelay Ns = Ns Ar string 
281290001SglebiusBroadcast/propagation delay.
282290001Sglebius.sp
283290001SglebiusSpecify the default propagation delay from the broadcast/multicast server to this client. This is necessary only if the delay cannot be computed automatically by the protocol.
284290001Sglebius.It  Fl \-saveconfigquit  Ns = Ns Ar string 
285290001SglebiusSave parsed configuration and quit.
286290001SglebiusThis option must not appear in combination with any of the following options:
287290001Sglebiusquit, wait\-sync.
288290001Sglebius.sp
289290001SglebiusCause \fBntpd\fP to parse its startup configuration file and save an
290290001Sglebiusequivalent to the given filename and exit.  This option was
291290001Sglebiusdesigned for automated testing.
292290001Sglebius.It  Fl s Ar string , Fl \-statsdir Ns = Ns Ar string 
293290001SglebiusStatistics file location.
294290001Sglebius.sp
295290001SglebiusSpecify the directory path for files created by the statistics facility.
296158688SpavThis is the same operation as the
297290001Sglebius\fBstatsdir\fP \fIstatsdir\fP
298290001Sglebiusconfiguration file directive.
299290001Sglebius.It  Fl t Ar tkey , Fl \-trustedkey Ns = Ns Ar tkey 
300290001SglebiusTrusted key number.
301290001SglebiusThis option may appear an unlimited number of times.
302290001Sglebius.sp
303290001SglebiusAdd the specified key number to the trusted key list.
304290001Sglebius.It  Fl u Ar string , Fl \-user Ns = Ns Ar string 
305290001SglebiusRun as userid (or userid:groupid).
306290001Sglebius.sp
307290001SglebiusSpecify a user, and optionally a group, to switch to.
308290001SglebiusThis option is only available if the OS supports adjusting the clock
309290001Sglebiuswithout full root privileges.
310290001SglebiusThis option is supported under NetBSD (configure with
311290001Sglebius\fB\-\-enable\-clockctl\fP) or Linux (configure with
312290001Sglebius\fB\-\-enable\-linuxcaps\fP) or Solaris (configure with \fB\-\-enable\-solarisprivs\fP).
313290001Sglebius.It  Fl U Ar number , Fl \-updateinterval Ns = Ns Ar number 
314290001Sglebiusinterval in seconds between scans for new or dropped interfaces.
315290001SglebiusThis option takes an integer number as its argument.
316290001Sglebius.sp
317290001SglebiusGive the time in seconds between two scans for new or dropped interfaces.
318290001SglebiusFor systems with routing socket support the scans will be performed shortly after the interface change
319290001Sglebiushas been detected by the system.
320290001SglebiusUse 0 to disable scanning. 60 seconds is the minimum time between scans.
321290001Sglebius.It  Fl \-var  Ns = Ns Ar nvar 
322290001Sglebiusmake ARG an ntp variable (RW).
323290001SglebiusThis option may appear an unlimited number of times.
324290001Sglebius.sp
325290001Sglebius.It  Fl \-dvar  Ns = Ns Ar ndvar 
326290001Sglebiusmake ARG an ntp variable (RW|DEF).
327290001SglebiusThis option may appear an unlimited number of times.
328290001Sglebius.sp
329290001Sglebius.It  Fl w Ar number , Fl \-wait\-sync Ns = Ns Ar number 
330290001SglebiusSeconds to wait for first clock sync.
331290001SglebiusThis option must not appear in combination with any of the following options:
332290001Sglebiusnofork, quit, saveconfigquit.
333290001SglebiusThis option takes an integer number as its argument.
334290001Sglebius.sp
335290001SglebiusIf greater than zero, alters \fBntpd\fP's behavior when forking to
336290001Sglebiusdaemonize.  Instead of exiting with status 0 immediately after
337290001Sglebiusthe fork, the parent waits up to the specified number of
338290001Sglebiusseconds for the child to first synchronize the clock.  The exit
339290001Sglebiusstatus is zero (success) if the clock was synchronized,
340290001Sglebiusotherwise it is \fBETIMEDOUT\fP.
341290001SglebiusThis provides the option for a script starting \fBntpd\fP to easily
342290001Sglebiuswait for the first set of the clock before proceeding.
343290001Sglebius.It  Fl x , Fl \-slew 
344290001SglebiusSlew up to 600 seconds.
345290001Sglebius.sp
346290001SglebiusNormally, the time is slewed if the offset is less than the step threshold, which is 128 ms by default, and stepped if above the threshold.
347290001SglebiusThis option sets the threshold to 600 s, which is well within the accuracy window to set the clock manually.
348290001SglebiusNote: Since the slew rate of typical Unix kernels is limited to 0.5 ms/s, each second of adjustment requires an amortization interval of 2000 s.
349158688SpavThus, an adjustment as much as 600 s will take almost 14 days to complete.
35082501SsheldonhThis option can be used with the
351290001Sglebius\fB\-g\fP
352158688Spavand
353290001Sglebius\fB\-q\fP
354158688Spavoptions.
355158688SpavSee the
356290001Sglebius\fBtinker\fP
357290001Sglebiusconfiguration file directive for other options.
358158688SpavNote: The kernel time discipline is disabled with this option.
359290001Sglebius.It  Fl \-usepcc 
360290001SglebiusUse CPU cycle counter (Windows only).
361290001Sglebius.sp
362290001SglebiusAttempt to substitute the CPU counter for \fBQueryPerformanceCounter\fP.
363290001SglebiusThe CPU counter and \fBQueryPerformanceCounter\fP are compared, and if
364290001Sglebiusthey have the same frequency, the CPU counter (RDTSC on x86) is
365290001Sglebiusused directly, saving the overhead of a system call.
366290001Sglebius.It  Fl \-pccfreq  Ns = Ns Ar string 
367290001SglebiusForce CPU cycle counter use (Windows only).
368290001Sglebius.sp
369290001SglebiusForce substitution the CPU counter for \fBQueryPerformanceCounter\fP.
370290001SglebiusThe CPU counter (RDTSC on x86) is used unconditionally with the
371290001Sglebiusgiven frequency (in Hz).
372290001Sglebius.It  Fl m , Fl \-mdns 
373290001SglebiusRegister with mDNS as a NTP server.
374290001Sglebius.sp
375290001SglebiusRegisters as an NTP server with the local mDNS server which allows
376290001Sglebiusthe server to be discovered via mDNS client lookup.
377290001Sglebius.It Fl \&? , Fl \-help
378290001SglebiusDisplay usage information and exit.
379290001Sglebius.It Fl \&! , Fl \-more\-help
380290001SglebiusPass the extended usage information through a pager.
381290001Sglebius.It Fl \-version Op Brq Ar v|c|n
382290001SglebiusOutput version of program and exit.  The default mode is `v', a simple
383290001Sglebiusversion.  The `c' mode will print copyright information and `n' will
384290001Sglebiusprint the full copyright notice.
38555857Ssheldonh.El
386290001Sglebius.Sh "OPTION PRESETS"
387290001SglebiusAny option that is not marked as \fInot presettable\fP may be preset
388290001Sglebiusby loading values from environment variables named:
389290001Sglebius.nf
390290001Sglebius  \fBNTPD_<option\-name>\fP or \fBNTPD\fP
391290001Sglebius.fi
392290001Sglebius.ad
393290001Sglebius.Sh USAGE
39482501Ssheldonh.Ss "How NTP Operates"
39582501SsheldonhThe
39682501Ssheldonh.Nm
39799968Scharnierutility operates by exchanging messages with
398290001Sglebiusone or more configured servers over a range of designated poll intervals.
39982501SsheldonhWhen
40082501Ssheldonhstarted, whether for the first or subsequent times, the program
40197735Sschweikhrequires several exchanges from the majority of these servers so
40282501Ssheldonhthe signal processing and mitigation algorithms can accumulate and
40382501Ssheldonhgroom the data and set the clock.
40482501SsheldonhIn order to protect the network
40582501Ssheldonhfrom bursts, the initial poll interval for each server is delayed
406158688Spavan interval randomized over a few seconds.
40782501SsheldonhAt the default initial poll
40882501Ssheldonhinterval of 64s, several minutes can elapse before the clock is
40982501Ssheldonhset.
410290001SglebiusThis initial delay to set the clock
411290001Sglebiuscan be safely and dramatically reduced using the
41282501Ssheldonh.Cm iburst
41382501Ssheldonhkeyword with the
41482501Ssheldonh.Ic server
41582501Ssheldonhconfiguration
41682501Ssheldonhcommand, as described in
41782501Ssheldonh.Xr ntp.conf 5 .
41855895Ssheldonh.Pp
41982501SsheldonhMost operating systems and hardware of today incorporate a
420290001Sglebiustime\-of\-year (TOY) chip to maintain the time during periods when
42182501Ssheldonhthe power is off.
42282501SsheldonhWhen the machine is booted, the chip is used to
42382501Ssheldonhinitialize the operating system time.
42482501SsheldonhAfter the machine has
42582501Ssheldonhsynchronized to a NTP server, the operating system corrects the
42682501Ssheldonhchip from time to time.
427290001SglebiusIn the default case, if
42882501Ssheldonh.Nm
429290001Sglebiusdetects that the time on the host
430290001Sglebiusis more than 1000s from the server time,
431290001Sglebius.Nm
43282501Ssheldonhassumes something must be terribly wrong and the only
43382501Ssheldonhreliable action is for the operator to intervene and set the clock
43482501Ssheldonhby hand.
435290001Sglebius(Reasons for this include there is no TOY chip,
436290001Sglebiusor its battery is dead, or that the TOY chip is just of poor quality.)
43782501SsheldonhThis causes
43882501Ssheldonh.Nm
43982501Ssheldonhto exit with a panic message to
44082501Ssheldonhthe system log.
44182501SsheldonhThe
44282501Ssheldonh.Fl g
44382501Ssheldonhoption overrides this check and the
444290001Sglebiusclock will be set to the server time regardless of the chip time
445290001Sglebius(up to 68 years in the past or future \(em
446290001Sglebiusthis is a limitation of the NTPv4 protocol).
44782501SsheldonhHowever, and to protect against broken hardware, such as when the
44882501SsheldonhCMOS battery fails or the clock counter becomes defective, once the
449290001Sglebiusclock has been set an error greater than 1000s will cause
45082501Ssheldonh.Nm
45182501Ssheldonhto exit anyway.
45282501Ssheldonh.Pp
45397735SschweikhUnder ordinary conditions,
45482501Ssheldonh.Nm
45582501Ssheldonhadjusts the clock in
45682501Ssheldonhsmall steps so that the timescale is effectively continuous and
45782501Ssheldonhwithout discontinuities.
45882501SsheldonhUnder conditions of extreme network
45982501Ssheldonhcongestion, the roundtrip delay jitter can exceed three seconds and
460290001Sglebiusthe synchronization distance, which is equal to one\-half the
46182501Ssheldonhroundtrip delay plus error budget terms, can become very large.
46282501SsheldonhThe
46382501Ssheldonh.Nm
46482501Ssheldonhalgorithms discard sample offsets exceeding 128 ms,
46582501Ssheldonhunless the interval during which no sample offset is less than 128
46682501Ssheldonhms exceeds 900s.
46782501SsheldonhThe first sample after that, no matter what the
46882501Ssheldonhoffset, steps the clock to the indicated time.
46982501SsheldonhIn practice this
47082501Ssheldonhreduces the false alarm rate where the clock is stepped in error to
47182501Ssheldonha vanishingly low incidence.
47282501Ssheldonh.Pp
473290001SglebiusAs the result of this behavior, once the clock has been set it
474290001Sglebiusvery rarely strays more than 128 ms even under extreme cases of
47582501Ssheldonhnetwork path congestion and jitter.
47682501SsheldonhSometimes, in particular when
47782501Ssheldonh.Nm
478290001Sglebiusis first started without a valid drift file
479290001Sglebiuson a system with a large intrinsic drift
480290001Sglebiusthe error might grow to exceed 128 ms,
481290001Sglebiuswhich would cause the clock to be set backwards
482290001Sglebiusif the local clock time is more than 128 s
483290001Sglebiusin the future relative to the server.
48482501SsheldonhIn some applications, this behavior may be unacceptable.
485290001SglebiusThere are several solutions, however.
48682501SsheldonhIf the
48782501Ssheldonh.Fl x
48882501Ssheldonhoption is included on the command line, the clock will
48982501Ssheldonhnever be stepped and only slew corrections will be used.
490290001SglebiusBut this choice comes with a cost that
491290001Sglebiusshould be carefully explored before deciding to use
49282501Ssheldonhthe
49382501Ssheldonh.Fl x
49482501Ssheldonhoption.
49582501SsheldonhThe maximum slew rate possible is limited
496290001Sglebiusto 500 parts\-per\-million (PPM) as a consequence of the correctness
49782501Ssheldonhprinciples on which the NTP protocol and algorithm design are
49882501Ssheldonhbased.
49982501SsheldonhAs a result, the local clock can take a long time to
50082501Ssheldonhconverge to an acceptable offset, about 2,000 s for each second the
50182501Ssheldonhclock is outside the acceptable range.
50282501SsheldonhDuring this interval the
50382501Ssheldonhlocal clock will not be consistent with any other network clock and
50482501Ssheldonhthe system cannot be used for distributed applications that require
50582501Ssheldonhcorrectly synchronized network time.
50682501Ssheldonh.Pp
50782501SsheldonhIn spite of the above precautions, sometimes when large
50882501Ssheldonhfrequency errors are present the resulting time offsets stray
509290001Sglebiusoutside the 128\-ms range and an eventual step or slew time
51082501Ssheldonhcorrection is required.
51182501SsheldonhIf following such a correction the
51282501Ssheldonhfrequency error is so large that the first sample is outside the
51382501Ssheldonhacceptable range,
51482501Ssheldonh.Nm
51582501Ssheldonhenters the same state as when the
51682501Ssheldonh.Pa ntp.drift
51782501Ssheldonhfile is not present.
51882501SsheldonhThe intent of this behavior
51982501Ssheldonhis to quickly correct the frequency and restore operation to the
52082501Ssheldonhnormal tracking mode.
52182501SsheldonhIn the most extreme cases
522290001Sglebius(the host
523158688Spav.Cm time.ien.it
524158688Spavcomes to mind), there may be occasional
52582501Ssheldonhstep/slew corrections and subsequent frequency corrections.
52682501SsheldonhIt
52782501Ssheldonhhelps in these cases to use the
52882501Ssheldonh.Cm burst
52982501Ssheldonhkeyword when
530290001Sglebiusconfiguring the server, but
531290001SglebiusONLY
532290001Sglebiuswhen you have permission to do so from the owner of the target host.
533290001Sglebius.Pp
534290001SglebiusFinally,
535290001Sglebiusin the past many startup scripts would run
536290001Sglebius.Xr ntpdate 8
537290001Sglebiusor
538290001Sglebius.Xr sntp 8
539290001Sglebiusto get the system clock close to correct before starting
540290001Sglebius.Xr ntpd 8 ,
541290001Sglebiusbut this was never more than a mediocre hack and is no longer needed.
542290001SglebiusIf you are following the instructions in
543290001Sglebius.Sx "Starting NTP (Best Current Practice)"
544290001Sglebiusand you still need to set the system time before starting
545290001Sglebius.Nm ,
546290001Sglebiusplease open a bug report and document what is going on,
547290001Sglebiusand then look at using
548290001Sglebius.Xr sntp 8
549290001Sglebiusif you really need to set the clock before starting
550290001Sglebius.Nm .
551290001Sglebius.Pp
552290001SglebiusThere is a way to start
553290001Sglebius.Xr ntpd 8
554290001Sglebiusthat often addresses all of the problems mentioned above.
555290001Sglebius.Ss "Starting NTP (Best Current Practice)"
556290001SglebiusFirst, use the
557290001Sglebius.Cm iburst
558290001Sglebiusoption on your
559290001Sglebius.Cm server
560290001Sglebiusentries.
561290001Sglebius.Pp
562290001SglebiusIf you can also keep a good
563290001Sglebius.Pa ntp.drift
564290001Sglebiusfile then
565290001Sglebius.Xr ntpd 8
566290001Sglebiuswill effectively "warm\-start" and your system's clock will
567290001Sglebiusbe stable in under 11 seconds' time.
568290001Sglebius.Pp
569290001SglebiusAs soon as possible in the startup sequence, start
570290001Sglebius.Xr ntpd 8
571290001Sglebiuswith at least the
572290001Sglebius.Fl g
573290001Sglebiusand perhaps the
574290001Sglebius.Fl N
575290001Sglebiusoptions.
576290001SglebiusThen,
577290001Sglebiusstart the rest of your "normal" processes.
578290001SglebiusThis will give
579290001Sglebius.Xr ntpd 8
580290001Sglebiusas much time as possible to get the system's clock synchronized and stable.
581290001Sglebius.Pp
582290001SglebiusFinally,
583290001Sglebiusif you have processes like
584290001Sglebius.Cm dovecot
585290001Sglebiusor database servers
586290001Sglebiusthat require
587290001Sglebiusmonotonically\-increasing time,
588290001Sglebiusrun
589290001Sglebius.Xr ntp\-wait 1ntp\-waitmdoc
590290001Sglebiusas late as possible in the boot sequence
591290001Sglebius(perhaps with the
592290001Sglebius.Fl v
593290001Sglebiusflag)
594290001Sglebiusand after
595290001Sglebius.Xr ntp\-wait 1ntp\-waitmdoc
596290001Sglebiusexits successfully
597290001Sglebiusit is as safe as it will ever be to start any process that require
598290001Sglebiusstable time.
59982501Ssheldonh.Ss "Frequency Discipline"
60082501SsheldonhThe
60182501Ssheldonh.Nm
60282501Ssheldonhbehavior at startup depends on whether the
60382501Ssheldonhfrequency file, usually
60482501Ssheldonh.Pa ntp.drift ,
60582501Ssheldonhexists.
60682501SsheldonhThis file
60782501Ssheldonhcontains the latest estimate of clock frequency error.
60882501SsheldonhWhen the
60982501Ssheldonh.Nm
61082501Ssheldonhis started and the file does not exist, the
61182501Ssheldonh.Nm
61282501Ssheldonhenters a special mode designed to quickly adapt to
61382501Ssheldonhthe particular system clock oscillator time and frequency error.
61482501SsheldonhThis takes approximately 15 minutes, after which the time and
61582501Ssheldonhfrequency are set to nominal values and the
61682501Ssheldonh.Nm
61782501Ssheldonhenters
61882501Ssheldonhnormal mode, where the time and frequency are continuously tracked
61982501Ssheldonhrelative to the server.
62082501SsheldonhAfter one hour the frequency file is
62182501Ssheldonhcreated and the current frequency offset written to it.
62282501SsheldonhWhen the
62382501Ssheldonh.Nm
62482501Ssheldonhis started and the file does exist, the
62582501Ssheldonh.Nm
62682501Ssheldonhfrequency is initialized from the file and enters normal mode
62782501Ssheldonhimmediately.
62882501SsheldonhAfter that the current frequency offset is written to
62982501Ssheldonhthe file at hourly intervals.
63082501Ssheldonh.Ss "Operating Modes"
63199968ScharnierThe
63282501Ssheldonh.Nm
63399968Scharnierutility can operate in any of several modes, including
63482501Ssheldonhsymmetric active/passive, client/server broadcast/multicast and
63582501Ssheldonhmanycast, as described in the
63682501Ssheldonh.Qq Association Management
63782501Ssheldonhpage
63882501Ssheldonh(available as part of the HTML documentation
63982501Ssheldonhprovided in
64082501Ssheldonh.Pa /usr/share/doc/ntp ) .
64182501SsheldonhIt normally operates continuously while
64282501Ssheldonhmonitoring for small changes in frequency and trimming the clock
64382501Ssheldonhfor the ultimate precision.
644290001SglebiusHowever, it can operate in a one\-time
64582501Ssheldonhmode where the time is set from an external server and frequency is
64682501Ssheldonhset from a previously recorded frequency file.
64782501SsheldonhA
64882501Ssheldonhbroadcast/multicast or manycast client can discover remote servers,
649290001Sglebiuscompute server\-client propagation delay correction factors and
65082501Ssheldonhconfigure itself automatically.
65182501SsheldonhThis makes it possible to deploy a
65282501Ssheldonhfleet of workstations without specifying configuration details
65382501Ssheldonhspecific to the local environment.
65482501Ssheldonh.Pp
65582501SsheldonhBy default,
65682501Ssheldonh.Nm
65782501Ssheldonhruns in continuous mode where each of
65882501Ssheldonhpossibly several external servers is polled at intervals determined
65982501Ssheldonhby an intricate state machine.
66082501SsheldonhThe state machine measures the
66182501Ssheldonhincidental roundtrip delay jitter and oscillator frequency wander
66282501Ssheldonhand determines the best poll interval using a heuristic algorithm.
66382501SsheldonhOrdinarily, and in most operating environments, the state machine
66482501Ssheldonhwill start with 64s intervals and eventually increase in steps to
66582501Ssheldonh1024s.
66682501SsheldonhA small amount of random variation is introduced in order to
66782501Ssheldonhavoid bunching at the servers.
66882501SsheldonhIn addition, should a server become
66982501Ssheldonhunreachable for some time, the poll interval is increased in steps
67082501Ssheldonhto 1024s in order to reduce network overhead.
67182501Ssheldonh.Pp
67282501SsheldonhIn some cases it may not be practical for
67382501Ssheldonh.Nm
674290001Sglebiusto run continuously.
67582501SsheldonhA common workaround has been to run the
67682501Ssheldonh.Xr ntpdate 8
677290001Sglebiusor
678290001Sglebius.Xr sntp 8
679290001Sglebiusprograms from a
68082501Ssheldonh.Xr cron 8
68182501Ssheldonhjob at designated
68282501Ssheldonhtimes.
683290001SglebiusHowever, these programs do not have the crafted signal
684290001Sglebiusprocessing, error checking or mitigation algorithms of
68582501Ssheldonh.Nm .
68682501SsheldonhThe
68782501Ssheldonh.Fl q
68882501Ssheldonhoption is intended for this purpose.
68982501SsheldonhSetting this option will cause
69082501Ssheldonh.Nm
69182501Ssheldonhto exit just after
69282501Ssheldonhsetting the clock for the first time.
69382501SsheldonhThe procedure for initially
69482501Ssheldonhsetting the clock is the same as in continuous mode; most
69582501Ssheldonhapplications will probably want to specify the
69682501Ssheldonh.Cm iburst
69782501Ssheldonhkeyword with the
69882501Ssheldonh.Ic server
69982501Ssheldonhconfiguration command.
70082501SsheldonhWith this
70182501Ssheldonhkeyword a volley of messages are exchanged to groom the data and
702158688Spavthe clock is set in about 10 s.
70382501SsheldonhIf nothing is heard after a
70482501Ssheldonhcouple of minutes, the daemon times out and exits.
70582501SsheldonhAfter a suitable
70682501Ssheldonhperiod of mourning, the
70782501Ssheldonh.Xr ntpdate 8
708290001Sglebiusprogram will be
70982501Ssheldonhretired.
71082501Ssheldonh.Pp
71182501SsheldonhWhen kernel support is available to discipline the clock
71282501Ssheldonhfrequency, which is the case for stock Solaris, Tru64, Linux and
71382501Ssheldonh.Fx ,
71482501Ssheldonha useful feature is available to discipline the clock
71582501Ssheldonhfrequency.
71682501SsheldonhFirst,
71782501Ssheldonh.Nm
71882501Ssheldonhis run in continuous mode with
71982501Ssheldonhselected servers in order to measure and record the intrinsic clock
72082501Ssheldonhfrequency offset in the frequency file.
72182501SsheldonhIt may take some hours for
72282501Ssheldonhthe frequency and offset to settle down.
72382501SsheldonhThen the
72482501Ssheldonh.Nm
72582501Ssheldonhis
726290001Sglebiusstopped and run in one\-time mode as required.
72782501SsheldonhAt each startup, the
72882501Ssheldonhfrequency is read from the file and initializes the kernel
72982501Ssheldonhfrequency.
73082501Ssheldonh.Ss "Poll Interval Control"
73182501SsheldonhThis version of NTP includes an intricate state machine to
73282501Ssheldonhreduce the network load while maintaining a quality of
73382501Ssheldonhsynchronization consistent with the observed jitter and wander.
73482501SsheldonhThere are a number of ways to tailor the operation in order enhance
73582501Ssheldonhaccuracy by reducing the interval or to reduce network overhead by
73682501Ssheldonhincreasing it.
73782501SsheldonhHowever, the user is advised to carefully consider
73897735Sschweikhthe consequences of changing the poll adjustment range from the
73982501Ssheldonhdefault minimum of 64 s to the default maximum of 1,024 s.
74082501SsheldonhThe
74182501Ssheldonhdefault minimum can be changed with the
74282501Ssheldonh.Ic tinker
74382501Ssheldonh.Cm minpoll
74482501Ssheldonhcommand to a value not less than 16 s.
74582501SsheldonhThis value is used for all
74697735Sschweikhconfigured associations, unless overridden by the
74782501Ssheldonh.Cm minpoll
74882501Ssheldonhoption on the configuration command.
74982501SsheldonhNote that most device drivers
75082501Ssheldonhwill not operate properly if the poll interval is less than 64 s
75182501Ssheldonhand that the broadcast server and manycast client associations will
75297735Sschweikhalso use the default, unless overridden.
75382501Ssheldonh.Pp
75482501SsheldonhIn some cases involving dial up or toll services, it may be
75582501Ssheldonhuseful to increase the minimum interval to a few tens of minutes
75682501Ssheldonhand maximum interval to a day or so.
75782501SsheldonhUnder normal operation
75882501Ssheldonhconditions, once the clock discipline loop has stabilized the
75997735Sschweikhinterval will be increased in steps from the minimum to the
76082501Ssheldonhmaximum.
76182501SsheldonhHowever, this assumes the intrinsic clock frequency error
76282501Ssheldonhis small enough for the discipline loop correct it.
76382501SsheldonhThe capture
76482501Ssheldonhrange of the loop is 500 PPM at an interval of 64s decreasing by a
76582501Ssheldonhfactor of two for each doubling of interval.
76682501SsheldonhAt a minimum of 1,024
76782501Ssheldonhs, for example, the capture range is only 31 PPM.
76882501SsheldonhIf the intrinsic
76982501Ssheldonherror is greater than this, the drift file
77082501Ssheldonh.Pa ntp.drift
77182501Ssheldonhwill
77282501Ssheldonhhave to be specially tailored to reduce the residual error below
77382501Ssheldonhthis limit.
77482501SsheldonhOnce this is done, the drift file is automatically
77582501Ssheldonhupdated once per hour and is available to initialize the frequency
77682501Ssheldonhon subsequent daemon restarts.
777290001Sglebius.Ss "The huff\-n'\-puff Filter"
77882501SsheldonhIn scenarios where a considerable amount of data are to be
77982501Ssheldonhdownloaded or uploaded over telephone modems, timekeeping quality
78082501Ssheldonhcan be seriously degraded.
78182501SsheldonhThis occurs because the differential
78282501Ssheldonhdelays on the two directions of transmission can be quite large.
78382501SsheldonhIn
78482501Ssheldonhmany cases the apparent time errors are so large as to exceed the
78582501Ssheldonhstep threshold and a step correction can occur during and after the
78682501Ssheldonhdata transfer is in progress.
78782501Ssheldonh.Pp
788290001SglebiusThe huff\-n'\-puff filter is designed to correct the apparent time
78982501Ssheldonhoffset in these cases.
79082501SsheldonhIt depends on knowledge of the propagation
79182501Ssheldonhdelay when no other traffic is present.
79282501SsheldonhIn common scenarios this
79382501Ssheldonhoccurs during other than work hours.
79482501SsheldonhThe filter maintains a shift
79582501Ssheldonhregister that remembers the minimum delay over the most recent
79682501Ssheldonhinterval measured usually in hours.
79782501SsheldonhUnder conditions of severe
79882501Ssheldonhdelay, the filter corrects the apparent offset using the sign of
79982501Ssheldonhthe offset and the difference between the apparent delay and
80082501Ssheldonhminimum delay.
80182501SsheldonhThe name of the filter reflects the negative (huff)
80282501Ssheldonhand positive (puff) correction, which depends on the sign of the
80382501Ssheldonhoffset.
80482501Ssheldonh.Pp
80582501SsheldonhThe filter is activated by the
806158688Spav.Ic tinker
807158688Spavcommand and
80882501Ssheldonh.Cm huffpuff
80982501Ssheldonhkeyword, as described in
81082501Ssheldonh.Xr ntp.conf 5 .
811290001Sglebius.Sh "ENVIRONMENT"
812290001SglebiusSee \fBOPTION PRESETS\fP for configuration environment variables.
81355896Ssheldonh.Sh FILES
81455896Ssheldonh.Bl -tag -width /etc/ntp.drift -compact
81555896Ssheldonh.It Pa /etc/ntp.conf
81655896Ssheldonhthe default name of the configuration file
81755896Ssheldonh.It Pa /etc/ntp.drift
81855896Ssheldonhthe default name of the drift file
81955896Ssheldonh.It Pa /etc/ntp.keys
82055896Ssheldonhthe default name of the key file
82155896Ssheldonh.El
822290001Sglebius.Sh "EXIT STATUS"
823290001SglebiusOne of the following exit values will be returned:
824290001Sglebius.Bl -tag
825290001Sglebius.It 0 " (EXIT_SUCCESS)"
826290001SglebiusSuccessful program execution.
827290001Sglebius.It 1 " (EXIT_FAILURE)"
828290001SglebiusThe operation failed or the command syntax was not valid.
829290001Sglebius.It 70 " (EX_SOFTWARE)"
830290001Sglebiuslibopts had an internal operational error.  Please report
831290001Sglebiusit to autogen\-users@lists.sourceforge.net.  Thank you.
832290001Sglebius.El
833290001Sglebius.Sh "SEE ALSO"
83455895Ssheldonh.Xr ntp.conf 5 ,
83555857Ssheldonh.Xr ntpdate 8 ,
83655857Ssheldonh.Xr ntpdc 8 ,
837290001Sglebius.Xr ntpq 8 ,
838290001Sglebius.Xr sntp 8
83955857Ssheldonh.Pp
84055857SsheldonhIn addition to the manual pages provided,
84155857Ssheldonhcomprehensive documentation is available on the world wide web
84255857Ssheldonhat
84355857Ssheldonh.Li http://www.ntp.org/ .
84455857SsheldonhA snapshot of this documentation is available in HTML format in
84555857Ssheldonh.Pa /usr/share/doc/ntp .
84655857Ssheldonh.Rs
84755857Ssheldonh.%A David L. Mills
84855857Ssheldonh.%T Network Time Protocol (Version 1)
84955857Ssheldonh.%O RFC1059
85055857Ssheldonh.Re
85155857Ssheldonh.Rs
85255857Ssheldonh.%A David L. Mills
85355857Ssheldonh.%T Network Time Protocol (Version 2)
85455857Ssheldonh.%O RFC1119
85555857Ssheldonh.Re
85655857Ssheldonh.Rs
85755857Ssheldonh.%A David L. Mills
85855857Ssheldonh.%T Network Time Protocol (Version 3)
85955857Ssheldonh.%O RFC1305
86055857Ssheldonh.Re
861290001Sglebius.Rs
862290001Sglebius.%A David L. Mills
863290001Sglebius.%A J. Martin, Ed.
864290001Sglebius.%A J. Burbank
865290001Sglebius.%A W. Kasch
866290001Sglebius.%T Network Time Protocol Version 4: Protocol and Algorithms Specification
867290001Sglebius.%O RFC5905
868290001Sglebius.Re
869290001Sglebius.Rs
870290001Sglebius.%A David L. Mills
871290001Sglebius.%A B. Haberman, Ed.
872290001Sglebius.%T Network Time Protocol Version 4: Autokey Specification
873290001Sglebius.%O RFC5906
874290001Sglebius.Re
875290001Sglebius.Rs
876290001Sglebius.%A H. Gerstung
877290001Sglebius.%A C. Elliott
878290001Sglebius.%A B. Haberman, Ed.
879290001Sglebius.%T Definitions of Managed Objects for Network Time Protocol Version 4: (NTPv4)
880290001Sglebius.%O RFC5907
881290001Sglebius.Re
882290001Sglebius.Rs
883290001Sglebius.%A R. Gayraud
884290001Sglebius.%A B. Lourdelet
885290001Sglebius.%T Network Time Protocol (NTP) Server Option for DHCPv6
886290001Sglebius.%O RFC5908
887290001Sglebius.Re
888290001Sglebius.Sh "AUTHORS"
889290001SglebiusThe University of Delaware and Network Time Foundation
890290001Sglebius.Sh "COPYRIGHT"
891294905SdelphijCopyright (C) 1992\-2016 The University of Delaware and Network Time Foundation all rights reserved.
892290001SglebiusThis program is released under the terms of the NTP license, <http://ntp.org/license>.
89355857Ssheldonh.Sh BUGS
89499968ScharnierThe
89555857Ssheldonh.Nm
89699968Scharnierutility has gotten rather fat.
89782501SsheldonhWhile not huge, it has gotten
898290001Sglebiuslarger than might be desirable for an elevated\-priority
89982501Ssheldonh.Nm
90082501Ssheldonhrunning on a workstation, particularly since many of
90182501Ssheldonhthe fancy features which consume the space were designed more with
90282501Ssheldonha busy primary server, rather than a high stratum workstation in
90382501Ssheldonhmind.
904290001Sglebius.Pp
905290001SglebiusPlease send bug reports to: http://bugs.ntp.org, bugs@ntp.org
906290001Sglebius.Sh NOTES
907290001SglebiusPortions of this document came from FreeBSD.
908290001Sglebius.Pp
909290001SglebiusThis manual page was \fIAutoGen\fP\-erated from the \fBntpd\fP
910290001Sglebiusoption definitions.
911