]> CyberLeo.Net >> Repos - FreeBSD/releng/10.2.git/blob - contrib/ntp/ntpd/ntpd-opts.def
Upgrade NTP to 4.2.8p4.
[FreeBSD/releng/10.2.git] / contrib / ntp / ntpd / ntpd-opts.def
1 /* -*- Mode: Text -*- */
2
3 autogen definitions options;
4
5 #include copyright.def
6
7 prog-name       = "ntpd";
8 prog-title      = "NTP daemon program";
9 argument        = "[ <server1> ... <serverN> ]";
10
11 #include ntpdbase-opts.def
12
13 /* explain: Additional information whenever the usage routine is invoked */
14 explain = <<- _END_EXPLAIN
15         _END_EXPLAIN;
16
17 doc-section     = {
18   ds-type       = 'DESCRIPTION';
19   ds-format     = 'mdoc';
20   ds-text       = <<- _END_PROG_MDOC_DESCRIP
21 The
22 .Nm
23 utility is an operating system daemon which sets
24 and maintains the system time of day in synchronism with Internet
25 standard time servers.
26 It is a complete implementation of the
27 Network Time Protocol (NTP) version 4, as defined by RFC-5905,
28 but also retains compatibility with
29 version 3, as defined by RFC-1305, and versions 1
30 and 2, as defined by RFC-1059 and RFC-1119, respectively.
31 .Pp
32 The
33 .Nm
34 utility does most computations in 64-bit floating point
35 arithmetic and does relatively clumsy 64-bit fixed point operations
36 only when necessary to preserve the ultimate precision, about 232
37 picoseconds.
38 While the ultimate precision is not achievable with
39 ordinary workstations and networks of today, it may be required
40 with future gigahertz CPU clocks and gigabit LANs.
41 .Pp
42 Ordinarily,
43 .Nm
44 reads the
45 .Xr ntp.conf 5
46 configuration file at startup time in order to determine the
47 synchronization sources and operating modes.
48 It is also possible to
49 specify a working, although limited, configuration entirely on the
50 command line, obviating the need for a configuration file.
51 This may
52 be particularly useful when the local host is to be configured as a
53 broadcast/multicast client, with all peers being determined by
54 listening to broadcasts at run time.
55 .Pp
56 If NetInfo support is built into
57 .Nm ,
58 then
59 .Nm
60 will attempt to read its configuration from the
61 NetInfo if the default
62 .Xr ntp.conf 5
63 file cannot be read and no file is
64 specified by the
65 .Fl c
66 option.
67 .Pp
68 Various internal
69 .Nm
70 variables can be displayed and
71 configuration options altered while the
72 .Nm
73 is running
74 using the
75 .Xr ntpq 1ntpqmdoc
76 and
77 .Xr ntpdc 1ntpdcmdoc
78 utility programs.
79 .Pp
80 When
81 .Nm
82 starts it looks at the value of
83 .Xr umask 2 ,
84 and if zero
85 .Nm
86 will set the
87 .Xr umask 2
88 to 022.
89         _END_PROG_MDOC_DESCRIP;
90 };
91
92 doc-section     = {
93   ds-type       = 'USAGE';
94   ds-format     = 'mdoc';
95   ds-text       = <<- _END_MDOC_USAGE
96 .Ss "How NTP Operates"
97 The
98 .Nm
99 utility operates by exchanging messages with
100 one or more configured servers over a range of designated poll intervals.
101 When
102 started, whether for the first or subsequent times, the program
103 requires several exchanges from the majority of these servers so
104 the signal processing and mitigation algorithms can accumulate and
105 groom the data and set the clock.
106 In order to protect the network
107 from bursts, the initial poll interval for each server is delayed
108 an interval randomized over a few seconds.
109 At the default initial poll
110 interval of 64s, several minutes can elapse before the clock is
111 set.
112 This initial delay to set the clock
113 can be safely and dramatically reduced using the
114 .Cm iburst
115 keyword with the
116 .Ic server
117 configuration
118 command, as described in
119 .Xr ntp.conf 5 .
120 .Pp
121 Most operating systems and hardware of today incorporate a
122 time-of-year (TOY) chip to maintain the time during periods when
123 the power is off.
124 When the machine is booted, the chip is used to
125 initialize the operating system time.
126 After the machine has
127 synchronized to a NTP server, the operating system corrects the
128 chip from time to time.
129 In the default case, if
130 .Nm
131 detects that the time on the host
132 is more than 1000s from the server time,
133 .Nm
134 assumes something must be terribly wrong and the only
135 reliable action is for the operator to intervene and set the clock
136 by hand.
137 (Reasons for this include there is no TOY chip,
138 or its battery is dead, or that the TOY chip is just of poor quality.)
139 This causes
140 .Nm
141 to exit with a panic message to
142 the system log.
143 The
144 .Fl g
145 option overrides this check and the
146 clock will be set to the server time regardless of the chip time
147 (up to 68 years in the past or future \(em
148 this is a limitation of the NTPv4 protocol).
149 However, and to protect against broken hardware, such as when the
150 CMOS battery fails or the clock counter becomes defective, once the
151 clock has been set an error greater than 1000s will cause
152 .Nm
153 to exit anyway.
154 .Pp
155 Under ordinary conditions,
156 .Nm
157 adjusts the clock in
158 small steps so that the timescale is effectively continuous and
159 without discontinuities.
160 Under conditions of extreme network
161 congestion, the roundtrip delay jitter can exceed three seconds and
162 the synchronization distance, which is equal to one-half the
163 roundtrip delay plus error budget terms, can become very large.
164 The
165 .Nm
166 algorithms discard sample offsets exceeding 128 ms,
167 unless the interval during which no sample offset is less than 128
168 ms exceeds 900s.
169 The first sample after that, no matter what the
170 offset, steps the clock to the indicated time.
171 In practice this
172 reduces the false alarm rate where the clock is stepped in error to
173 a vanishingly low incidence.
174 .Pp
175 As the result of this behavior, once the clock has been set it
176 very rarely strays more than 128 ms even under extreme cases of
177 network path congestion and jitter.
178 Sometimes, in particular when
179 .Nm
180 is first started without a valid drift file
181 on a system with a large intrinsic drift
182 the error might grow to exceed 128 ms,
183 which would cause the clock to be set backwards
184 if the local clock time is more than 128 s
185 in the future relative to the server.
186 In some applications, this behavior may be unacceptable.
187 There are several solutions, however.
188 If the
189 .Fl x
190 option is included on the command line, the clock will
191 never be stepped and only slew corrections will be used.
192 But this choice comes with a cost that
193 should be carefully explored before deciding to use
194 the
195 .Fl x
196 option.
197 The maximum slew rate possible is limited
198 to 500 parts-per-million (PPM) as a consequence of the correctness
199 principles on which the NTP protocol and algorithm design are
200 based.
201 As a result, the local clock can take a long time to
202 converge to an acceptable offset, about 2,000 s for each second the
203 clock is outside the acceptable range.
204 During this interval the
205 local clock will not be consistent with any other network clock and
206 the system cannot be used for distributed applications that require
207 correctly synchronized network time.
208 .Pp
209 In spite of the above precautions, sometimes when large
210 frequency errors are present the resulting time offsets stray
211 outside the 128-ms range and an eventual step or slew time
212 correction is required.
213 If following such a correction the
214 frequency error is so large that the first sample is outside the
215 acceptable range,
216 .Nm
217 enters the same state as when the
218 .Pa ntp.drift
219 file is not present.
220 The intent of this behavior
221 is to quickly correct the frequency and restore operation to the
222 normal tracking mode.
223 In the most extreme cases
224 (the host
225 .Cm time.ien.it
226 comes to mind), there may be occasional
227 step/slew corrections and subsequent frequency corrections.
228 It
229 helps in these cases to use the
230 .Cm burst
231 keyword when
232 configuring the server, but
233 ONLY
234 when you have permission to do so from the owner of the target host.
235 .Pp
236 Finally,
237 in the past many startup scripts would run
238 .Xr ntpdate 1ntpdatemdoc
239 or
240 .Xr sntp 1sntpmdoc
241 to get the system clock close to correct before starting
242 .Xr ntpd 1ntpdmdoc ,
243 but this was never more than a mediocre hack and is no longer needed.
244 If you are following the instructions in
245 .Sx "Starting NTP (Best Current Practice)"
246 and you still need to set the system time before starting
247 .Nm ,
248 please open a bug report and document what is going on,
249 and then look at using
250 .Xr sntp 1sntpmdoc
251 if you really need to set the clock before starting
252 .Nm .
253 .Pp
254 There is a way to start
255 .Xr ntpd 1ntpdmdoc
256 that often addresses all of the problems mentioned above.
257 .Ss "Starting NTP (Best Current Practice)"
258 First, use the
259 .Cm iburst
260 option on your
261 .Cm server
262 entries.
263 .Pp
264 If you can also keep a good
265 .Pa ntp.drift
266 file then
267 .Xr ntpd 1ntpdmdoc
268 will effectively "warm-start" and your system's clock will
269 be stable in under 11 seconds' time.
270 .Pp
271 As soon as possible in the startup sequence, start
272 .Xr ntpd 1ntpdmdoc
273 with at least the
274 .Fl g
275 and perhaps the
276 .Fl N
277 options.
278 Then,
279 start the rest of your "normal" processes.
280 This will give
281 .Xr ntpd 1ntpdmdoc
282 as much time as possible to get the system's clock synchronized and stable.
283 .Pp
284 Finally,
285 if you have processes like
286 .Cm dovecot
287 or database servers
288 that require
289 monotonically-increasing time,
290 run
291 .Xr ntp-wait 1ntp-waitmdoc
292 as late as possible in the boot sequence
293 (perhaps with the
294 .Fl v
295 flag)
296 and after
297 .Xr ntp-wait 1ntp-waitmdoc
298 exits successfully
299 it is as safe as it will ever be to start any process that require
300 stable time.
301 .Ss "Frequency Discipline"
302 The
303 .Nm
304 behavior at startup depends on whether the
305 frequency file, usually
306 .Pa ntp.drift ,
307 exists.
308 This file
309 contains the latest estimate of clock frequency error.
310 When the
311 .Nm
312 is started and the file does not exist, the
313 .Nm
314 enters a special mode designed to quickly adapt to
315 the particular system clock oscillator time and frequency error.
316 This takes approximately 15 minutes, after which the time and
317 frequency are set to nominal values and the
318 .Nm
319 enters
320 normal mode, where the time and frequency are continuously tracked
321 relative to the server.
322 After one hour the frequency file is
323 created and the current frequency offset written to it.
324 When the
325 .Nm
326 is started and the file does exist, the
327 .Nm
328 frequency is initialized from the file and enters normal mode
329 immediately.
330 After that the current frequency offset is written to
331 the file at hourly intervals.
332 .Ss "Operating Modes"
333 The
334 .Nm
335 utility can operate in any of several modes, including
336 symmetric active/passive, client/server broadcast/multicast and
337 manycast, as described in the
338 .Qq Association Management
339 page
340 (available as part of the HTML documentation
341 provided in
342 .Pa /usr/share/doc/ntp ) .
343 It normally operates continuously while
344 monitoring for small changes in frequency and trimming the clock
345 for the ultimate precision.
346 However, it can operate in a one-time
347 mode where the time is set from an external server and frequency is
348 set from a previously recorded frequency file.
349 A
350 broadcast/multicast or manycast client can discover remote servers,
351 compute server-client propagation delay correction factors and
352 configure itself automatically.
353 This makes it possible to deploy a
354 fleet of workstations without specifying configuration details
355 specific to the local environment.
356 .Pp
357 By default,
358 .Nm
359 runs in continuous mode where each of
360 possibly several external servers is polled at intervals determined
361 by an intricate state machine.
362 The state machine measures the
363 incidental roundtrip delay jitter and oscillator frequency wander
364 and determines the best poll interval using a heuristic algorithm.
365 Ordinarily, and in most operating environments, the state machine
366 will start with 64s intervals and eventually increase in steps to
367 1024s.
368 A small amount of random variation is introduced in order to
369 avoid bunching at the servers.
370 In addition, should a server become
371 unreachable for some time, the poll interval is increased in steps
372 to 1024s in order to reduce network overhead.
373 .Pp
374 In some cases it may not be practical for
375 .Nm
376 to run continuously.
377 A common workaround has been to run the
378 .Xr ntpdate 1ntpdatemdoc
379 or
380 .Xr sntp 1sntpmdoc
381 programs from a
382 .Xr cron 8
383 job at designated
384 times.
385 However, these programs do not have the crafted signal
386 processing, error checking or mitigation algorithms of
387 .Nm .
388 The
389 .Fl q
390 option is intended for this purpose.
391 Setting this option will cause
392 .Nm
393 to exit just after
394 setting the clock for the first time.
395 The procedure for initially
396 setting the clock is the same as in continuous mode; most
397 applications will probably want to specify the
398 .Cm iburst
399 keyword with the
400 .Ic server
401 configuration command.
402 With this
403 keyword a volley of messages are exchanged to groom the data and
404 the clock is set in about 10 s.
405 If nothing is heard after a
406 couple of minutes, the daemon times out and exits.
407 After a suitable
408 period of mourning, the
409 .Xr ntpdate 1ntpdatemdoc
410 program will be
411 retired.
412 .Pp
413 When kernel support is available to discipline the clock
414 frequency, which is the case for stock Solaris, Tru64, Linux and
415 .Fx ,
416 a useful feature is available to discipline the clock
417 frequency.
418 First,
419 .Nm
420 is run in continuous mode with
421 selected servers in order to measure and record the intrinsic clock
422 frequency offset in the frequency file.
423 It may take some hours for
424 the frequency and offset to settle down.
425 Then the
426 .Nm
427 is
428 stopped and run in one-time mode as required.
429 At each startup, the
430 frequency is read from the file and initializes the kernel
431 frequency.
432 .Ss "Poll Interval Control"
433 This version of NTP includes an intricate state machine to
434 reduce the network load while maintaining a quality of
435 synchronization consistent with the observed jitter and wander.
436 There are a number of ways to tailor the operation in order enhance
437 accuracy by reducing the interval or to reduce network overhead by
438 increasing it.
439 However, the user is advised to carefully consider
440 the consequences of changing the poll adjustment range from the
441 default minimum of 64 s to the default maximum of 1,024 s.
442 The
443 default minimum can be changed with the
444 .Ic tinker
445 .Cm minpoll
446 command to a value not less than 16 s.
447 This value is used for all
448 configured associations, unless overridden by the
449 .Cm minpoll
450 option on the configuration command.
451 Note that most device drivers
452 will not operate properly if the poll interval is less than 64 s
453 and that the broadcast server and manycast client associations will
454 also use the default, unless overridden.
455 .Pp
456 In some cases involving dial up or toll services, it may be
457 useful to increase the minimum interval to a few tens of minutes
458 and maximum interval to a day or so.
459 Under normal operation
460 conditions, once the clock discipline loop has stabilized the
461 interval will be increased in steps from the minimum to the
462 maximum.
463 However, this assumes the intrinsic clock frequency error
464 is small enough for the discipline loop correct it.
465 The capture
466 range of the loop is 500 PPM at an interval of 64s decreasing by a
467 factor of two for each doubling of interval.
468 At a minimum of 1,024
469 s, for example, the capture range is only 31 PPM.
470 If the intrinsic
471 error is greater than this, the drift file
472 .Pa ntp.drift
473 will
474 have to be specially tailored to reduce the residual error below
475 this limit.
476 Once this is done, the drift file is automatically
477 updated once per hour and is available to initialize the frequency
478 on subsequent daemon restarts.
479 .Ss "The huff-n'-puff Filter"
480 In scenarios where a considerable amount of data are to be
481 downloaded or uploaded over telephone modems, timekeeping quality
482 can be seriously degraded.
483 This occurs because the differential
484 delays on the two directions of transmission can be quite large.
485 In
486 many cases the apparent time errors are so large as to exceed the
487 step threshold and a step correction can occur during and after the
488 data transfer is in progress.
489 .Pp
490 The huff-n'-puff filter is designed to correct the apparent time
491 offset in these cases.
492 It depends on knowledge of the propagation
493 delay when no other traffic is present.
494 In common scenarios this
495 occurs during other than work hours.
496 The filter maintains a shift
497 register that remembers the minimum delay over the most recent
498 interval measured usually in hours.
499 Under conditions of severe
500 delay, the filter corrects the apparent offset using the sign of
501 the offset and the difference between the apparent delay and
502 minimum delay.
503 The name of the filter reflects the negative (huff)
504 and positive (puff) correction, which depends on the sign of the
505 offset.
506 .Pp
507 The filter is activated by the
508 .Ic tinker
509 command and
510 .Cm huffpuff
511 keyword, as described in
512 .Xr ntp.conf 5 .
513         _END_MDOC_USAGE;
514 };
515
516 doc-section     = {
517   ds-type       = 'FILES';
518   ds-format     = 'mdoc';
519   ds-text       = <<- _END_MDOC_FILES
520 .Bl -tag -width /etc/ntp.drift -compact
521 .It Pa /etc/ntp.conf
522 the default name of the configuration file
523 .It Pa /etc/ntp.drift
524 the default name of the drift file
525 .It Pa /etc/ntp.keys
526 the default name of the key file
527 .El
528         _END_MDOC_FILES;
529 };
530
531 doc-section     = {
532   ds-type       = 'SEE ALSO';
533   ds-format     = 'mdoc';
534   ds-text       = <<- _END_MDOC_SEE_ALSO
535 .Xr ntp.conf 5 ,
536 .Xr ntpdate 1ntpdatemdoc ,
537 .Xr ntpdc 1ntpdcmdoc ,
538 .Xr ntpq 1ntpqmdoc ,
539 .Xr sntp 1sntpmdoc
540 .Pp
541 In addition to the manual pages provided,
542 comprehensive documentation is available on the world wide web
543 at
544 .Li http://www.ntp.org/ .
545 A snapshot of this documentation is available in HTML format in
546 .Pa /usr/share/doc/ntp .
547 .Rs
548 .%A David L. Mills
549 .%T Network Time Protocol (Version 1)
550 .%O RFC1059
551 .Re
552 .Rs
553 .%A David L. Mills
554 .%T Network Time Protocol (Version 2)
555 .%O RFC1119
556 .Re
557 .Rs
558 .%A David L. Mills
559 .%T Network Time Protocol (Version 3)
560 .%O RFC1305
561 .Re
562 .Rs
563 .%A David L. Mills
564 .%A J. Martin, Ed.
565 .%A J. Burbank
566 .%A W. Kasch
567 .%T Network Time Protocol Version 4: Protocol and Algorithms Specification
568 .%O RFC5905
569 .Re
570 .Rs
571 .%A David L. Mills
572 .%A B. Haberman, Ed.
573 .%T Network Time Protocol Version 4: Autokey Specification
574 .%O RFC5906
575 .Re
576 .Rs
577 .%A H. Gerstung
578 .%A C. Elliott
579 .%A B. Haberman, Ed.
580 .%T Definitions of Managed Objects for Network Time Protocol Version 4: (NTPv4)
581 .%O RFC5907
582 .Re
583 .Rs
584 .%A R. Gayraud
585 .%A B. Lourdelet
586 .%T Network Time Protocol (NTP) Server Option for DHCPv6
587 .%O RFC5908
588 .Re
589         _END_MDOC_SEE_ALSO;
590 };
591
592 doc-section     = {
593   ds-type       = 'BUGS';
594   ds-format     = 'mdoc';
595   ds-text       = <<- _END_MDOC_BUGS
596 The
597 .Nm
598 utility has gotten rather fat.
599 While not huge, it has gotten
600 larger than might be desirable for an elevated-priority
601 .Nm
602 running on a workstation, particularly since many of
603 the fancy features which consume the space were designed more with
604 a busy primary server, rather than a high stratum workstation in
605 mind.
606         _END_MDOC_BUGS;
607 };
608
609 doc-section     = {
610   ds-type       = 'NOTES';
611   ds-format     = 'mdoc';
612   ds-text       = <<- _END_MDOC_NOTES
613 Portions of this document came from FreeBSD.
614         _END_MDOC_NOTES;
615 };