]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - usr.sbin/ntp/doc/ntp.conf.5
This commit was generated by cvs2svn to compensate for changes in r145474,
[FreeBSD/FreeBSD.git] / usr.sbin / ntp / doc / ntp.conf.5
1 .\"
2 .\" $FreeBSD$
3 .\"
4 .Dd January 13, 2000
5 .Dt NTP.CONF 5
6 .Os
7 .Sh NAME
8 .Nm ntp.conf
9 .Nd Network Time Protocol (NTP) daemon configuration file
10 .Sh SYNOPSIS
11 .Nm /etc/ntp.conf
12 .Sh DESCRIPTION
13 The
14 .Nm
15 configuration file is read at initial startup by the
16 .Xr ntpd 8
17 daemon in order to specify the synchronization sources,
18 modes and other related information.
19 Usually, it is installed in the
20 .Pa /etc
21 directory,
22 but could be installed elsewhere
23 (see the daemon's
24 .Fl c
25 command line option).
26 .Pp
27 The file format is similar to other
28 .Ux
29 configuration files.
30 Comments begin with a
31 .Ql #
32 character and extend to the end of the line;
33 blank lines are ignored.
34 Configuration commands consist of an initial keyword
35 followed by a list of arguments,
36 some of which may be optional, separated by whitespace.
37 Commands may not be continued over multiple lines.
38 Arguments may be host names,
39 host addresses written in numeric, dotted-quad form,
40 integers, floating point numbers (when specifying times in seconds)
41 and text strings.
42 .Pp
43 The rest of this page describes the configuration and control options.
44 The
45 .Qq "Notes on Configuring NTP and Setting up a NTP Subnet"
46 page
47 (available as part of the HTML documentation
48 provided in
49 .Pa /usr/share/doc/ntp )
50 contains an extended discussion of these options.
51 In addition to the discussion of general
52 .Sx Configuration Options ,
53 there are sections describing the following supported functionality
54 and the options used to control it:
55 .Bl -bullet -offset indent
56 .It
57 .Sx Authentication Support
58 .It
59 .Sx Monitoring Support
60 .It
61 .Sx Access Control Support
62 .It
63 .Sx Reference Clock Support
64 .El
65 .Pp
66 Following these is a section describing
67 .Sx Miscellaneous Options .
68 While there is a rich set of options available,
69 the only required option is one or more
70 .Ic server ,
71 .Ic peer ,
72 .Ic broadcast
73 or
74 .Ic manycastclient
75 commands.
76 .Sh Configuration Support
77 Following is a description of the configuration commands in
78 NTPv4.
79 These commands have the same basic functions as in NTPv3 and
80 in some cases new functions and new arguments.
81 There are two
82 classes of commands, configuration commands that configure a
83 persistent association with a remote server or peer or reference
84 clock, and auxiliary commands that specify environmental variables
85 that control various related operations.
86 .Ss Configuration Commands
87 The various modes are determined by the command keyword and the
88 type of the required IP address.
89 Addresses are classed by type as
90 (s) a remote server or peer (IP class A, B and C), (b) the
91 broadcast address of a local interface, (m) a multicast address (IP
92 class D), or (r) a reference clock address (127.127.x.x).
93 Note that
94 only those options applicable to each command are listed below.
95 Use
96 of options not listed may not be caught as an error, but may result
97 in some weird and even destructive behavior.
98 .Bl -tag -width indent
99 .It Xo Ic server Ar address
100 .Op Cm key Ar key \&| Cm autokey
101 .Op Cm burst
102 .Op Cm iburst
103 .Op Cm version Ar version
104 .Op Cm prefer
105 .Op Cm minpoll Ar minpoll
106 .Op Cm maxpoll Ar maxpoll
107 .Xc
108 .It Xo Ic peer Ar address
109 .Op Cm key Ar key \&| Cm autokey
110 .Op Cm version Ar version
111 .Op Cm prefer
112 .Op Cm minpoll Ar minpoll
113 .Op Cm maxpoll Ar maxpoll
114 .Xc
115 .It Xo Ic broadcast Ar address
116 .Op Cm key Ar key \&| Cm autokey
117 .Op Cm version Ar version
118 .Op Cm prefer
119 .Op Cm minpoll Ar minpoll
120 .Op Cm ttl Ar ttl
121 .Xc
122 .It Xo Ic manycastclient Ar address
123 .Op Cm key Ar key \&| Cm autokey
124 .Op Cm version Ar version
125 .Op Cm prefer
126 .Op Cm minpoll Ar minpoll
127 .Op Cm maxpoll Ar maxpoll
128 .Op Cm ttl Ar ttl
129 .Xc
130 .El
131 .Pp
132 These four commands specify the time server name or address to
133 be used and the mode in which to operate.
134 The
135 .Ar address
136 can be
137 either a DNS name or an IP address in dotted-quad notation.
138 Additional information on association behavior can be found in the
139 .Qq "Association Management"
140 page.
141 .Bl -tag -width indent
142 .It Ic server
143 For type s and r addresses, this command mobilizes a persistent
144 client mode association with the specified remote server or local
145 radio clock.
146 In this mode the local clock can synchronized to the
147 remote server, but the remote server can never be synchronized to
148 the local clock.
149 This command should
150 .Em not
151 be used for type
152 b or m addresses.
153 .It Ic peer
154 For type s addresses (only), this command mobilizes a
155 persistent symmetric-active mode association with the specified
156 remote peer.
157 In this mode the local clock can be synchronized to
158 the remote peer or the remote peer can be synchronized to the local
159 clock.
160 This is useful in a network of servers where, depending on
161 various failure scenarios, either the local or remote peer may be
162 the better source of time.
163 This command should NOT be used for type
164 b, m or r addresses.
165 .It Ic broadcast
166 For type b and m addresses (only), this
167 command mobilizes a persistent broadcast mode association.
168 Multiple
169 commands can be used to specify multiple local broadcast interfaces
170 (subnets) and/or multiple multicast groups.
171 Note that local
172 broadcast messages go only to the interface associated with the
173 subnet specified, but multicast messages go to all interfaces.
174 In broadcast mode the local server sends periodic broadcast
175 messages to a client population at the
176 .Ar address
177 specified, which is usually the broadcast address on (one of) the
178 local network(s) or a multicast address assigned to NTP.
179 The IANA
180 has assigned the multicast group address 224.0.1.1 exclusively to
181 NTP, but other nonconflicting addresses can be used to contain the
182 messages within administrative boundaries.
183 Ordinarily, this
184 specification applies only to the local server operating as a
185 sender; for operation as a broadcast client, see the
186 .Ic broadcastclient
187 or
188 .Ic multicastclient
189 commands
190 below.
191 .It Ic manycastclient
192 For type m addresses (only), this command mobilizes a
193 manycast client mode association for the multicast address
194 specified.
195 In this case a specific address must be supplied which
196 matches the address used on the
197 .Ic manycastserver
198 command for
199 the designated manycast servers.
200 The NTP multicast address
201 224.0.1.1 assigned by the IANA should NOT be used, unless specific
202 means are taken to avoid spraying large areas of the Internet with
203 these messages and causing a possibly massive implosion of replies
204 at the sender.
205 The
206 .Ic manycastserver
207 command specifies that the local server
208 is to operate in client mode with the remote servers that are
209 discovered as the result of broadcast/multicast messages.
210 The
211 client broadcasts a request message to the group address associated
212 with the specified
213 .Ar address
214 and specifically enabled
215 servers respond to these messages.
216 The client selects the servers
217 providing the best time and continues as with the
218 .Ic server
219 command.
220 The remaining servers are discarded as if never
221 heard.
222 .El
223 .Pp
224 Options:
225 .Bl -tag -width indent
226 .It Cm autokey
227 All packets sent to and received from the server or peer are to
228 include authentication fields encrypted using the autokey scheme
229 described in
230 .Sx Authentication Options .
231 .It Cm burst
232 when the server is reachable and at each poll interval, send a
233 burst of eight packets instead of the usual one packet.
234 The spacing
235 between the first and the second packets is about 16s to allow a
236 modem call to complete, while the spacing between the remaining
237 packets is about 2s.
238 This is designed to improve timekeeping
239 quality with the
240 .Ic server
241 command and s
242 addresses.
243 .It Cm iburst
244 When the server is unreachable and at each poll interval, send
245 a burst of eight packets instead of the usual one.
246 As long as the
247 server is unreachable, the spacing between packets is about 16s to
248 allow a modem call to complete.
249 Once the server is reachable, the
250 spacing between packets is about 2s.
251 This is designed to speed the
252 initial synchronization acquisition with the
253 .Ic server
254 command and s addresses and when
255 .Xr ntpd 8
256 is started
257 with the
258 .Fl q
259 option.
260 .It Cm key Ar key
261 All packets sent to and received from the server or peer are to
262 include authentication fields encrypted using the specified
263 .Ar key
264 identifier with values from 1 to 65534, inclusive.
265 The
266 default is to include no encryption field.
267 .It Cm minpoll Ar minpoll
268 .It Cm maxpoll Ar maxpoll
269 These options specify the minimum and maximum poll intervals
270 for NTP messages, in seconds to the power of two.
271 The maximum poll
272 interval defaults to 10 (1,024 s), but can be increased by the
273 .Cm maxpoll
274 option to an upper limit of 17 (36.4 h).
275 The
276 minimum poll interval defaults to 6 (64 s), but can be decreased by
277 the
278 .Cm minpoll
279 option to a lower limit of 4 (16 s).
280 .It Cm prefer
281 Marks the server as preferred.
282 All other things being equal,
283 this host will be chosen for synchronization among a set of
284 correctly operating hosts.
285 See the
286 .Qq "Mitigation Rules and the prefer Keyword"
287 page for further
288 information.
289 .It Cm ttl Ar ttl
290 This option is used only with broadcast server and manycast
291 client modes.
292 It specifies the time-to-live
293 .Cm ttl
294 to
295 use on broadcast server and multicast server and the maximum
296 .Cm ttl
297 for the expanding ring search with manycast
298 client packets.
299 Selection of the proper value, which defaults to
300 127, is something of a black art and should be coordinated with the
301 network administrator.
302 .It Cm version Ar version
303 Specifies the version number to be used for outgoing NTP
304 packets.
305 Versions 1-4 are the choices, with version 4 the
306 default.
307 .El
308 .Ss Auxiliary Commands
309 .Bl -tag -width indent
310 .It Ic broadcastclient
311 This command enables reception of broadcast server messages to
312 any local interface (type b) address.
313 Upon receiving a message for
314 the first time, the broadcast client measures the nominal server
315 propagation delay using a brief client/server exchange with the
316 server, then enters the broadcast client mode, in which it
317 synchronizes to succeeding broadcast messages.
318 Note that, in order
319 to avoid accidental or malicious disruption in this mode, both the
320 server and client should operate using symmetric-key or public-key
321 authentication as described in
322 .Sx Authentication Options .
323 .It Ic manycastserver Ar address ...
324 This command enables reception of manycast client messages to
325 the multicast group address(es) (type m) specified.
326 At least one
327 address is required, but the NTP multicast address 224.0.1.1
328 assigned by the IANA should NOT be used, unless specific means are
329 taken to limit the span of the reply and avoid a possibly massive
330 implosion at the original sender.
331 Note that, in order to avoid
332 accidental or malicious disruption in this mode, both the server
333 and client should operate using symmetric-key or public-key
334 authentication as described in
335 .Sx Authentication Options .
336 .It Ic multicastclient Ar address ...
337 This command enables reception of multicast server messages to
338 the multicast group address(es) (type m) specified.
339 Upon receiving
340 a message for the first time, the multicast client measures the
341 nominal server propagation delay using a brief client/server
342 exchange with the server, then enters the broadcast client mode, in
343 which it synchronizes to succeeding multicast messages.
344 Note that,
345 in order to avoid accidental or malicious disruption in this mode,
346 both the server and client should operate using symmetric-key or
347 public-key authentication as described in
348 .Sx Authentication Options .
349 .El
350 .Sh Authentication Support
351 Authentication support allows the NTP client to verify that the
352 server is in fact known and trusted and not an intruder intending
353 accidentally or on purpose to masquerade as that server.
354 The NTPv3
355 specification RFC-1305 defines a scheme which provides
356 cryptographic authentication of received NTP packets.
357 Originally,
358 this was done using the Data Encryption Standard (DES) algorithm
359 operating in Cipher Block Chaining (CBC) mode, commonly called
360 DES-CBC.
361 Subsequently, this was augmented by the RSA Message Digest
362 5 (MD5) algorithm using a private key, commonly called keyed-MD5.
363 Either algorithm computes a message digest, or one-way hash, which
364 can be used to verify the server has the correct private key and
365 key identifier.
366 .Pp
367 NTPv4 retains the NTPv3 schemes, properly described as
368 symmetric-key cryptography and, in addition, provides a new Autokey
369 scheme based on public-key cryptography.
370 Public-key cryptography is
371 generally considered more secure than symmetric-key cryptography,
372 since the security is based on a private value which is generated
373 by each server and never revealed.
374 With Autokey all key
375 distribution and management functions involve only public values,
376 which considerably simplifies key distribution and storage.
377 .Pp
378 Authentication is configured separately for each association
379 using the
380 .Cm key
381 or
382 .Cm autokey
383 subcommands on the
384 .Ic peer ,
385 .Ic server ,
386 .Ic broadcast
387 and
388 .Ic manycastclient
389 commands as described in
390 .Sx Configuration Options .
391 The authentication
392 options described below specify the suite of keys, select the key
393 for each configured association and manage the configuration
394 operations.
395 .Pp
396 The
397 .Cm auth
398 flag controls whether new associations or
399 remote configuration commands require cryptographic authentication.
400 This flag can be set or reset by the
401 .Ic enable
402 and
403 .Ic disable
404 configuration commands and also by remote
405 configuration commands sent by a
406 .Xr ntpdc 8
407 program running in
408 another machine.
409 If this flag is enabled, which is the default
410 case, new broadcast client and symmetric passive associations and
411 remote configuration commands must be cryptographically
412 authenticated using either symmetric-key or public-key schemes.
413 If
414 this flag is disabled, these operations are effective even if not
415 cryptographic authenticated.
416 It should be understood that operating
417 in the latter mode invites a significant vulnerability where a
418 rogue hacker can seriously disrupt client timekeeping.
419 .Pp
420 In networks with firewalls and large numbers of broadcast
421 clients it may be acceptable to disable authentication, since that
422 avoids key distribution and simplifies network maintenance.
423 However, when the configuration file contains host names, or when a
424 server or client is configured remotely, host names are resolved
425 using the DNS and a separate name resolution process.
426 In order to
427 protect against bogus name server messages, name resolution
428 messages are authenticated using an internally generated key which
429 is normally invisible to the user.
430 However, if cryptographic
431 support is disabled, the name resolution process will fail.
432 This
433 can be avoided either by specifying IP addresses instead of host
434 names, which is generally inadvisable, or by enabling the flag for
435 name resolution and disabled it once the name resolution process is
436 complete.
437 .Pp
438 An attractive alternative where multicast support is available
439 is manycast mode, in which clients periodically troll for servers.
440 Cryptographic authentication in this mode uses public-key schemes
441 as described below.
442 The principle advantage of this manycast mode
443 is that potential servers need not be configured in advance, since
444 the client finds them during regular operation, and the
445 configuration files for all clients can be identical.
446 .Pp
447 In addition to the default symmetric-key cryptographic support,
448 support for public-key cryptography is available if the requisite
449 .Sy rsaref20
450 software distribution has been installed before
451 building the distribution.
452 Public-key cryptography provides secure
453 authentication of servers without compromising accuracy and
454 stability.
455 The security model and protocol schemes for both
456 symmetric-key and public-key cryptography are described below.
457 .Ss Symmetric-Key Scheme
458 The original RFC-1305 specification allows any one of possibly
459 65,534 keys, each distinguished by a 32-bit key identifier, to
460 authenticate an association.
461 The servers and clients involved must
462 agree on the key and key identifier to authenticate their messages.
463 Keys and related information are specified in a key file, usually
464 called
465 .Pa ntp.keys ,
466 which should be exchanged and stored
467 using secure procedures beyond the scope of the NTP protocol
468 itself.
469 Besides the keys used for ordinary NTP associations,
470 additional keys can be used as passwords for the
471 .Xr ntpq 8
472 and
473 .Xr ntpdc 8
474 utility programs.
475 .Pp
476 When
477 .Xr ntpd 8
478 is first started, it reads the key file
479 specified in the
480 .Ic keys
481 command and installs the keys in the
482 key cache.
483 However, the keys must be activated with the
484 .Ic trusted
485 command before use.
486 This allows, for instance, the
487 installation of possibly several batches of keys and then
488 activating or deactivating each batch remotely using
489 .Xr ntpdc 8 .
490 This also provides a revocation capability that can
491 be used if a key becomes compromised.
492 The
493 .Ic requestkey
494 command selects the key used as the password for the
495 .Xr ntpdc 8
496 utility, while the
497 .Ic controlkey
498 command selects the key used
499 as the password for the
500 .Xr ntpq 8
501 utility.
502 .Ss Public-Key Scheme
503 The original NTPv3 authentication scheme described in RFC-1305
504 continues to be supported; however, in NTPv4 an additional
505 authentication scheme called Autokey is available.
506 It uses MD5
507 message digest, RSA public-key signature and Diffie-Hellman key
508 agreement algorithms available from several sources, but not
509 included in the NTPv4 software distribution.
510 In order to be
511 effective, the
512 .Sy rsaref20
513 package must be installed as
514 described in the
515 .Pa README.rsa
516 file.
517 Once installed, the
518 configure and build process automatically detects it and compiles
519 the routines required.
520 The Autokey scheme has several modes of
521 operation corresponding to the various NTP modes supported.
522 RSA
523 signatures with timestamps are used in all modes to verify the
524 source of cryptographic values.
525 All modes use a special cookie
526 which can be computed independently by the client and server.
527 In
528 symmetric modes the cookie is constructed using the Diffie-Hellman
529 key agreement algorithm.
530 In other modes the cookie is constructed
531 from the IP addresses and a private value known only to the server.
532 All modes use in addition a variant of the S-KEY scheme, in which a
533 pseudo-random key list is generated and used in reverse order.
534 These schemes are described along with an executive summary,
535 current status, briefing slides and reading list, in the
536 .Qq "Autonomous Authentication"
537 page.
538 .Pp
539 The cryptographic values used by the Autokey scheme are
540 incorporated as a set of files generated by the
541 .Xr ntp-genkeys 8
542 program, including the
543 symmetric private keys, public/private key pair, and the agreement
544 parameters.
545 See the
546 .Xr ntp.keys 5
547 page for a description of
548 the formats of these files.
549 They contain cryptographic values
550 generated by the algorithms of the
551 .Sy rsaref20
552 package and
553 are in printable ASCII format.
554 All file names include the
555 timestamp, in NTP seconds, following the default names given below.
556 Since the file data are derived from random values seeded by the
557 system clock and the file name includes the timestamp, every
558 generation produces a different file and different file name.
559 .Pp
560 The
561 .Pa ntp.keys
562 file contains the DES/MD5 private keys.
563 It
564 must be distributed by secure means to other servers and clients
565 sharing the same security compartment and made visible only to
566 root.
567 While this file is not used with the Autokey scheme, it is
568 needed to authenticate some remote configuration commands used by
569 the
570 .Xr ntpdc 8 ,
571 .Xr ntpq 8
572 utilities.
573 The
574 .Pa ntpkey
575 file
576 contains the RSA private key.
577 It is useful only to the machine that
578 generated it and never shared with any other daemon or application
579 program, so must be made visible only to root.
580 .Pp
581 The
582 .Pa ntp_dh
583 file contains the agreement parameters,
584 which are used only in symmetric (active and passive) modes.
585 It is
586 necessary that both peers beginning a symmetric-mode association
587 share the same parameters, but it does not matter which
588 .Pa ntp_dh
589 file generates them.
590 If one of the peers contains
591 the parameters, the other peer obtains them using the Autokey
592 protocol.
593 If both peers contain the parameters, the most recent
594 copy is used by both peers.
595 If a peer does not have the parameters,
596 they will be requested by all associations, either configured or
597 not; but, none of the associations can proceed until one of them
598 has received the parameters.
599 Once loaded, the parameters can be
600 provided on request to other clients and servers.
601 The
602 .Pa ntp_dh
603 file can be also be distributed using insecure
604 means, since the data are public values.
605 .Pp
606 The
607 .Pa ntpkey_ Ns Ar host
608 file contains the RSA public
609 key, where
610 .Ar host
611 is the name of the host.
612 Each host
613 must have its own
614 .Pa ntpkey_ Ns Ar host
615 file, which is
616 normally provided to other hosts using the Autokey protocol.
617 Each
618 .Ic server
619 or
620 .Ic peer
621 association requires the public
622 key associated with the particular server or peer to be loaded
623 either directly from a local file or indirectly from the server
624 using the Autokey protocol.
625 These files can be widely distributed
626 and stored using insecure means, since the data are public
627 values.
628 .Pp
629 The optional
630 .Pa ntpkey_certif_ Ns Ar host
631 file contains
632 the PKI certificate for the host.
633 This provides a binding between
634 the host hame and RSA public key.
635 In the current implementation the
636 certificate is obtained by a client, if present, but the contents
637 are ignored.
638 .Pp
639 Due to the widespread use of interface-specific naming, the host
640 names used in configured and mobilized associations are determined
641 by the
642 .Ux
643 .Xr gethostname 3
644 library routine.
645 Both the
646 .Xr ntp-genkeys 8
647 program and the Autokey protocol derive the
648 name of the public key file using the name returned by this
649 routine.
650 While every server and client is required to load their
651 own public and private keys, the public keys for each client or
652 peer association can be obtained from the server or peer using the
653 Autokey protocol.
654 Note however, that at the current stage of
655 development the authenticity of the server or peer and the
656 cryptographic binding of the server name, address and public key is
657 not yet established by a certificate authority or web of trust.
658 .Ss Leapseconds Table
659 The NIST provides a table showing the epoch for all historic
660 occasions of leap second insertion since 1972.
661 The leapsecond table
662 shows each epoch of insertion along with the offset of
663 International Atomic Time (TAI) with respect to Coordinated
664 Universal Time (UTC), as disseminated by NTP.
665 The table can be
666 obtained directly from NIST national time servers using
667 FTP as the ASCII file
668 .Pa pub/leap-seconds .
669 .Pp
670 While not strictly a security function, the Autokey scheme
671 provides means to securely retrieve the leapsecond table from a
672 server or peer.
673 Servers load the leapsecond table directly from the
674 file specified in the
675 .Ic crypto
676 command, while clients can
677 load the table indirectly from the servers using the Autokey
678 protocol.
679 Once loaded, the table can be provided on request to
680 other clients and servers.
681 .Ss Key Management
682 All key files are installed by default in
683 .Pa /usr/local/etc ,
684 which is normally in a shared file system
685 in NFS-mounted networks and avoids installing them in each machine
686 separately.
687 The default can be overridden by the
688 .Ic keysdir
689 configuration command.
690 However, this is not a good place to install
691 the private key file, since each machine needs its own file.
692 A
693 suitable place to install it is in
694 .Pa /etc ,
695 which is normally
696 not in a shared file system.
697 .Pp
698 The recommended practice is to keep the timestamp extensions
699 when installing a file and to install a link from the default name
700 (without the timestamp extension) to the actual file.
701 This allows
702 new file generations to be activated simply by changing the link.
703 However,
704 .Xr ntpd 8
705 parses the link name when present to extract
706 the extension value and sends it along with the public key and host
707 name when requested.
708 This allows clients to verify that the file
709 and generation time are always current.
710 However, the actual
711 location of each file can be overridden by the
712 .Ic crypto
713 configuration command.
714 .Pp
715 All cryptographic keys and related parameters should be
716 regenerated on a periodic and automatic basis, like once per month.
717 The
718 .Xr ntp-genkeys 8
719 program uses the same timestamp extension
720 for all files generated at one time, so each generation is distinct
721 and can be readily recognized in monitoring data.
722 While a
723 public/private key pair must be generated by every server and
724 client, the public keys and agreement parameters do not need to be
725 explicitly copied to all machines in the same security compartment,
726 since they can be obtained automatically using the Autokey
727 protocol.
728 However, it is necessary that all primary servers have
729 the same agreement parameter file.
730 The recommended way to do this
731 is for one of the primary servers to generate that file and then
732 copy it to the other primary servers in the same compartment using
733 the
734 .Ux
735 .Xr rdist 1
736 command.
737 Future versions of the Autokey
738 protocol are to contain provisions for an agreement protocol to do
739 this automatically.
740 .Pp
741 Servers and clients can make a new generation in the following
742 way.
743 All machines have loaded the old generation at startup and are
744 operating normally.
745 At designated intervals, each machine generates
746 a new public/private key pair and makes links from the default file
747 names to the new file names.
748 The
749 .Xr ntpd 8
750 is then restarted
751 and loads the new generation, with result clients no longer can
752 authenticate correctly.
753 The Autokey protocol is designed so that
754 after a few minutes the clients time out and restart the protocol
755 from the beginning, with result the new generation is loaded and
756 operation continues as before.
757 A similar procedure can be used for
758 the agreement parameter file, but in this case precautions must be
759 take to be sure that all machines with this file have the same
760 copy.
761 .Ss Authentication Commands
762 .Bl -tag -width indent
763 .It Ic autokey Op Ar logsec
764 Specifies the interval between regenerations of the session key
765 list used with the Autokey protocol.
766 Note that the size of the key
767 list for each association depends on this interval and the current
768 poll interval.
769 The default value is 12 (4096 s or about 1.1 hours).
770 For poll intervals above the specified interval, a session key list
771 with a single entry will be regenerated for every message
772 sent.
773 .It Ic controlkey Ar key
774 Specifies the key identifier to use with the
775 .Xr ntpq 8
776 utility, which uses the standard
777 protocol defined in RFC-1305.
778 The
779 .Ar key
780 argument is
781 the key identifier for a trusted key, where the value can be in the
782 range 1 to 65534, inclusive.
783 .It Xo Ic crypto
784 .Op Cm flags Ar flags
785 .Op Cm privatekey Ar file
786 .Op Cm publickey Ar file
787 .Op Cm dhparms Ar file
788 .Op Cm leap Ar file
789 .Xc
790 This command requires the NTP daemon build process be
791 configured with the RSA library.
792 This command activates public-key
793 cryptography and loads the required RSA private and public key
794 files and the optional Diffie-Hellman agreement parameter file, if
795 present.
796 If one or more files are left unspecified, the default
797 names are used as described below.
798 Following are the
799 subcommands:
800 .Bl -tag -width indent
801 .It Cm privatekey Ar file
802 Specifies the location of the RSA private key file, which
803 otherwise defaults to
804 .Pa /usr/local/etc/ntpkey .
805 .It Cm publickey Ar file
806 Specifies the location of the RSA public key file, which
807 otherwise defaults to
808 .Pa /usr/local/etc/ntpkey_ Ns Ar host ,
809 where
810 .Ar host
811 is the name of the generating machine.
812 .It Cm dhparms Ar file
813 Specifies the location of the Diffie-Hellman parameters file,
814 which otherwise defaults to
815 .Pa /usr/local/etc/ntpkey_dh .
816 .It Cm leap Ar file
817 Specifies the location of the leapsecond table file, which
818 otherwise defaults to
819 .Pa /usr/local/etc/ntpkey_leap .
820 .El
821 .It Ic keys Ar keyfile
822 Specifies the location of the DES/MD5 private key file
823 containing the keys and key identifiers used by
824 .Xr ntpd 8 ,
825 .Xr ntpq 8
826 and
827 .Xr ntpdc 8
828 when operating in symmetric-key
829 mode.
830 .It Ic keysdir Ar path
831 This command requires the NTP daemon build process be
832 configured with the RSA library.
833 It specifies the default directory
834 path for the private key file, agreement parameters file and one or
835 more public key files.
836 The default when this command does not
837 appear in the configuration file is
838 .Pa /usr/local/etc .
839 .It Ic requestkey Ar key
840 Specifies the key identifier to use with the
841 .Xr ntpdc 8
842 utility program, which uses a
843 proprietary protocol specific to this implementation of
844 .Xr ntpd 8 .
845 The
846 .Ar key
847 argument is a key identifier
848 for the trusted key, where the value can be in the range 1 to
849 65534, inclusive.
850 .It Ic revoke Ar logsec
851 Specifies the interval between re-randomization of certain
852 cryptographic values used by the Autokey scheme, as a power of 2 in
853 seconds.
854 These values need to be updated frequently in order to
855 deflect brute-force attacks on the algorithms of the scheme;
856 however, updating some values is a relatively expensive operation.
857 The default interval is 16 (65,536 s or about 18 hours).
858 For poll
859 intervals above the specified interval, the values will be updated
860 for every message sent.
861 .It Ic trustedkey Ar key ...
862 Specifies the key identifiers which are trusted for the
863 purposes of authenticating peers with symmetric-key cryptography,
864 as well as keys used by the
865 .Xr ntpq 8
866 and
867 .Xr ntpdc 8
868 programs.
869 The authentication procedures require that both the local
870 and remote servers share the same key and key identifier for this
871 purpose, although different keys can be used with different
872 servers.
873 The
874 .Ar key
875 arguments are 32-bit unsigned
876 integers with values from 1 to 65,534.
877 .El
878 .Sh Monitoring Support
879 .Xr ntpd 8
880 includes a comprehensive monitoring facility suitable
881 for continuous, long term recording of server and client
882 timekeeping performance.
883 See the
884 .Ic statistics
885 command below
886 for a listing and example of each type of statistics currently
887 supported.
888 Statistic files are managed using file generation sets
889 and scripts in the
890 .Pa ./scripts
891 directory of this distribution.
892 Using
893 these facilities and
894 .Ux
895 .Xr cron 8
896 jobs, the data can be
897 automatically summarized and archived for retrospective analysis.
898 .Ss Monitoring Commands
899 .Bl -tag -width indent
900 .It Ic statistics Ar name ...
901 Enables writing of statistics records.
902 Currently, four kinds of
903 .Ar name
904 statistics are supported.
905 .Bl -tag -width indent
906 .It Cm loopstats
907 Enables recording of loop filter statistics information.
908 Each
909 update of the local clock outputs a line of the following form to
910 the file generation set named loopstats:
911 .Bd -literal
912 50935 75440.031 0.000006019 13.778190 0.000351733 0.013380 6
913 .Ed
914 .Pp
915 The first two fields show the date (Modified Julian Day) and
916 time (seconds and fraction past UTC midnight).
917 The next five fields
918 show time offset (seconds), frequency offset (parts per million -
919 PPM), RMS jitter (seconds), Allan deviation (PPM) and clock
920 discipline time constant.
921 .It Cm peerstats
922 Enables recording of peer statistics information.
923 This includes
924 statistics records of all peers of a NTP server and of special
925 signals, where present and configured.
926 Each valid update appends a
927 line of the following form to the current element of a file
928 generation set named peerstats:
929 .Bd -literal
930 48773 10847.650 127.127.4.1 9714 -0.001605 0.00000 0.00142
931 .Ed
932 .Pp
933 The first two fields show the date (Modified Julian Day) and
934 time (seconds and fraction past UTC midnight).
935 The next two fields
936 show the peer address in dotted-quad notation and status,
937 respectively.
938 The status field is encoded in hex in the format
939 described in Appendix A of the NTP specification RFC 1305.
940 The
941 final three fields show the offset, delay and RMS jitter, all in
942 seconds.
943 .It Cm clockstats
944 Enables recording of clock driver statistics information.
945 Each
946 update received from a clock driver appends a line of the following
947 form to the file generation set named clockstats:
948 .Bd -literal
949 49213 525.624 127.127.4.1 93 226 00:08:29.606 D
950 .Ed
951 .Pp
952 The first two fields show the date (Modified Julian Day) and
953 time (seconds and fraction past UTC midnight).
954 The next field shows
955 the clock address in dotted-quad notation.
956 The final field shows
957 the last timecode received from the clock in decoded ASCII format,
958 where meaningful.
959 In some clock drivers a good deal of additional
960 information can be gathered and displayed as well.
961 See information
962 specific to each clock for further details.
963 .It Cm rawstats
964 Enables recording of raw-timestamp statistics information.
965 This
966 includes statistics records of all peers of a NTP server and of
967 special signals, where present and configured.
968 Each NTP message
969 received from a peer or clock driver appends a line of the
970 following form to the file generation set named rawstats:
971 .Bd -literal
972 50928 2132.543 128.4.1.1 128.4.1.20 3102453281.584327000 3102453281.58622800031 02453332.540806000 3102453332.541458000
973 .Ed
974 The first two fields show the date (Modified Julian Day) and
975 time (seconds and fraction past UTC midnight).
976 The next two fields
977 show the remote peer or clock address followed by the local address
978 in dotted-quad notation.
979 The final four fields show the originate,
980 receive, transmit and final NTP timestamps in order.
981 The timestamp
982 values are as received and before processing by the various data
983 smoothing and mitigation algorithms.
984 .El
985 .It Ic statsdir Ar directory_path
986 Indicates the full path of a directory where statistics files
987 should be created (see below).
988 This keyword allows the (otherwise
989 constant)
990 .Ic filegen
991 filename prefix to be modified for file
992 generation sets, which is useful for handling statistics logs.
993 .It Xo Ic filegen Ar name
994 .Op Cm file Ar filename
995 .Op Cm type Ar typename
996 .Op Cm link \&| Cm nolink
997 .Op Cm enable \&| Cm disable
998 .Xc
999 Configures setting of generation file set
1000 .Ar name .
1001 Generation file sets provide a means for handling files that are
1002 continuously growing during the lifetime of a server.
1003 Server
1004 statistics are a typical example for such files.
1005 Generation file
1006 sets provide access to a set of files used to store the actual
1007 data.
1008 At any time at most one element of the set is being written
1009 to.
1010 The type given specifies when and how data will be directed to
1011 a new element of the set.
1012 This way, information stored in elements
1013 of a file set that are currently unused are available for
1014 administrational operations without the risk of disturbing the
1015 operation of
1016 .Xr ntpd 8 .
1017 (Most important: they can be removed to
1018 free space for new data produced.)
1019 Note that this command can be sent from the
1020 .Xr ntpdc 8
1021 program running at a remote location.
1022 .Bl -tag -width indent
1023 .It Ar name
1024 This is the type of the statistics records, as shown in the
1025 .Ic statistics
1026 command.
1027 .It Cm file Ar filename
1028 This is the file name for the statistics records.
1029 Filenames of
1030 set members are built from three concatenated elements
1031 prefix, filename and
1032 suffix:
1033 .Bl -tag -width indent
1034 .It prefix
1035 This is a constant filename path.
1036 It is not subject to
1037 modifications via the
1038 .Ic filegen
1039 option.
1040 It is defined by the
1041 server, usually specified as a compile-time constant.
1042 It may,
1043 however, be configurable for individual file generation sets via
1044 other commands.
1045 For example, the prefix used with
1046 .Cm loopstats
1047 and
1048 .Cm peerstats
1049 generation can be
1050 configured using the
1051 .Ic statsdir
1052 option explained above.
1053 .It filename
1054 This string is directly concatenated to the prefix mentioned
1055 above (no intervening
1056 .Ql /
1057 (slash)).
1058 This can be modified
1059 using the
1060 .Ar file
1061 argument to the
1062 .Ic filegen
1063 statement.
1064 No
1065 .Ql \&..
1066 elements are allowed in this component to prevent
1067 filenames referring to parts outside the file system hierarchy
1068 denoted by prefix.
1069 .It suffix
1070 This part is reflects individual elements of a file set.
1071 It is
1072 generated according to the type of a file set.
1073 .El
1074 .It Cm type Ar typename
1075 A file generation set is characterized by its type.
1076 The
1077 following types are supported:
1078 .Bl -tag -width indent
1079 .It none
1080 The file set is actually a single plain file.
1081 .It pid
1082 One element of file set is used per incarnation of a
1083 .Xr ntpd 8
1084 server.
1085 This type does not perform any changes to
1086 file set members during runtime, however it provides an easy way of
1087 separating files belonging to different
1088 .Xr ntpd 8
1089 server
1090 incarnations.
1091 The set member filename is built by appending a
1092 .Ql \&.
1093 (dot) to concatenated prefix and filename
1094 strings, and appending the decimal representation of the process ID
1095 of the
1096 .Xr ntpd 8
1097 server process.
1098 .It day
1099 One file generation set element is created per day.
1100 A day is
1101 defined as the period between 00:00 and 24:00 UTC.
1102 The file set
1103 member suffix consists of a
1104 .Ql \&.
1105 (dot) and a day
1106 specification in the form
1107 .Ar YYYYMMdd .
1108 .Ar YYYY
1109 is a 4-digit year
1110 number (e.g., 1992).
1111 .Ar MM
1112 is a two digit month number.
1113 .Ar dd
1114 is a two digit day number.
1115 Thus, all information
1116 written at 10 December 1992 would end up in a file named
1117 .Sm off
1118 .Pa Ar prefix / Ar filename / 19921210 .
1119 .Sm on
1120 .It week
1121 Any file set member contains data related to a certain week of
1122 a year.
1123 The term week is defined by computing day-of-year modulo 7.
1124 Elements of such a file generation set are distinguished by
1125 appending the following suffix to the file set filename base: A
1126 dot, a 4-digit year number, the letter
1127 Ql W ,
1128 and a 2-digit
1129 week number.
1130 For example, information from January, 10th 1992 would
1131 end up in a file with suffix
1132 .Pa .1992W1 .
1133 .It month
1134 One generation file set element is generated per month.
1135 The
1136 file name suffix consists of a dot, a 4-digit year number, and a
1137 2-digit month.
1138 .It year
1139 One generation file element is generated per year.
1140 The filename
1141 suffix consists of a dot and a 4 digit year number.
1142 .It age
1143 This type of file generation sets changes to a new element of
1144 the file set every 24 hours of server operation.
1145 The filename
1146 suffix consists of a dot, the letter
1147 .Ql a ,
1148 and an 8-digit
1149 number.
1150 This number is taken to be the number of seconds the server
1151 is running at the start of the corresponding 24-hour period.
1152 Information is only written to a file generation by specifying
1153 .Ic enable ;
1154 output is prevented by specifying
1155 .Ic disable .
1156 .El
1157 .It Cm link \&| Cm nolink
1158 It is convenient to be able to access the current element of a
1159 file generation set by a fixed name.
1160 This feature is enabled by
1161 specifying
1162 .Cm link
1163 and disabled using
1164 .Cm nolink .
1165 If
1166 .Cm link
1167 is specified, a hard link from the current file set
1168 element to a file without suffix is created.
1169 When there is already
1170 a file with this name and the number of links of this file is one,
1171 it is renamed appending a dot, the letter
1172 .Ql C ,
1173 and the pid
1174 of the
1175 .Xr ntpd 8
1176 server process.
1177 When the number of links is
1178 greater than one, the file is unlinked.
1179 This allows the current
1180 file to be accessed by a constant name.
1181 .It Cm enable \&| Cm disable
1182 Enables or disables the recording function.
1183 .El
1184 .El
1185 .Sh Access Control Support
1186 .Xr ntpd 8
1187 implements a general purpose address-and-mask based
1188 restriction list.
1189 The list is sorted by address and by mask, and
1190 the list is searched in this order for matches, with the last match
1191 found defining the restriction flags associated with the incoming
1192 packets.
1193 The source address of incoming packets is used for the
1194 match, with the 32- bit address being and'ed with the mask
1195 associated with the restriction entry and then compared with the
1196 entry's address (which has also been and'ed with the mask) to look
1197 for a match.
1198 Additional information and examples can be found in the
1199 .Qq "Notes on Configuring NTP and Setting up a NTP Subnet"
1200 page.
1201 .Pp
1202 The restriction facility was implemented in conformance with the
1203 access policies for the original NSFnet backbone time servers.
1204 While this facility may be otherwise useful for keeping unwanted or
1205 broken remote time servers from affecting your own, it should not
1206 be considered an alternative to the standard NTP authentication
1207 facility.
1208 Source address based restrictions are easily circumvented
1209 by a determined cracker.
1210 .Ss The Kiss-of-Death Packet
1211 Ordinarily, packets denied service are simply dropped with no
1212 further action except incrementing statistics counters.
1213 Sometimes a
1214 more proactive response is needed, such as a server message that
1215 explicitly requests the client to stop sending and leave a message
1216 for the system operator.
1217 A special packet format has been created
1218 for this purpose called the kiss-of-death packet.
1219 If the
1220 .Cm kod
1221 flag is set and either service is denied or the client
1222 limit is exceeded, the server returns the packet and sets the
1223 leap bits unsynchronized, stratum zero and the ASCII string "DENY"
1224 in the reference source identifier field.
1225 If the
1226 .Cm kod
1227 flag
1228 is not set, the server simply drops the packet.
1229 .Pp
1230 A client or peer receiving a kiss-of-death packet performs a set
1231 of sanity checks to minimize security exposure.
1232 If this is the
1233 first packet received from the server, the client assumes an access
1234 denied condition at the server.
1235 It updates the stratum and
1236 reference identifier peer variables and sets the access denied
1237 (test 4) bit in the peer flash variable.
1238 If this bit is set, the
1239 client sends no packets to the server.
1240 If this is not the first
1241 packet, the client assumes a client limit condition at the server,
1242 but does not update the peer variables.
1243 In either case, a message
1244 is sent to the system log.
1245 .Ss Access Control Commands
1246 .Bl -tag -width indent
1247 .It Xo Ic restrict numeric_address
1248 .Op Cm mask Ar numeric_mask
1249 .Op Ar flag ...
1250 .Xc
1251 The
1252 .Ar numeric_address
1253 argument, expressed in
1254 dotted-quad form, is the address of a host or network.
1255 The
1256 .Cm mask ,
1257 also expressed in dotted-quad form,
1258 defaults to 255.255.255.255, meaning that the
1259 .Ar numeric_address
1260 is treated as the address of an
1261 individual host.
1262 A default entry (address 0.0.0.0, mask
1263 0.0.0.0) is always included and, given the sort algorithm,
1264 is always the first entry in the list.
1265 Note that, while
1266 .Ar numeric_address
1267 is normally given in dotted-quad
1268 format, the text string
1269 .Ql default ,
1270 with no mask option, may
1271 be used to indicate the default entry.
1272 In the current implementation,
1273 .Cm flag
1274 always
1275 restricts access, i.e., an entry with no flags indicates that free
1276 access to the server is to be given.
1277 The flags are not orthogonal,
1278 in that more restrictive flags will often make less restrictive
1279 ones redundant.
1280 The flags can generally be classed into two
1281 categories, those which restrict time service and those which
1282 restrict informational queries and attempts to do run-time
1283 reconfiguration of the server.
1284 One or more of the following flags
1285 may be specified:
1286 .Bl -tag -width indent
1287 .It Cm kod
1288 If access is denied, send a kiss-of-death packet.
1289 .It Cm ignore
1290 Ignore all packets from hosts which match this entry.
1291 If this
1292 flag is specified neither queries nor time server polls will be
1293 responded to.
1294 .It Cm noquery
1295 Ignore all NTP mode 6 and 7 packets (i.e., information queries
1296 and configuration requests) from the source.
1297 Time service is not
1298 affected.
1299 .It Cm nomodify
1300 Ignore all NTP mode 6 and 7 packets which attempt to modify the
1301 state of the server (i.e., run time reconfiguration).
1302 Queries which
1303 return information are permitted.
1304 .It Cm notrap
1305 Decline to provide mode 6 control message trap service to
1306 matching hosts.
1307 The trap service is a subsystem of the mode 6
1308 control message protocol which is intended for use by remote event
1309 logging programs.
1310 .It Cm lowpriotrap
1311 Declare traps set by matching hosts to be low priority.
1312 The
1313 number of traps a server can maintain is limited (the current limit
1314 is 3).
1315 Traps are usually assigned on a first come, first served
1316 basis, with later trap requestors being denied service.
1317 This flag
1318 modifies the assignment algorithm by allowing low priority traps to
1319 be overridden by later requests for normal priority traps.
1320 .It Cm noserve
1321 Ignore NTP packets whose mode is other than 6 or 7.
1322 In effect,
1323 time service is denied, though queries may still be permitted.
1324 .It Cm nopeer
1325 Provide stateless time service to polling hosts, but do not
1326 allocate peer memory resources to these hosts even if they
1327 otherwise might be considered useful as future synchronization
1328 partners.
1329 .It Cm notrust
1330 Treat these hosts normally in other respects, but never use
1331 them as synchronization sources.
1332 .It Cm limited
1333 These hosts are subject to limitation of number of clients from
1334 the same net.
1335 Net in this context refers to the IP notion of net
1336 (class A, class B, class C, etc.).
1337 Only the first
1338 .Va client_limit
1339 hosts that have shown up at the server and
1340 that have been active during the last
1341 .Va client_limit_period
1342 seconds are accepted.
1343 Requests from other clients from the same net
1344 are rejected.
1345 Only time request packets are taken into account.
1346 Query packets sent by the
1347 .Xr ntpq 8
1348 and
1349 .Xr ntpdc 8
1350 programs
1351 are not subject to these limits.
1352 A history of clients is kept using
1353 the monitoring capability of
1354 .Xr ntpd 8 .
1355 Thus, monitoring is
1356 always active as long as there is a restriction entry with the
1357 .Cm limited
1358 flag.
1359 .It Cm ntpport
1360 This is actually a match algorithm modifier, rather than a
1361 restriction flag.
1362 Its presence causes the restriction entry to be
1363 matched only if the source port in the packet is the standard NTP
1364 UDP port (123).
1365 Both
1366 .Cm ntpport
1367 and
1368 .Cm non-ntpport
1369 may
1370 be specified.
1371 The
1372 .Cm ntpport
1373 is considered more specific and
1374 is sorted later in the list.
1375 .It Cm version
1376 Ignore these hosts if not the current NTP version.
1377 .El
1378 .Pp
1379 Default restriction list entries, with the flags
1380 .Cm ignore ,
1381 .Cm interface ,
1382 .Cm ntpport ,
1383 for each of the local host's interface
1384 addresses are inserted into the table at startup to prevent the
1385 server from attempting to synchronize to its own time.
1386 A default
1387 entry is also always present, though if it is otherwise
1388 unconfigured; no flags are associated with the default entry (i.e.,
1389 everything besides your own NTP server is unrestricted).
1390 .It Ic clientlimit Ar limit
1391 Set the
1392 .Va client_limit
1393 variable, which limits the number
1394 of simultaneous access-controlled clients.
1395 The default value for
1396 this variable is 3.
1397 .It Ic clientperiod Ar period
1398 Set the
1399 .Va client_limit_period
1400 variable, which specifies
1401 the number of seconds after which a client is considered inactive
1402 and thus no longer is counted for client limit restriction.
1403 The
1404 default value for this variable is 3600 seconds.
1405 .El
1406 .Sh Reference Clock Support
1407 The NTP Version 4 daemon supports some three dozen different radio,
1408 satellite and modem reference clocks plus a special pseudo-clock
1409 used for backup or when no other clock source is available.
1410 Detailed descriptions of individual device drivers and options can
1411 be found in the
1412 .Qq "Reference Clock Drivers"
1413 page
1414 (available as part of the HTML documentation
1415 provided in
1416 .Pa /usr/share/doc/ntp ) .
1417 Additional information can be found in the pages linked
1418 there, including the
1419 .Qq "Debugging Hints for Reference Clock Drivers"
1420 and
1421 .Qq "How To Write a Reference Clock Driver"
1422 pages.
1423 In addition, support for a PPS
1424 signal is available as described in the
1425 .Qq "Pulse-per-second (PPS) Signal Interfacing"
1426 page.
1427 Many
1428 drivers support special line discipline/streams modules which can
1429 significantly improve the accuracy using the driver.
1430 These are
1431 described in the
1432 .Qq "Line Disciplines and Streams Drivers"
1433 page.
1434 .Pp
1435 A reference clock will generally (though not always) be a radio
1436 timecode receiver which is synchronized to a source of standard
1437 time such as the services offered by the NRC in Canada and NIST and
1438 USNO in the US.
1439 The interface between the computer and the timecode
1440 receiver is device dependent, but is usually a serial port.
1441 A
1442 device driver specific to each reference clock must be selected and
1443 compiled in the distribution; however, most common radio, satellite
1444 and modem clocks are included by default.
1445 Note that an attempt to
1446 configure a reference clock when the driver has not been compiled
1447 or the hardware port has not been appropriately configured results
1448 in a scalding remark to the system log file, but is otherwise non
1449 hazardous.
1450 .Pp
1451 For the purposes of configuration,
1452 .Xr ntpd 8
1453 treats
1454 reference clocks in a manner analogous to normal NTP peers as much
1455 as possible.
1456 Reference clocks are identified by a syntactically
1457 correct but invalid IP address, in order to distinguish them from
1458 normal NTP peers.
1459 Reference clock addresses are of the form
1460 .Sm off
1461 .Li 127.127. Ar t . Ar u ,
1462 .Sm on
1463 where
1464 .Ar t
1465 is an integer
1466 denoting the clock type and
1467 .Ar u
1468 indicates the unit
1469 number in the range 0-3.
1470 While it may seem overkill, it is in fact
1471 sometimes useful to configure multiple reference clocks of the same
1472 type, in which case the unit numbers must be unique.
1473 .Pp
1474 The
1475 .Ic server
1476 command is used to configure a reference
1477 clock, where the
1478 .Ar address
1479 argument in that command
1480 is the clock address.
1481 The
1482 .Cm key ,
1483 .Cm version
1484 and
1485 .Cm ttl
1486 options are not used for reference clock support.
1487 The
1488 .Cm mode
1489 option is added for reference clock support, as
1490 described below.
1491 The
1492 .Cm prefer
1493 option can be useful to
1494 persuade the server to cherish a reference clock with somewhat more
1495 enthusiasm than other reference clocks or peers.
1496 Further
1497 information on this option can be found in the
1498 .Qq "Mitigation Rules and the prefer Keyword"
1499 page.
1500 The
1501 .Cm minpoll
1502 and
1503 .Cm maxpoll
1504 options have
1505 meaning only for selected clock drivers.
1506 See the individual clock
1507 driver document pages for additional information.
1508 .Pp
1509 The
1510 .Ic fudge
1511 command is used to provide additional
1512 information for individual clock drivers and normally follows
1513 immediately after the
1514 .Ic server
1515 command.
1516 The
1517 .Ar address
1518 argument specifies the clock address.
1519 The
1520 .Cm refid
1521 and
1522 .Cm stratum
1523 options can be used to
1524 override the defaults for the device.
1525 There are two optional
1526 device-dependent time offsets and four flags that can be included
1527 in the
1528 .Ic fudge
1529 command as well.
1530 .Pp
1531 The stratum number of a reference clock is by default zero.
1532 Since the
1533 .Xr ntpd 8
1534 daemon adds one to the stratum of each
1535 peer, a primary server ordinarily displays an external stratum of
1536 one.
1537 In order to provide engineered backups, it is often useful to
1538 specify the reference clock stratum as greater than zero.
1539 The
1540 .Cm stratum
1541 option is used for this purpose.
1542 Also, in cases
1543 involving both a reference clock and a pulse-per-second (PPS)
1544 discipline signal, it is useful to specify the reference clock
1545 identifier as other than the default, depending on the driver.
1546 The
1547 .Cm refid
1548 option is used for this purpose.
1549 Except where noted,
1550 these options apply to all clock drivers.
1551 .Ss Reference Clock Commands
1552 .Bl -tag -width indent
1553 .It Xo Ic server
1554 .Sm off
1555 .Li 127.127. Ar t . Ar u
1556 .Sm on
1557 .Op Cm prefer
1558 .Op Cm mode Ar int
1559 .Op Cm minpoll Ar int
1560 .Op Cm maxpoll Ar int
1561 .Xc
1562 This command can be used to configure reference clocks in
1563 special ways.
1564 The options are interpreted as follows:
1565 .Bl -tag -width indent
1566 .It Cm prefer
1567 Marks the reference clock as preferred.
1568 All other things being
1569 equal, this host will be chosen for synchronization among a set of
1570 correctly operating hosts.
1571 See the
1572 .Qq "Mitigation Rules and the prefer Keyword"
1573 page for further
1574 information.
1575 .It Cm mode Ar int
1576 Specifies a mode number which is interpreted in a
1577 device-specific fashion.
1578 For instance, it selects a dialing
1579 protocol in the ACTS driver and a device subtype in the
1580 parse
1581 drivers.
1582 .It Cm minpoll Ar int
1583 .It Cm maxpoll Ar int
1584 These options specify the minimum and maximum polling interval
1585 for reference clock messages, in seconds to the power of two.
1586 For
1587 most directly connected reference clocks, both
1588 .Cm minpoll
1589 and
1590 .Cm maxpoll
1591 default to 6 (64 s).
1592 For modem reference clocks,
1593 .Cm minpoll
1594 defaults to 10 (17.1 m) and
1595 .Cm maxpoll
1596 defaults to 14 (4.5 h).
1597 The allowable range is 4 (16 s) to 17 (36.4 h) inclusive.
1598 .El
1599 .It Xo Ic fudge
1600 .Sm off
1601 .Li 127.127. Ar t . Ar u
1602 .Sm on
1603 .Op Cm time1 Ar sec
1604 .Op Cm time2 Ar sec
1605 .Op Cm stratum Ar int
1606 .Op Cm refid Ar string
1607 .Op Cm mode Ar int
1608 .Op Cm flag1 Cm 0 \&| Cm 1
1609 .Op Cm flag2 Cm 0 \&| Cm 1
1610 .Op Cm flag3 Cm 0 \&| Cm 1
1611 .Op Cm flag4 Cm 0 \&| Cm 1
1612 .Xc
1613 This command can be used to configure reference clocks in
1614 special ways.
1615 It must immediately follow the
1616 .Ic server
1617 command which configures the driver.
1618 Note that the same capability
1619 is possible at run time using the
1620 .Xr ntpdc 8
1621 program.
1622 The options are interpreted as
1623 follows:
1624 .Bl -tag -width indent
1625 .It Cm time1 Ar sec
1626 Specifies a constant to be added to the time offset produced by
1627 the driver, a fixed-point decimal number in seconds.
1628 This is used
1629 as a calibration constant to adjust the nominal time offset of a
1630 particular clock to agree with an external standard, such as a
1631 precision PPS signal.
1632 It also provides a way to correct a
1633 systematic error or bias due to serial port or operating system
1634 latencies, different cable lengths or receiver internal delay.
1635 The
1636 specified offset is in addition to the propagation delay provided
1637 by other means, such as internal DIPswitches.
1638 Where a calibration
1639 for an individual system and driver is available, an approximate
1640 correction is noted in the driver documentation pages.
1641 Note: in order to facilitate calibration when more than one
1642 radio clock or PPS signal is supported, a special calibration
1643 feature is available.
1644 It takes the form of an argument to the
1645 .Ic enable
1646 command described in
1647 .Sx Miscellaneous Options
1648 page and operates as described in the
1649 .Qq "Reference Clock Drivers"
1650 page.
1651 .It Cm time2 Ar secs
1652 Specifies a fixed-point decimal number in seconds, which is
1653 interpreted in a driver-dependent way.
1654 See the descriptions of
1655 specific drivers in the
1656 .Qq "reference clock drivers"
1657 page.
1658 .It Cm stratum Ar int
1659 Specifies the stratum number assigned to the driver, an integer
1660 between 0 and 15.
1661 This number overrides the default stratum number
1662 ordinarily assigned by the driver itself, usually zero.
1663 .It Cm refid Ar string
1664 Specifies an ASCII string of from one to four characters which
1665 defines the reference identifier used by the driver.
1666 This string
1667 overrides the default identifier ordinarily assigned by the driver
1668 itself.
1669 .It Cm mode Ar int
1670 Specifies a mode number which is interpreted in a
1671 device-specific fashion.
1672 For instance, it selects a dialing
1673 protocol in the ACTS driver and a device subtype in the
1674 parse
1675 drivers.
1676 .It Cm flag1 Cm 0 \&| Cm 1
1677 .It Cm flag2 Cm 0 \&| Cm 1
1678 .It Cm flag3 Cm 0 \&| Cm 1
1679 .It Cm flag4 Cm 0 \&| Cm 1
1680 These four flags are used for customizing the clock driver.
1681 The
1682 interpretation of these values, and whether they are used at all,
1683 is a function of the particular clock driver.
1684 However, by
1685 convention
1686 .Cm flag4
1687 is used to enable recording monitoring
1688 data to the
1689 .Cm clockstats
1690 file configured with the
1691 .Ic filegen
1692 command.
1693 Further information on the
1694 .Ic filegen
1695 command can be found in
1696 .Sx Monitoring Options .
1697 .El
1698 .El
1699 .Sh Miscellaneous Options
1700 .Bl -tag -width indent
1701 .It Ic broadcastdelay Ar seconds
1702 The broadcast and multicast modes require a special calibration
1703 to determine the network delay between the local and remote
1704 servers.
1705 Ordinarily, this is done automatically by the initial
1706 protocol exchanges between the client and server.
1707 In some cases,
1708 the calibration procedure may fail due to network or server access
1709 controls, for example.
1710 This command specifies the default delay to
1711 be used under these circumstances.
1712 Typically (for Ethernet), a
1713 number between 0.003 and 0.007 seconds is appropriate.
1714 The default
1715 when this command is not used is 0.004 seconds.
1716 .It Ic driftfile Ar driftfile
1717 This command specifies the name of the file used to record the
1718 frequency offset of the local clock oscillator.
1719 If the file exists,
1720 it is read at startup in order to set the initial frequency offset
1721 and then updated once per hour with the current frequency offset
1722 computed by the daemon.
1723 If the file does not exist or this command
1724 is not given, the initial frequency offset is assumed zero.
1725 In this
1726 case, it may take some hours for the frequency to stabilize and the
1727 residual timing errors to subside.
1728 .Pp
1729 The file format consists of a single line containing a single
1730 floating point number, which records the frequency offset measured
1731 in parts-per-million (PPM).
1732 The file is updated by first writing
1733 the current drift value into a temporary file and then renaming
1734 this file to replace the old version.
1735 This implies that
1736 .Xr ntpd 8
1737 must have write permission for the directory the
1738 drift file is located in, and that file system links, symbolic or
1739 otherwise, should be avoided.
1740 .It Xo Ic enable
1741 .Oo
1742 .Cm auth | Cm bclient |
1743 .Cm calibrate | Cm kernel |
1744 .Cm monitor | Cm ntp |
1745 .Cm stats
1746 .Oc
1747 .Xc
1748 .It Xo Ic disable
1749 .Oo
1750 .Cm auth | Cm bclient |
1751 .Cm calibrate | Cm kernel |
1752 .Cm monitor | Cm ntp |
1753 .Cm stats
1754 .Oc
1755 .Xc
1756 Provides a way to enable or disable various server options.
1757 Flags not mentioned are unaffected.
1758 Note that all of these flags
1759 can be controlled remotely using the
1760 .Xr ntpdc 8
1761 utility program.
1762 .Bl -tag -width indent
1763 .It Cm bclient
1764 When enabled, this is identical to the
1765 .Ic broadcastclient
1766 command.
1767 The default for this flag is
1768 .Ic disable .
1769 .It Cm calibrate
1770 Enables the calibration facility, which automatically adjusts
1771 the
1772 .Ic time1
1773 values for each clock driver to display the same
1774 offset as the currently selected source or kernel discipline
1775 signal.
1776 See the
1777 .Qq "Reference Clock Drivers"
1778 page
1779 for further information.
1780 The default for this flag is
1781 .Ic disable .
1782 .It Cm kernel
1783 Enables the precision-time kernel support for the
1784 .Xr adjtime 2
1785 system call, if implemented.
1786 Ordinarily,
1787 support for this routine is detected automatically when the NTP
1788 daemon is compiled, so it is not necessary for the user to worry
1789 about this flag.
1790 It is provided primarily so that this support
1791 can be disabled during kernel development.
1792 The default for this
1793 flag is
1794 .Ic enable .
1795 .It Cm monitor
1796 Enables the monitoring facility.
1797 See the
1798 .Xr ntpdc 8
1799 program
1800 and the
1801 .Ic monlist
1802 command or further information.
1803 The
1804 default for this flag is
1805 .Ic enable .
1806 .It Cm ntp
1807 Enables the server to adjust its local clock by means of NTP.
1808 If disabled, the local clock free-runs at its intrinsic time and
1809 frequency offset.
1810 This flag is useful in case the local clock is
1811 controlled by some other device or protocol and NTP is used only to
1812 provide synchronization to other clients.
1813 In this case, the local
1814 clock driver can be used to provide this function and also certain
1815 time variables for error estimates and leap-indicators.
1816 See the
1817 .Qq "Reference Clock Drivers"
1818 page for further
1819 information.
1820 The default for this flag is
1821 .Ic enable .
1822 .It Cm stats
1823 Enables the statistics facility.
1824 See the
1825 .Qq "Monitoring Options"
1826 page for further information.
1827 The default for this flag is
1828 .Ic enable .
1829 .El
1830 .It Ic logconfig Ar configkeyword
1831 This command controls the amount and type of output written to
1832 the system
1833 .Xr syslog 3
1834 facility or the alternate
1835 .Ic logfile
1836 log file.
1837 By default, all output is turned on.
1838 All
1839 .Ar configkeyword
1840 keywords can be prefixed with
1841 .Ql = ,
1842 .Ql +
1843 and
1844 .Ql - ,
1845 where
1846 .Ql =
1847 sets the
1848 .Xr syslog 3
1849 priority mask,
1850 .Ql +
1851 adds and
1852 .Ql -
1853 removes
1854 messages.
1855 .Xr syslog 3
1856 messages can be controlled in four
1857 classes
1858 .Po
1859 .Cm clock ,
1860 .Cm peer ,
1861 .Cm sys
1862 and
1863 .Cm sync
1864 .Pc .
1865 Within these classes four types of messages can be
1866 controlled.
1867 Informational messages
1868 .Pq Cm info
1869 control configuration
1870 information.
1871 Event messages
1872 .Pq Cm events
1873 control logging of
1874 events (reachability, synchronization, alarm conditions).
1875 Statistical output is controlled with the
1876 .Cm statistics
1877 keyword.
1878 The final message group is the status messages.
1879 This
1880 describes mainly the synchronizations status.
1881 Configuration
1882 keywords are formed by concatenating the message class with the
1883 event class.
1884 The
1885 .Cm all
1886 prefix can be used instead of a
1887 message class.
1888 A message class may also be followed by the
1889 .Cm all
1890 keyword to enable/disable all messages of the
1891 respective message class.
1892 Thus, a minimal log configuration could look like this:
1893 .Bd -literal
1894 logconfig =syncstatus +sysevents
1895 .Ed
1896 .Pp
1897 This would just list the synchronizations state of
1898 .Xr ntpd 8
1899 and the major system events.
1900 For a simple reference server, the
1901 following minimum message configuration could be useful:
1902 .Bd -literal
1903 logconfig =syncall +clockall
1904 .Ed
1905 .Pp
1906 This configuration will list all clock information and
1907 synchronization information.
1908 All other events and messages about
1909 peers, system events and so on is suppressed.
1910 .It Ic logfile Ar logfile
1911 This command specifies the location of an alternate log file to
1912 be used instead of the default system
1913 .Xr syslog 3
1914 facility.
1915 .It Ic setvar Ar variable Op Cm default
1916 This command adds an additional system variable.
1917 These
1918 variables can be used to distribute additional information such as
1919 the access policy.
1920 If the variable of the form
1921 .Sm off
1922 .Va name = Ar value
1923 .Sm on
1924 is followed by the
1925 .Cm default
1926 keyword, the
1927 variable will be listed as part of the default system variables
1928 .Po
1929 .Xr ntpq 8
1930 .Ic rv
1931 command
1932 .Pc ) .
1933 These additional variables serve
1934 informational purposes only.
1935 They are not related to the protocol
1936 other that they can be listed.
1937 The known protocol variables will
1938 always override any variables defined via the
1939 .Ic setvar
1940 mechanism.
1941 There are three special variables that contain the names
1942 of all variable of the same group.
1943 The
1944 .Va sys_var_list
1945 holds
1946 the names of all system variables.
1947 The
1948 .Va peer_var_list
1949 holds
1950 the names of all peer variables and the
1951 .Va clock_var_list
1952 holds the names of the reference clock variables.
1953 .It Xo Ic tinker
1954 .Oo
1955 .Cm step Ar step |
1956 .Cm panic Ar panic |
1957 .Cm dispersion Ar dispersion |
1958 .Cm stepout Ar stepout |
1959 .Cm minpoll Ar minpoll |
1960 .Cm allan Ar allan |
1961 .Cm huffpuff Ar huffpuff
1962 .Oc
1963 .Xc
1964 This command can be used to alter several system variables in
1965 very exceptional circumstances.
1966 It should occur in the
1967 configuration file before any other configuration options.
1968 The
1969 default values of these variables have been carefully optimized for
1970 a wide range of network speeds and reliability expectations.
1971 In
1972 general, they interact in intricate ways that are hard to predict
1973 and some combinations can result in some very nasty behavior.
1974 Very
1975 rarely is it necessary to change the default values; but, some
1976 folks cannot resist twisting the knobs anyway and this command is
1977 for them.
1978 Emphasis added: twisters are on their own and can expect
1979 no help from the support group.
1980 .Pp
1981 All arguments are in floating point seconds or seconds per
1982 second.
1983 The
1984 .Ar minpoll
1985 argument is an integer in seconds to
1986 the power of two.
1987 The variables operate as follows:
1988 .Bl -tag -width indent
1989 .It Cm step Ar step
1990 The argument becomes the new value for the step threshold,
1991 normally 0.128 s.
1992 If set to zero, step adjustments will never
1993 occur.
1994 In general, if the intent is only to avoid step adjustments,
1995 the step threshold should be left alone and the
1996 .Fl x
1997 command
1998 line option be used instead.
1999 .It Cm panic Ar panic
2000 The argument becomes the new value for the panic threshold,
2001 normally 1000 s.
2002 If set to zero, the panic sanity check is disabled
2003 and a clock offset of any value will be accepted.
2004 .It Cm dispersion Ar dispersion
2005 The argument becomes the new value for the dispersion increase
2006 rate, normally .000015.
2007 .It Cm stepout Ar stepout
2008 The argument becomes the new value for the watchdog timeout,
2009 normally 900 s.
2010 .It Cm minpoll Ar minpoll
2011 The argument becomes the new value for the minimum poll
2012 interval used when configuring multicast client, manycast client
2013 and , symmetric passive mode association.
2014 The value defaults to 6
2015 (64 s) and has a lower limit of 4 (16 s).
2016 .It Cm allan Ar allan
2017 The argument becomes the new value for the minimum Allan
2018 intercept, which is a parameter of the PLL/FLL clock discipline
2019 algorithm.
2020 The value defaults to 1024 s, which is also the lower
2021 limit.
2022 .It Cm huffpuff Ar huffpuff
2023 The argument becomes the new value for the experimental
2024 huff-n'-puff filter span, which determines the most recent interval
2025 the algorithm will search for a minimum delay.
2026 The lower limit is
2027 900 s (15 m), but a more reasonable value is 7200 (2 hours).
2028 There
2029 is no default, since the filter is not enabled unless this command
2030 is given.
2031 .El
2032 .It Xo Ic trap Ar host_address
2033 .Op Cm port Ar port_number
2034 .Op Cm interface Ar interface_address
2035 .Xc
2036 This command configures a trap receiver at the given host
2037 address and port number for sending messages with the specified
2038 local interface address.
2039 If the port number is unspecified, a value
2040 of 18447 is used.
2041 If the interface address is not specified, the
2042 message is sent with a source address of the local interface the
2043 message is sent through.
2044 Note that on a multihomed host the
2045 interface used may vary from time to time with routing changes.
2046 .Pp
2047 The trap receiver will generally log event messages and other
2048 information from the server in a log file.
2049 While such monitor
2050 programs may also request their own trap dynamically, configuring a
2051 trap receiver will ensure that no messages are lost when the server
2052 is started.
2053 .El
2054 .Sh FILES
2055 .Bl -tag -width /etc/ntp.drift -compact
2056 .It Pa /etc/ntp.conf
2057 the default name of the configuration file
2058 .It Pa ntp.keys
2059 private MD5 keys
2060 .It Pa ntpkey
2061 RSA private key
2062 .It Pa ntpkey_ Ns Ar host
2063 RSA public key
2064 .It Pa ntp_dh
2065 Diffie-Hellman agreement parameters
2066 .El
2067 .Sh SEE ALSO
2068 .Xr ntpd 8 ,
2069 .Xr ntpdc 8 ,
2070 .Xr ntpq 8
2071 .Pp
2072 In addition to the manual pages provided,
2073 comprehensive documentation is available on the world wide web
2074 at
2075 .Li http://www.ntp.org/ .
2076 A snapshot of this documentation is available in HTML format in
2077 .Pa /usr/share/doc/ntp .
2078 .Rs
2079 .%A David L. Mills
2080 .%T Network Time Protocol (Version 3)
2081 .%O RFC1305
2082 .Re
2083 .Sh BUGS
2084 The syntax checking is not picky; some combinations of
2085 ridiculous and even hilarious options and modes may not be
2086 detected.
2087 .Pp
2088 The
2089 .Pa ntpkey_ Ns Ar host
2090 files are really digital
2091 certificates.
2092 These should be obtained via secure directory
2093 services when they become universally available.