ntp.conf.html revision 298770
1280928Scperciva<html lang="en">
2280928Scperciva<head>
3280928Scperciva<title>NTP Configuration File User's Manual</title>
4280928Scperciva<meta http-equiv="Content-Type" content="text/html">
5280928Scperciva<meta name="description" content="NTP Configuration File User's Manual">
6280928Scperciva<meta name="generator" content="makeinfo 4.7">
7280928Scperciva<link title="Top" rel="top" href="#Top">
8280928Scperciva<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
9280928Scperciva<meta http-equiv="Content-Style-Type" content="text/css">
10280928Scperciva<style type="text/css"><!--
11280928Scperciva  pre.display { font-family:inherit }
12280928Scperciva  pre.format  { font-family:inherit }
13280928Scperciva  pre.smalldisplay { font-family:inherit; font-size:smaller }
14280928Scperciva  pre.smallformat  { font-family:inherit; font-size:smaller }
15282618Sgjb  pre.smallexample { font-size:smaller }
16282618Sgjb  pre.smalllisp    { font-size:smaller }
17282618Sgjb  span.sc { font-variant:small-caps }
18282618Sgjb  span.roman { font-family: serif; font-weight: normal; } 
19282618Sgjb--></style>
20282618Sgjb</head>
21282618Sgjb<body>
22282618Sgjb<h1 class="settitle">NTP Configuration File User's Manual</h1>
23282618Sgjb<div class="node">
24282263Sgjb<p><hr>
25282263Sgjb<a name="Top"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#ntp_002econf-Description">ntp.conf Description</a>,
26282263SgjbPrevious:&nbsp;<a rel="previous" accesskey="p" href="#dir">(dir)</a>,
27282263SgjbUp:&nbsp;<a rel="up" accesskey="u" href="#dir">(dir)</a>
28282263Sgjb<br>
29282263Sgjb</div>
30282263Sgjb
31282263Sgjb<h2 class="unnumbered">NTP's Configuration File User Manual</h2>
32280928Scperciva
33282618Sgjb<p>This document describes the configuration file for the NTP Project's
34282263Sgjb<code>ntpd</code> program.
35282618Sgjb
36280928Scperciva  <p>This document applies to version 4.2.8p7 of <code>ntp.conf</code>.
37280928Scperciva
38280928Scperciva  <div class="shortcontents">
39280928Scperciva<h2>Short Contents</h2>
40280928Scperciva<ul>
41280928Scperciva<a href="#Top">NTP's Configuration File User Manual</a>
42280928Scperciva</ul>
43280928Scperciva</div>
44280928Scperciva
45280928Scperciva<ul class="menu">
46280928Scperciva<li><a accesskey="1" href="#ntp_002econf-Description">ntp.conf Description</a>
47280928Scperciva<li><a accesskey="2" href="#ntp_002econf-Notes">ntp.conf Notes</a>
48280928Scperciva</ul>
49280928Scperciva
50280928Scperciva<div class="node">
51280928Scperciva<p><hr>
52280928Scperciva<a name="ntp_002econf-Description"></a>Previous:&nbsp;<a rel="previous" accesskey="p" href="#Top">Top</a>,
53280928ScpercivaUp:&nbsp;<a rel="up" accesskey="u" href="#Top">Top</a>
54280928Scperciva<br>
55280928Scperciva</div>
56280928Scperciva
57280928Scperciva<!-- node-name,  next,  previous,  up -->
58280928Scperciva<h3 class="section">Description</h3>
59282618Sgjb
60<p>The behavior of  <code>ntpd</code> can be changed by a configuration file,
61by default <code>ntp.conf</code>.
62
63<div class="node">
64<p><hr>
65<a name="ntp_002econf-Notes"></a>
66<br>
67</div>
68
69<h3 class="section">Notes about ntp.conf</h3>
70
71<p><a name="index-ntp_002econf-1"></a><a name="index-Network-Time-Protocol-_0028NTP_0029-daemon-configuration-file-format-2"></a>
72
73  <p>The
74<code>ntp.conf</code>
75configuration file is read at initial startup by the
76<code>ntpd(1ntpdmdoc)</code>
77daemon in order to specify the synchronization sources,
78modes and other related information. 
79Usually, it is installed in the
80<span class="file">/etc</span>
81directory,
82but could be installed elsewhere
83(see the daemon's
84<code>-c</code>
85command line option).
86
87  <p>The file format is similar to other
88<span class="sc">unix</span>
89configuration files. 
90Comments begin with a
91#
92character and extend to the end of the line;
93blank lines are ignored. 
94Configuration commands consist of an initial keyword
95followed by a list of arguments,
96some of which may be optional, separated by whitespace. 
97Commands may not be continued over multiple lines. 
98Arguments may be host names,
99host addresses written in numeric, dotted-quad form,
100integers, floating point numbers (when specifying times in seconds)
101and text strings.
102
103  <p>The rest of this page describes the configuration and control options. 
104The
105"Notes on Configuring NTP and Setting up an NTP Subnet"
106page
107(available as part of the HTML documentation
108provided in
109<span class="file">/usr/share/doc/ntp</span>)
110contains an extended discussion of these options. 
111In addition to the discussion of general
112<a href="#Configuration-Options">Configuration Options</a>,
113there are sections describing the following supported functionality
114and the options used to control it:
115     <ul>
116<li><a href="#Authentication-Support">Authentication Support</a>
117<li><a href="#Monitoring-Support">Monitoring Support</a>
118<li><a href="#Access-Control-Support">Access Control Support</a>
119<li><a href="#Automatic-NTP-Configuration-Options">Automatic NTP Configuration Options</a>
120<li><a href="#Reference-Clock-Support">Reference Clock Support</a>
121<li><a href="#Miscellaneous-Options">Miscellaneous Options</a>
122</ul>
123
124  <p>Following these is a section describing
125<a href="#Miscellaneous-Options">Miscellaneous Options</a>. 
126While there is a rich set of options available,
127the only required option is one or more
128<code>pool</code>,
129<code>server</code>,
130<code>peer</code>,
131<code>broadcast</code>
132or
133<code>manycastclient</code>
134commands. 
135<div class="node">
136<p><hr>
137<a name="Configuration-Support"></a>
138<br>
139</div>
140
141<h4 class="subsection">Configuration Support</h4>
142
143<p>Following is a description of the configuration commands in
144NTPv4. 
145These commands have the same basic functions as in NTPv3 and
146in some cases new functions and new arguments. 
147There are two
148classes of commands, configuration commands that configure a
149persistent association with a remote server or peer or reference
150clock, and auxiliary commands that specify environmental variables
151that control various related operations.
152
153<h5 class="subsubsection">Configuration Commands</h5>
154
155<p>The various modes are determined by the command keyword and the
156type of the required IP address. 
157Addresses are classed by type as
158(s) a remote server or peer (IPv4 class A, B and C), (b) the
159broadcast address of a local interface, (m) a multicast address (IPv4
160class D), or (r) a reference clock address (127.127.x.x). 
161Note that
162only those options applicable to each command are listed below. 
163Use
164of options not listed may not be caught as an error, but may result
165in some weird and even destructive behavior.
166
167  <p>If the Basic Socket Interface Extensions for IPv6 (RFC-2553)
168is detected, support for the IPv6 address family is generated
169in addition to the default support of the IPv4 address family. 
170In a few cases, including the reslist billboard generated
171by ntpdc, IPv6 addresses are automatically generated. 
172IPv6 addresses can be identified by the presence of colons
173:
174in the address field. 
175IPv6 addresses can be used almost everywhere where
176IPv4 addresses can be used,
177with the exception of reference clock addresses,
178which are always IPv4.
179
180  <p>Note that in contexts where a host name is expected, a
181<code>-4</code>
182qualifier preceding
183the host name forces DNS resolution to the IPv4 namespace,
184while a
185<code>-6</code>
186qualifier forces DNS resolution to the IPv6 namespace. 
187See IPv6 references for the
188equivalent classes for that address family.
189     <dl>
190<dt><code>pool</code> <kbd>address</kbd> <code>[burst]</code> <code>[iburst]</code> <code>[version </code><kbd>version</kbd><code>]</code> <code>[prefer]</code> <code>[minpoll </code><kbd>minpoll</kbd><code>]</code> <code>[maxpoll </code><kbd>maxpoll</kbd><code>]</code><br><dt><code>server</code> <kbd>address</kbd> <code>[key </code><kbd>key</kbd> <kbd>|</kbd><code> autokey]</code> <code>[burst]</code> <code>[iburst]</code> <code>[version </code><kbd>version</kbd><code>]</code> <code>[prefer]</code> <code>[minpoll </code><kbd>minpoll</kbd><code>]</code> <code>[maxpoll </code><kbd>maxpoll</kbd><code>]</code><br><dt><code>peer</code> <kbd>address</kbd> <code>[key </code><kbd>key</kbd> <kbd>|</kbd><code> autokey]</code> <code>[version </code><kbd>version</kbd><code>]</code> <code>[prefer]</code> <code>[minpoll </code><kbd>minpoll</kbd><code>]</code> <code>[maxpoll </code><kbd>maxpoll</kbd><code>]</code><br><dt><code>broadcast</code> <kbd>address</kbd> <code>[key </code><kbd>key</kbd> <kbd>|</kbd><code> autokey]</code> <code>[version </code><kbd>version</kbd><code>]</code> <code>[prefer]</code> <code>[minpoll </code><kbd>minpoll</kbd><code>]</code> <code>[ttl </code><kbd>ttl</kbd><code>]</code><br><dt><code>manycastclient</code> <kbd>address</kbd> <code>[key </code><kbd>key</kbd> <kbd>|</kbd><code> autokey]</code> <code>[version </code><kbd>version</kbd><code>]</code> <code>[prefer]</code> <code>[minpoll </code><kbd>minpoll</kbd><code>]</code> <code>[maxpoll </code><kbd>maxpoll</kbd><code>]</code> <code>[ttl </code><kbd>ttl</kbd><code>]</code><dd></dl>
191
192  <p>These five commands specify the time server name or address to
193be used and the mode in which to operate. 
194The
195<kbd>address</kbd>
196can be
197either a DNS name or an IP address in dotted-quad notation. 
198Additional information on association behavior can be found in the
199"Association Management"
200page
201(available as part of the HTML documentation
202provided in
203<span class="file">/usr/share/doc/ntp</span>).
204     <dl>
205<dt><code>pool</code><dd>For type s addresses, this command mobilizes a persistent
206client mode association with a number of remote servers. 
207In this mode the local clock can synchronized to the
208remote server, but the remote server can never be synchronized to
209the local clock. 
210<br><dt><code>server</code><dd>For type s and r addresses, this command mobilizes a persistent
211client mode association with the specified remote server or local
212radio clock. 
213In this mode the local clock can synchronized to the
214remote server, but the remote server can never be synchronized to
215the local clock. 
216This command should
217<em>not</em>
218be used for type
219b or m addresses. 
220<br><dt><code>peer</code><dd>For type s addresses (only), this command mobilizes a
221persistent symmetric-active mode association with the specified
222remote peer. 
223In this mode the local clock can be synchronized to
224the remote peer or the remote peer can be synchronized to the local
225clock. 
226This is useful in a network of servers where, depending on
227various failure scenarios, either the local or remote peer may be
228the better source of time. 
229This command should NOT be used for type
230b, m or r addresses. 
231<br><dt><code>broadcast</code><dd>For type b and m addresses (only), this
232command mobilizes a persistent broadcast mode association. 
233Multiple
234commands can be used to specify multiple local broadcast interfaces
235(subnets) and/or multiple multicast groups. 
236Note that local
237broadcast messages go only to the interface associated with the
238subnet specified, but multicast messages go to all interfaces. 
239In broadcast mode the local server sends periodic broadcast
240messages to a client population at the
241<kbd>address</kbd>
242specified, which is usually the broadcast address on (one of) the
243local network(s) or a multicast address assigned to NTP. 
244The IANA
245has assigned the multicast group address IPv4 224.0.1.1 and
246IPv6 ff05::101 (site local) exclusively to
247NTP, but other nonconflicting addresses can be used to contain the
248messages within administrative boundaries. 
249Ordinarily, this
250specification applies only to the local server operating as a
251sender; for operation as a broadcast client, see the
252<code>broadcastclient</code>
253or
254<code>multicastclient</code>
255commands
256below. 
257<br><dt><code>manycastclient</code><dd>For type m addresses (only), this command mobilizes a
258manycast client mode association for the multicast address
259specified. 
260In this case a specific address must be supplied which
261matches the address used on the
262<code>manycastserver</code>
263command for
264the designated manycast servers. 
265The NTP multicast address
266224.0.1.1 assigned by the IANA should NOT be used, unless specific
267means are taken to avoid spraying large areas of the Internet with
268these messages and causing a possibly massive implosion of replies
269at the sender. 
270The
271<code>manycastserver</code>
272command specifies that the local server
273is to operate in client mode with the remote servers that are
274discovered as the result of broadcast/multicast messages. 
275The
276client broadcasts a request message to the group address associated
277with the specified
278<kbd>address</kbd>
279and specifically enabled
280servers respond to these messages. 
281The client selects the servers
282providing the best time and continues as with the
283<code>server</code>
284command. 
285The remaining servers are discarded as if never
286heard. 
287</dl>
288
289  <p>Options:
290     <dl>
291<dt><code>autokey</code><dd>All packets sent to and received from the server or peer are to
292include authentication fields encrypted using the autokey scheme
293described in
294<a href="#Authentication-Options">Authentication Options</a>. 
295<br><dt><code>burst</code><dd>when the server is reachable, send a burst of eight packets
296instead of the usual one. 
297The packet spacing is normally 2 s;
298however, the spacing between the first and second packets
299can be changed with the
300<code>calldelay</code>
301command to allow
302additional time for a modem or ISDN call to complete. 
303This is designed to improve timekeeping quality
304with the
305<code>server</code>
306command and s addresses. 
307<br><dt><code>iburst</code><dd>When the server is unreachable, send a burst of eight packets
308instead of the usual one. 
309The packet spacing is normally 2 s;
310however, the spacing between the first two packets can be
311changed with the
312<code>calldelay</code>
313command to allow
314additional time for a modem or ISDN call to complete. 
315This is designed to speed the initial synchronization
316acquisition with the
317<code>server</code>
318command and s addresses and when
319<code>ntpd(1ntpdmdoc)</code>
320is started with the
321<code>-q</code>
322option. 
323<br><dt><code>key</code> <kbd>key</kbd><dd>All packets sent to and received from the server or peer are to
324include authentication fields encrypted using the specified
325<kbd>key</kbd>
326identifier with values from 1 to 65534, inclusive. 
327The
328default is to include no encryption field. 
329<br><dt><code>minpoll</code> <kbd>minpoll</kbd><br><dt><code>maxpoll</code> <kbd>maxpoll</kbd><dd>These options specify the minimum and maximum poll intervals
330for NTP messages, as a power of 2 in seconds
331The maximum poll
332interval defaults to 10 (1,024 s), but can be increased by the
333<code>maxpoll</code>
334option to an upper limit of 17 (36.4 h). 
335The
336minimum poll interval defaults to 6 (64 s), but can be decreased by
337the
338<code>minpoll</code>
339option to a lower limit of 4 (16 s). 
340<br><dt><code>noselect</code><dd>Marks the server as unused, except for display purposes. 
341The server is discarded by the selection algroithm. 
342<br><dt><code>preempt</code><dd>Says the association can be preempted. 
343<br><dt><code>true</code><dd>Marks the server as a truechimer. 
344<br><dt><code>prefer</code><dd>Marks the server as preferred. 
345All other things being equal,
346this host will be chosen for synchronization among a set of
347correctly operating hosts. 
348See the
349"Mitigation Rules and the prefer Keyword"
350page
351(available as part of the HTML documentation
352provided in
353<span class="file">/usr/share/doc/ntp</span>)
354for further information. 
355<br><dt><code>ttl</code> <kbd>ttl</kbd><dd>This option is used only with broadcast server and manycast
356client modes. 
357It specifies the time-to-live
358<kbd>ttl</kbd>
359to
360use on broadcast server and multicast server and the maximum
361<kbd>ttl</kbd>
362for the expanding ring search with manycast
363client packets. 
364Selection of the proper value, which defaults to
365127, is something of a black art and should be coordinated with the
366network administrator. 
367<br><dt><code>version</code> <kbd>version</kbd><dd>Specifies the version number to be used for outgoing NTP
368packets. 
369Versions 1-4 are the choices, with version 4 the
370default. 
371<br><dt><code>xleave</code><dd>Valid in
372<code>peer</code>
373and
374<code>broadcast</code>
375modes only, this flag enables interleave mode. 
376</dl>
377
378<h5 class="subsubsection">Auxiliary Commands</h5>
379
380     <dl>
381<dt><code>broadcastclient</code><dd>This command enables reception of broadcast server messages to
382any local interface (type b) address. 
383Upon receiving a message for
384the first time, the broadcast client measures the nominal server
385propagation delay using a brief client/server exchange with the
386server, then enters the broadcast client mode, in which it
387synchronizes to succeeding broadcast messages. 
388Note that, in order
389to avoid accidental or malicious disruption in this mode, both the
390server and client should operate using symmetric-key or public-key
391authentication as described in
392<a href="#Authentication-Options">Authentication Options</a>. 
393<br><dt><code>manycastserver</code> <kbd>address</kbd> <kbd>...</kbd><dd>This command enables reception of manycast client messages to
394the multicast group address(es) (type m) specified. 
395At least one
396address is required, but the NTP multicast address 224.0.1.1
397assigned by the IANA should NOT be used, unless specific means are
398taken to limit the span of the reply and avoid a possibly massive
399implosion at the original sender. 
400Note that, in order to avoid
401accidental or malicious disruption in this mode, both the server
402and client should operate using symmetric-key or public-key
403authentication as described in
404<a href="#Authentication-Options">Authentication Options</a>. 
405<br><dt><code>multicastclient</code> <kbd>address</kbd> <kbd>...</kbd><dd>This command enables reception of multicast server messages to
406the multicast group address(es) (type m) specified. 
407Upon receiving
408a message for the first time, the multicast client measures the
409nominal server propagation delay using a brief client/server
410exchange with the server, then enters the broadcast client mode, in
411which it synchronizes to succeeding multicast messages. 
412Note that,
413in order to avoid accidental or malicious disruption in this mode,
414both the server and client should operate using symmetric-key or
415public-key authentication as described in
416<a href="#Authentication-Options">Authentication Options</a>. 
417<br><dt><code>mdnstries</code> <kbd>number</kbd><dd>If we are participating in mDNS,
418after we have synched for the first time
419we attempt to register with the mDNS system. 
420If that registration attempt fails,
421we try again at one minute intervals for up to
422<code>mdnstries</code>
423times. 
424After all,
425<code>ntpd</code>
426may be starting before mDNS. 
427The default value for
428<code>mdnstries</code>
429is 5. 
430</dl>
431<div class="node">
432<p><hr>
433<a name="Authentication-Support"></a>
434<br>
435</div>
436
437<h4 class="subsection">Authentication Support</h4>
438
439<p>Authentication support allows the NTP client to verify that the
440server is in fact known and trusted and not an intruder intending
441accidentally or on purpose to masquerade as that server. 
442The NTPv3
443specification RFC-1305 defines a scheme which provides
444cryptographic authentication of received NTP packets. 
445Originally,
446this was done using the Data Encryption Standard (DES) algorithm
447operating in Cipher Block Chaining (CBC) mode, commonly called
448DES-CBC. 
449Subsequently, this was replaced by the RSA Message Digest
4505 (MD5) algorithm using a private key, commonly called keyed-MD5. 
451Either algorithm computes a message digest, or one-way hash, which
452can be used to verify the server has the correct private key and
453key identifier.
454
455  <p>NTPv4 retains the NTPv3 scheme, properly described as symmetric key
456cryptography and, in addition, provides a new Autokey scheme
457based on public key cryptography. 
458Public key cryptography is generally considered more secure
459than symmetric key cryptography, since the security is based
460on a private value which is generated by each server and
461never revealed. 
462With Autokey all key distribution and
463management functions involve only public values, which
464considerably simplifies key distribution and storage. 
465Public key management is based on X.509 certificates,
466which can be provided by commercial services or
467produced by utility programs in the OpenSSL software library
468or the NTPv4 distribution.
469
470  <p>While the algorithms for symmetric key cryptography are
471included in the NTPv4 distribution, public key cryptography
472requires the OpenSSL software library to be installed
473before building the NTP distribution. 
474Directions for doing that
475are on the Building and Installing the Distribution page.
476
477  <p>Authentication is configured separately for each association
478using the
479<code>key</code>
480or
481<code>autokey</code>
482subcommand on the
483<code>peer</code>,
484<code>server</code>,
485<code>broadcast</code>
486and
487<code>manycastclient</code>
488configuration commands as described in
489<a href="#Configuration-Options">Configuration Options</a>
490page. 
491The authentication
492options described below specify the locations of the key files,
493if other than default, which symmetric keys are trusted
494and the interval between various operations, if other than default.
495
496  <p>Authentication is always enabled,
497although ineffective if not configured as
498described below. 
499If a NTP packet arrives
500including a message authentication
501code (MAC), it is accepted only if it
502passes all cryptographic checks. 
503The
504checks require correct key ID, key value
505and message digest. 
506If the packet has
507been modified in any way or replayed
508by an intruder, it will fail one or more
509of these checks and be discarded. 
510Furthermore, the Autokey scheme requires a
511preliminary protocol exchange to obtain
512the server certificate, verify its
513credentials and initialize the protocol
514
515  <p>The
516<code>auth</code>
517flag controls whether new associations or
518remote configuration commands require cryptographic authentication. 
519This flag can be set or reset by the
520<code>enable</code>
521and
522<code>disable</code>
523commands and also by remote
524configuration commands sent by a
525<code>ntpdc(1ntpdcmdoc)</code>
526program running in
527another machine. 
528If this flag is enabled, which is the default
529case, new broadcast client and symmetric passive associations and
530remote configuration commands must be cryptographically
531authenticated using either symmetric key or public key cryptography. 
532If this
533flag is disabled, these operations are effective
534even if not cryptographic
535authenticated. 
536It should be understood
537that operating with the
538<code>auth</code>
539flag disabled invites a significant vulnerability
540where a rogue hacker can
541masquerade as a falseticker and seriously
542disrupt system timekeeping. 
543It is
544important to note that this flag has no purpose
545other than to allow or disallow
546a new association in response to new broadcast
547and symmetric active messages
548and remote configuration commands and, in particular,
549the flag has no effect on
550the authentication process itself.
551
552  <p>An attractive alternative where multicast support is available
553is manycast mode, in which clients periodically troll
554for servers as described in the
555<a href="#Automatic-NTP-Configuration-Options">Automatic NTP Configuration Options</a>
556page. 
557Either symmetric key or public key
558cryptographic authentication can be used in this mode. 
559The principle advantage
560of manycast mode is that potential servers need not be
561configured in advance,
562since the client finds them during regular operation,
563and the configuration
564files for all clients can be identical.
565
566  <p>The security model and protocol schemes for
567both symmetric key and public key
568cryptography are summarized below;
569further details are in the briefings, papers
570and reports at the NTP project page linked from
571<code>http://www.ntp.org/</code>.
572
573<h5 class="subsubsection">Symmetric-Key Cryptography</h5>
574
575<p>The original RFC-1305 specification allows any one of possibly
57665,534 keys, each distinguished by a 32-bit key identifier, to
577authenticate an association. 
578The servers and clients involved must
579agree on the key and key identifier to
580authenticate NTP packets. 
581Keys and
582related information are specified in a key
583file, usually called
584<span class="file">ntp.keys</span>,
585which must be distributed and stored using
586secure means beyond the scope of the NTP protocol itself. 
587Besides the keys used
588for ordinary NTP associations,
589additional keys can be used as passwords for the
590<code>ntpq(1ntpqmdoc)</code>
591and
592<code>ntpdc(1ntpdcmdoc)</code>
593utility programs.
594
595  <p>When
596<code>ntpd(1ntpdmdoc)</code>
597is first started, it reads the key file specified in the
598<code>keys</code>
599configuration command and installs the keys
600in the key cache. 
601However,
602individual keys must be activated with the
603<code>trusted</code>
604command before use. 
605This
606allows, for instance, the installation of possibly
607several batches of keys and
608then activating or deactivating each batch
609remotely using
610<code>ntpdc(1ntpdcmdoc)</code>. 
611This also provides a revocation capability that can be used
612if a key becomes compromised. 
613The
614<code>requestkey</code>
615command selects the key used as the password for the
616<code>ntpdc(1ntpdcmdoc)</code>
617utility, while the
618<code>controlkey</code>
619command selects the key used as the password for the
620<code>ntpq(1ntpqmdoc)</code>
621utility.
622
623<h5 class="subsubsection">Public Key Cryptography</h5>
624
625<p>NTPv4 supports the original NTPv3 symmetric key scheme
626described in RFC-1305 and in addition the Autokey protocol,
627which is based on public key cryptography. 
628The Autokey Version 2 protocol described on the Autokey Protocol
629page verifies packet integrity using MD5 message digests
630and verifies the source with digital signatures and any of several
631digest/signature schemes. 
632Optional identity schemes described on the Identity Schemes
633page and based on cryptographic challenge/response algorithms
634are also available. 
635Using all of these schemes provides strong security against
636replay with or without modification, spoofing, masquerade
637and most forms of clogging attacks.
638
639  <p>The Autokey protocol has several modes of operation
640corresponding to the various NTP modes supported. 
641Most modes use a special cookie which can be
642computed independently by the client and server,
643but encrypted in transmission. 
644All modes use in addition a variant of the S-KEY scheme,
645in which a pseudo-random key list is generated and used
646in reverse order. 
647These schemes are described along with an executive summary,
648current status, briefing slides and reading list on the
649<a href="#Autonomous-Authentication">Autonomous Authentication</a>
650page.
651
652  <p>The specific cryptographic environment used by Autokey servers
653and clients is determined by a set of files
654and soft links generated by the
655<code>ntp-keygen(1ntpkeygenmdoc)</code>
656program. 
657This includes a required host key file,
658required certificate file and optional sign key file,
659leapsecond file and identity scheme files. 
660The
661digest/signature scheme is specified in the X.509 certificate
662along with the matching sign key. 
663There are several schemes
664available in the OpenSSL software library, each identified
665by a specific string such as
666<code>md5WithRSAEncryption</code>,
667which stands for the MD5 message digest with RSA
668encryption scheme. 
669The current NTP distribution supports
670all the schemes in the OpenSSL library, including
671those based on RSA and DSA digital signatures.
672
673  <p>NTP secure groups can be used to define cryptographic compartments
674and security hierarchies. 
675It is important that every host
676in the group be able to construct a certificate trail to one
677or more trusted hosts in the same group. 
678Each group
679host runs the Autokey protocol to obtain the certificates
680for all hosts along the trail to one or more trusted hosts. 
681This requires the configuration file in all hosts to be
682engineered so that, even under anticipated failure conditions,
683the NTP subnet will form such that every group host can find
684a trail to at least one trusted host.
685
686<h5 class="subsubsection">Naming and Addressing</h5>
687
688<p>It is important to note that Autokey does not use DNS to
689resolve addresses, since DNS can't be completely trusted
690until the name servers have synchronized clocks. 
691The cryptographic name used by Autokey to bind the host identity
692credentials and cryptographic values must be independent
693of interface, network and any other naming convention. 
694The name appears in the host certificate in either or both
695the subject and issuer fields, so protection against
696DNS compromise is essential.
697
698  <p>By convention, the name of an Autokey host is the name returned
699by the Unix
700<code>gethostname(2)</code>
701system call or equivalent in other systems. 
702By the system design
703model, there are no provisions to allow alternate names or aliases. 
704However, this is not to say that DNS aliases, different names
705for each interface, etc., are constrained in any way.
706
707  <p>It is also important to note that Autokey verifies authenticity
708using the host name, network address and public keys,
709all of which are bound together by the protocol specifically
710to deflect masquerade attacks. 
711For this reason Autokey
712includes the source and destinatino IP addresses in message digest
713computations and so the same addresses must be available
714at both the server and client. 
715For this reason operation
716with network address translation schemes is not possible. 
717This reflects the intended robust security model where government
718and corporate NTP servers are operated outside firewall perimeters.
719
720<h5 class="subsubsection">Operation</h5>
721
722<p>A specific combination of authentication scheme (none,
723symmetric key, public key) and identity scheme is called
724a cryptotype, although not all combinations are compatible. 
725There may be management configurations where the clients,
726servers and peers may not all support the same cryptotypes. 
727A secure NTPv4 subnet can be configured in many ways while
728keeping in mind the principles explained above and
729in this section. 
730Note however that some cryptotype
731combinations may successfully interoperate with each other,
732but may not represent good security practice.
733
734  <p>The cryptotype of an association is determined at the time
735of mobilization, either at configuration time or some time
736later when a message of appropriate cryptotype arrives. 
737When mobilized by a
738<code>server</code>
739or
740<code>peer</code>
741configuration command and no
742<code>key</code>
743or
744<code>autokey</code>
745subcommands are present, the association is not
746authenticated; if the
747<code>key</code>
748subcommand is present, the association is authenticated
749using the symmetric key ID specified; if the
750<code>autokey</code>
751subcommand is present, the association is authenticated
752using Autokey.
753
754  <p>When multiple identity schemes are supported in the Autokey
755protocol, the first message exchange determines which one is used. 
756The client request message contains bits corresponding
757to which schemes it has available. 
758The server response message
759contains bits corresponding to which schemes it has available. 
760Both server and client match the received bits with their own
761and select a common scheme.
762
763  <p>Following the principle that time is a public value,
764a server responds to any client packet that matches
765its cryptotype capabilities. 
766Thus, a server receiving
767an unauthenticated packet will respond with an unauthenticated
768packet, while the same server receiving a packet of a cryptotype
769it supports will respond with packets of that cryptotype. 
770However, unconfigured broadcast or manycast client
771associations or symmetric passive associations will not be
772mobilized unless the server supports a cryptotype compatible
773with the first packet received. 
774By default, unauthenticated associations will not be mobilized
775unless overridden in a decidedly dangerous way.
776
777  <p>Some examples may help to reduce confusion. 
778Client Alice has no specific cryptotype selected. 
779Server Bob has both a symmetric key file and minimal Autokey files. 
780Alice's unauthenticated messages arrive at Bob, who replies with
781unauthenticated messages. 
782Cathy has a copy of Bob's symmetric
783key file and has selected key ID 4 in messages to Bob. 
784Bob verifies the message with his key ID 4. 
785If it's the
786same key and the message is verified, Bob sends Cathy a reply
787authenticated with that key. 
788If verification fails,
789Bob sends Cathy a thing called a crypto-NAK, which tells her
790something broke. 
791She can see the evidence using the
792<code>ntpq(1ntpqmdoc)</code>
793program.
794
795  <p>Denise has rolled her own host key and certificate. 
796She also uses one of the identity schemes as Bob. 
797She sends the first Autokey message to Bob and they
798both dance the protocol authentication and identity steps. 
799If all comes out okay, Denise and Bob continue as described above.
800
801  <p>It should be clear from the above that Bob can support
802all the girls at the same time, as long as he has compatible
803authentication and identity credentials. 
804Now, Bob can act just like the girls in his own choice of servers;
805he can run multiple configured associations with multiple different
806servers (or the same server, although that might not be useful). 
807But, wise security policy might preclude some cryptotype
808combinations; for instance, running an identity scheme
809with one server and no authentication with another might not be wise.
810
811<h5 class="subsubsection">Key Management</h5>
812
813<p>The cryptographic values used by the Autokey protocol are
814incorporated as a set of files generated by the
815<code>ntp-keygen(1ntpkeygenmdoc)</code>
816utility program, including symmetric key, host key and
817public certificate files, as well as sign key, identity parameters
818and leapseconds files. 
819Alternatively, host and sign keys and
820certificate files can be generated by the OpenSSL utilities
821and certificates can be imported from public certificate
822authorities. 
823Note that symmetric keys are necessary for the
824<code>ntpq(1ntpqmdoc)</code>
825and
826<code>ntpdc(1ntpdcmdoc)</code>
827utility programs. 
828The remaining files are necessary only for the
829Autokey protocol.
830
831  <p>Certificates imported from OpenSSL or public certificate
832authorities have certian limitations. 
833The certificate should be in ASN.1 syntax, X.509 Version 3
834format and encoded in PEM, which is the same format
835used by OpenSSL. 
836The overall length of the certificate encoded
837in ASN.1 must not exceed 1024 bytes. 
838The subject distinguished
839name field (CN) is the fully qualified name of the host
840on which it is used; the remaining subject fields are ignored. 
841The certificate extension fields must not contain either
842a subject key identifier or a issuer key identifier field;
843however, an extended key usage field for a trusted host must
844contain the value
845<code>trustRoot</code>;. 
846Other extension fields are ignored.
847
848<h5 class="subsubsection">Authentication Commands</h5>
849
850     <dl>
851<dt><code>autokey</code> <code>[</code><kbd>logsec</kbd><code>]</code><dd>Specifies the interval between regenerations of the session key
852list used with the Autokey protocol. 
853Note that the size of the key
854list for each association depends on this interval and the current
855poll interval. 
856The default value is 12 (4096 s or about 1.1 hours). 
857For poll intervals above the specified interval, a session key list
858with a single entry will be regenerated for every message
859sent. 
860<br><dt><code>controlkey</code> <kbd>key</kbd><dd>Specifies the key identifier to use with the
861<code>ntpq(1ntpqmdoc)</code>
862utility, which uses the standard
863protocol defined in RFC-1305. 
864The
865<kbd>key</kbd>
866argument is
867the key identifier for a trusted key, where the value can be in the
868range 1 to 65,534, inclusive. 
869<br><dt><code>crypto</code> <code>[cert </code><kbd>file</kbd><code>]</code> <code>[leap </code><kbd>file</kbd><code>]</code> <code>[randfile </code><kbd>file</kbd><code>]</code> <code>[host </code><kbd>file</kbd><code>]</code> <code>[sign </code><kbd>file</kbd><code>]</code> <code>[gq </code><kbd>file</kbd><code>]</code> <code>[gqpar </code><kbd>file</kbd><code>]</code> <code>[iffpar </code><kbd>file</kbd><code>]</code> <code>[mvpar </code><kbd>file</kbd><code>]</code> <code>[pw </code><kbd>password</kbd><code>]</code><dd>This command requires the OpenSSL library. 
870It activates public key
871cryptography, selects the message digest and signature
872encryption scheme and loads the required private and public
873values described above. 
874If one or more files are left unspecified,
875the default names are used as described above. 
876Unless the complete path and name of the file are specified, the
877location of a file is relative to the keys directory specified
878in the
879<code>keysdir</code>
880command or default
881<span class="file">/usr/local/etc</span>. 
882Following are the subcommands:
883          <dl>
884<dt><code>cert</code> <kbd>file</kbd><dd>Specifies the location of the required host public certificate file. 
885This overrides the link
886<span class="file">ntpkey_cert_</span><kbd>hostname</kbd>
887in the keys directory. 
888<br><dt><code>gqpar</code> <kbd>file</kbd><dd>Specifies the location of the optional GQ parameters file. 
889This
890overrides the link
891<span class="file">ntpkey_gq_</span><kbd>hostname</kbd>
892in the keys directory. 
893<br><dt><code>host</code> <kbd>file</kbd><dd>Specifies the location of the required host key file. 
894This overrides
895the link
896<span class="file">ntpkey_key_</span><kbd>hostname</kbd>
897in the keys directory. 
898<br><dt><code>iffpar</code> <kbd>file</kbd><dd>Specifies the location of the optional IFF parameters file.This
899overrides the link
900<span class="file">ntpkey_iff_</span><kbd>hostname</kbd>
901in the keys directory. 
902<br><dt><code>leap</code> <kbd>file</kbd><dd>Specifies the location of the optional leapsecond file. 
903This overrides the link
904<span class="file">ntpkey_leap</span>
905in the keys directory. 
906<br><dt><code>mvpar</code> <kbd>file</kbd><dd>Specifies the location of the optional MV parameters file. 
907This
908overrides the link
909<span class="file">ntpkey_mv_</span><kbd>hostname</kbd>
910in the keys directory. 
911<br><dt><code>pw</code> <kbd>password</kbd><dd>Specifies the password to decrypt files containing private keys and
912identity parameters. 
913This is required only if these files have been
914encrypted. 
915<br><dt><code>randfile</code> <kbd>file</kbd><dd>Specifies the location of the random seed file used by the OpenSSL
916library. 
917The defaults are described in the main text above. 
918<br><dt><code>sign</code> <kbd>file</kbd><dd>Specifies the location of the optional sign key file. 
919This overrides
920the link
921<span class="file">ntpkey_sign_</span><kbd>hostname</kbd>
922in the keys directory. 
923If this file is
924not found, the host key is also the sign key. 
925</dl>
926     <br><dt><code>keys</code> <kbd>keyfile</kbd><dd>Specifies the complete path and location of the MD5 key file
927containing the keys and key identifiers used by
928<code>ntpd(1ntpdmdoc)</code>,
929<code>ntpq(1ntpqmdoc)</code>
930and
931<code>ntpdc(1ntpdcmdoc)</code>
932when operating with symmetric key cryptography. 
933This is the same operation as the
934<code>-k</code>
935command line option. 
936<br><dt><code>keysdir</code> <kbd>path</kbd><dd>This command specifies the default directory path for
937cryptographic keys, parameters and certificates. 
938The default is
939<span class="file">/usr/local/etc/</span>. 
940<br><dt><code>requestkey</code> <kbd>key</kbd><dd>Specifies the key identifier to use with the
941<code>ntpdc(1ntpdcmdoc)</code>
942utility program, which uses a
943proprietary protocol specific to this implementation of
944<code>ntpd(1ntpdmdoc)</code>. 
945The
946<kbd>key</kbd>
947argument is a key identifier
948for the trusted key, where the value can be in the range 1 to
94965,534, inclusive. 
950<br><dt><code>revoke</code> <kbd>logsec</kbd><dd>Specifies the interval between re-randomization of certain
951cryptographic values used by the Autokey scheme, as a power of 2 in
952seconds. 
953These values need to be updated frequently in order to
954deflect brute-force attacks on the algorithms of the scheme;
955however, updating some values is a relatively expensive operation. 
956The default interval is 16 (65,536 s or about 18 hours). 
957For poll
958intervals above the specified interval, the values will be updated
959for every message sent. 
960<br><dt><code>trustedkey</code> <kbd>key</kbd> <kbd>...</kbd><dd>Specifies the key identifiers which are trusted for the
961purposes of authenticating peers with symmetric key cryptography,
962as well as keys used by the
963<code>ntpq(1ntpqmdoc)</code>
964and
965<code>ntpdc(1ntpdcmdoc)</code>
966programs. 
967The authentication procedures require that both the local
968and remote servers share the same key and key identifier for this
969purpose, although different keys can be used with different
970servers. 
971The
972<kbd>key</kbd>
973arguments are 32-bit unsigned
974integers with values from 1 to 65,534. 
975</dl>
976
977<h5 class="subsubsection">Error Codes</h5>
978
979<p>The following error codes are reported via the NTP control
980and monitoring protocol trap mechanism.
981     <dl>
982<dt>101<dd>(bad field format or length)
983The packet has invalid version, length or format. 
984<br><dt>102<dd>(bad timestamp)
985The packet timestamp is the same or older than the most recent received. 
986This could be due to a replay or a server clock time step. 
987<br><dt>103<dd>(bad filestamp)
988The packet filestamp is the same or older than the most recent received. 
989This could be due to a replay or a key file generation error. 
990<br><dt>104<dd>(bad or missing public key)
991The public key is missing, has incorrect format or is an unsupported type. 
992<br><dt>105<dd>(unsupported digest type)
993The server requires an unsupported digest/signature scheme. 
994<br><dt>106<dd>(mismatched digest types)
995Not used. 
996<br><dt>107<dd>(bad signature length)
997The signature length does not match the current public key. 
998<br><dt>108<dd>(signature not verified)
999The message fails the signature check. 
1000It could be bogus or signed by a
1001different private key. 
1002<br><dt>109<dd>(certificate not verified)
1003The certificate is invalid or signed with the wrong key. 
1004<br><dt>110<dd>(certificate not verified)
1005The certificate is not yet valid or has expired or the signature could not
1006be verified. 
1007<br><dt>111<dd>(bad or missing cookie)
1008The cookie is missing, corrupted or bogus. 
1009<br><dt>112<dd>(bad or missing leapseconds table)
1010The leapseconds table is missing, corrupted or bogus. 
1011<br><dt>113<dd>(bad or missing certificate)
1012The certificate is missing, corrupted or bogus. 
1013<br><dt>114<dd>(bad or missing identity)
1014The identity key is missing, corrupt or bogus. 
1015</dl>
1016  <div class="node">
1017<p><hr>
1018<a name="Monitoring-Support"></a>
1019<br>
1020</div>
1021
1022<h4 class="subsection">Monitoring Support</h4>
1023
1024<p><code>ntpd(1ntpdmdoc)</code>
1025includes a comprehensive monitoring facility suitable
1026for continuous, long term recording of server and client
1027timekeeping performance. 
1028See the
1029<code>statistics</code>
1030command below
1031for a listing and example of each type of statistics currently
1032supported. 
1033Statistic files are managed using file generation sets
1034and scripts in the
1035<span class="file">./scripts</span>
1036directory of this distribution. 
1037Using
1038these facilities and
1039<span class="sc">unix</span>
1040<code>cron(8)</code>
1041jobs, the data can be
1042automatically summarized and archived for retrospective analysis.
1043
1044<h5 class="subsubsection">Monitoring Commands</h5>
1045
1046     <dl>
1047<dt><code>statistics</code> <kbd>name</kbd> <kbd>...</kbd><dd>Enables writing of statistics records. 
1048Currently, eight kinds of
1049<kbd>name</kbd>
1050statistics are supported.
1051          <dl>
1052<dt><code>clockstats</code><dd>Enables recording of clock driver statistics information. 
1053Each update
1054received from a clock driver appends a line of the following form to
1055the file generation set named
1056<code>clockstats</code>:
1057<pre class="verbatim">          
1058          49213 525.624 127.127.4.1 93 226 00:08:29.606 D
1059     </pre>
1060
1061          <p>The first two fields show the date (Modified Julian Day) and time
1062(seconds and fraction past UTC midnight). 
1063The next field shows the
1064clock address in dotted-quad notation. 
1065The final field shows the last
1066timecode received from the clock in decoded ASCII format, where
1067meaningful. 
1068In some clock drivers a good deal of additional information
1069can be gathered and displayed as well. 
1070See information specific to each
1071clock for further details. 
1072<br><dt><code>cryptostats</code><dd>This option requires the OpenSSL cryptographic software library. 
1073It
1074enables recording of cryptographic public key protocol information. 
1075Each message received by the protocol module appends a line of the
1076following form to the file generation set named
1077<code>cryptostats</code>:
1078<pre class="verbatim">          
1079          49213 525.624 127.127.4.1 message
1080     </pre>
1081
1082          <p>The first two fields show the date (Modified Julian Day) and time
1083(seconds and fraction past UTC midnight). 
1084The next field shows the peer
1085address in dotted-quad notation, The final message field includes the
1086message type and certain ancillary information. 
1087See the
1088<a href="#Authentication-Options">Authentication Options</a>
1089section for further information. 
1090<br><dt><code>loopstats</code><dd>Enables recording of loop filter statistics information. 
1091Each
1092update of the local clock outputs a line of the following form to
1093the file generation set named
1094<code>loopstats</code>:
1095<pre class="verbatim">          
1096          50935 75440.031 0.000006019 13.778190 0.000351733 0.0133806
1097     </pre>
1098
1099          <p>The first two fields show the date (Modified Julian Day) and
1100time (seconds and fraction past UTC midnight). 
1101The next five fields
1102show time offset (seconds), frequency offset (parts per million -
1103PPM), RMS jitter (seconds), Allan deviation (PPM) and clock
1104discipline time constant. 
1105<br><dt><code>peerstats</code><dd>Enables recording of peer statistics information. 
1106This includes
1107statistics records of all peers of a NTP server and of special
1108signals, where present and configured. 
1109Each valid update appends a
1110line of the following form to the current element of a file
1111generation set named
1112<code>peerstats</code>:
1113<pre class="verbatim">          
1114          48773 10847.650 127.127.4.1 9714 -0.001605376 0.000000000 0.001424877 0.000958674
1115     </pre>
1116
1117          <p>The first two fields show the date (Modified Julian Day) and
1118time (seconds and fraction past UTC midnight). 
1119The next two fields
1120show the peer address in dotted-quad notation and status,
1121respectively. 
1122The status field is encoded in hex in the format
1123described in Appendix A of the NTP specification RFC 1305. 
1124The final four fields show the offset,
1125delay, dispersion and RMS jitter, all in seconds. 
1126<br><dt><code>rawstats</code><dd>Enables recording of raw-timestamp statistics information. 
1127This
1128includes statistics records of all peers of a NTP server and of
1129special signals, where present and configured. 
1130Each NTP message
1131received from a peer or clock driver appends a line of the
1132following form to the file generation set named
1133<code>rawstats</code>:
1134<pre class="verbatim">          
1135          50928 2132.543 128.4.1.1 128.4.1.20 3102453281.584327000 3102453281.58622800031 02453332.540806000 3102453332.541458000
1136     </pre>
1137
1138          <p>The first two fields show the date (Modified Julian Day) and
1139time (seconds and fraction past UTC midnight). 
1140The next two fields
1141show the remote peer or clock address followed by the local address
1142in dotted-quad notation. 
1143The final four fields show the originate,
1144receive, transmit and final NTP timestamps in order. 
1145The timestamp
1146values are as received and before processing by the various data
1147smoothing and mitigation algorithms. 
1148<br><dt><code>sysstats</code><dd>Enables recording of ntpd statistics counters on a periodic basis. 
1149Each
1150hour a line of the following form is appended to the file generation
1151set named
1152<code>sysstats</code>:
1153<pre class="verbatim">          
1154          50928 2132.543 36000 81965 0 9546 56 71793 512 540 10 147
1155     </pre>
1156
1157          <p>The first two fields show the date (Modified Julian Day) and time
1158(seconds and fraction past UTC midnight). 
1159The remaining ten fields show
1160the statistics counter values accumulated since the last generated
1161line.
1162               <dl>
1163<dt>Time since restart <code>36000</code><dd>Time in hours since the system was last rebooted. 
1164<br><dt>Packets received <code>81965</code><dd>Total number of packets received. 
1165<br><dt>Packets processed <code>0</code><dd>Number of packets received in response to previous packets sent
1166<br><dt>Current version <code>9546</code><dd>Number of packets matching the current NTP version. 
1167<br><dt>Previous version <code>56</code><dd>Number of packets matching the previous NTP version. 
1168<br><dt>Bad version <code>71793</code><dd>Number of packets matching neither NTP version. 
1169<br><dt>Access denied <code>512</code><dd>Number of packets denied access for any reason. 
1170<br><dt>Bad length or format <code>540</code><dd>Number of packets with invalid length, format or port number. 
1171<br><dt>Bad authentication <code>10</code><dd>Number of packets not verified as authentic. 
1172<br><dt>Rate exceeded <code>147</code><dd>Number of packets discarded due to rate limitation. 
1173</dl>
1174          <br><dt><code>statsdir</code> <kbd>directory_path</kbd><dd>Indicates the full path of a directory where statistics files
1175should be created (see below). 
1176This keyword allows
1177the (otherwise constant)
1178<code>filegen</code>
1179filename prefix to be modified for file generation sets, which
1180is useful for handling statistics logs. 
1181<br><dt><code>filegen</code> <kbd>name</kbd> <code>[file </code><kbd>filename</kbd><code>]</code> <code>[type </code><kbd>typename</kbd><code>]</code> <code>[link | nolink]</code> <code>[enable | disable]</code><dd>Configures setting of generation file set name. 
1182Generation
1183file sets provide a means for handling files that are
1184continuously growing during the lifetime of a server. 
1185Server statistics are a typical example for such files. 
1186Generation file sets provide access to a set of files used
1187to store the actual data. 
1188At any time at most one element
1189of the set is being written to. 
1190The type given specifies
1191when and how data will be directed to a new element of the set. 
1192This way, information stored in elements of a file set
1193that are currently unused are available for administrational
1194operations without the risk of disturbing the operation of ntpd. 
1195(Most important: they can be removed to free space for new data
1196produced.)
1197
1198          <p>Note that this command can be sent from the
1199<code>ntpdc(1ntpdcmdoc)</code>
1200program running at a remote location.
1201               <dl>
1202<dt><code>name</code><dd>This is the type of the statistics records, as shown in the
1203<code>statistics</code>
1204command. 
1205<br><dt><code>file</code> <kbd>filename</kbd><dd>This is the file name for the statistics records. 
1206Filenames of set
1207members are built from three concatenated elements
1208<code>prefix</code>,
1209<code>filename</code>
1210and
1211<code>suffix</code>:
1212                    <dl>
1213<dt><code>prefix</code><dd>This is a constant filename path. 
1214It is not subject to
1215modifications via the
1216<kbd>filegen</kbd>
1217option. 
1218It is defined by the
1219server, usually specified as a compile-time constant. 
1220It may,
1221however, be configurable for individual file generation sets
1222via other commands. 
1223For example, the prefix used with
1224<kbd>loopstats</kbd>
1225and
1226<kbd>peerstats</kbd>
1227generation can be configured using the
1228<kbd>statsdir</kbd>
1229option explained above. 
1230<br><dt><code>filename</code><dd>This string is directly concatenated to the prefix mentioned
1231above (no intervening
1232/). 
1233This can be modified using
1234the file argument to the
1235<kbd>filegen</kbd>
1236statement. 
1237No
1238<span class="file">..</span>
1239elements are
1240allowed in this component to prevent filenames referring to
1241parts outside the filesystem hierarchy denoted by
1242<kbd>prefix</kbd>. 
1243<br><dt><code>suffix</code><dd>This part is reflects individual elements of a file set. 
1244It is
1245generated according to the type of a file set. 
1246</dl>
1247               <br><dt><code>type</code> <kbd>typename</kbd><dd>A file generation set is characterized by its type. 
1248The following
1249types are supported:
1250                    <dl>
1251<dt><code>none</code><dd>The file set is actually a single plain file. 
1252<br><dt><code>pid</code><dd>One element of file set is used per incarnation of a ntpd
1253server. 
1254This type does not perform any changes to file set
1255members during runtime, however it provides an easy way of
1256separating files belonging to different
1257<code>ntpd(1ntpdmdoc)</code>
1258server incarnations. 
1259The set member filename is built by appending a
1260. 
1261to concatenated
1262<kbd>prefix</kbd>
1263and
1264<kbd>filename</kbd>
1265strings, and
1266appending the decimal representation of the process ID of the
1267<code>ntpd(1ntpdmdoc)</code>
1268server process. 
1269<br><dt><code>day</code><dd>One file generation set element is created per day. 
1270A day is
1271defined as the period between 00:00 and 24:00 UTC. 
1272The file set
1273member suffix consists of a
1274. 
1275and a day specification in
1276the form
1277<code>YYYYMMdd</code>. 
1278<code>YYYY</code>
1279is a 4-digit year number (e.g., 1992). 
1280<code>MM</code>
1281is a two digit month number. 
1282<code>dd</code>
1283is a two digit day number. 
1284Thus, all information written at 10 December 1992 would end up
1285in a file named
1286<kbd>prefix</kbd>
1287<kbd>filename</kbd>.19921210. 
1288<br><dt><code>week</code><dd>Any file set member contains data related to a certain week of
1289a year. 
1290The term week is defined by computing day-of-year
1291modulo 7. 
1292Elements of such a file generation set are
1293distinguished by appending the following suffix to the file set
1294filename base: A dot, a 4-digit year number, the letter
1295<code>W</code>,
1296and a 2-digit week number. 
1297For example, information from January,
129810th 1992 would end up in a file with suffix
1299.No . Ns Ar 1992W1 . 
1300<br><dt><code>month</code><dd>One generation file set element is generated per month. 
1301The
1302file name suffix consists of a dot, a 4-digit year number, and
1303a 2-digit month. 
1304<br><dt><code>year</code><dd>One generation file element is generated per year. 
1305The filename
1306suffix consists of a dot and a 4 digit year number. 
1307<br><dt><code>age</code><dd>This type of file generation sets changes to a new element of
1308the file set every 24 hours of server operation. 
1309The filename
1310suffix consists of a dot, the letter
1311<code>a</code>,
1312and an 8-digit number. 
1313This number is taken to be the number of seconds the server is
1314running at the start of the corresponding 24-hour period. 
1315Information is only written to a file generation by specifying
1316<code>enable</code>;
1317output is prevented by specifying
1318<code>disable</code>. 
1319</dl>
1320               <br><dt><code>link</code> | <code>nolink</code><dd>It is convenient to be able to access the current element of a file
1321generation set by a fixed name. 
1322This feature is enabled by
1323specifying
1324<code>link</code>
1325and disabled using
1326<code>nolink</code>. 
1327If link is specified, a
1328hard link from the current file set element to a file without
1329suffix is created. 
1330When there is already a file with this name and
1331the number of links of this file is one, it is renamed appending a
1332dot, the letter
1333<code>C</code>,
1334and the pid of the ntpd server process. 
1335When the
1336number of links is greater than one, the file is unlinked. 
1337This
1338allows the current file to be accessed by a constant name. 
1339<br><dt><code>enable</code> <code>|</code> <code>disable</code><dd>Enables or disables the recording function. 
1340</dl>
1341          </dl>
1342     </dl>
1343<div class="node">
1344<p><hr>
1345<a name="Access-Control-Support"></a>
1346<br>
1347</div>
1348
1349<h4 class="subsection">Access Control Support</h4>
1350
1351<p>The
1352<code>ntpd(1ntpdmdoc)</code>
1353daemon implements a general purpose address/mask based restriction
1354list. 
1355The list contains address/match entries sorted first
1356by increasing address values and and then by increasing mask values. 
1357A match occurs when the bitwise AND of the mask and the packet
1358source address is equal to the bitwise AND of the mask and
1359address in the list. 
1360The list is searched in order with the
1361last match found defining the restriction flags associated
1362with the entry. 
1363Additional information and examples can be found in the
1364"Notes on Configuring NTP and Setting up a NTP Subnet"
1365page
1366(available as part of the HTML documentation
1367provided in
1368<span class="file">/usr/share/doc/ntp</span>).
1369
1370  <p>The restriction facility was implemented in conformance
1371with the access policies for the original NSFnet backbone
1372time servers. 
1373Later the facility was expanded to deflect
1374cryptographic and clogging attacks. 
1375While this facility may
1376be useful for keeping unwanted or broken or malicious clients
1377from congesting innocent servers, it should not be considered
1378an alternative to the NTP authentication facilities. 
1379Source address based restrictions are easily circumvented
1380by a determined cracker.
1381
1382  <p>Clients can be denied service because they are explicitly
1383included in the restrict list created by the
1384<code>restrict</code>
1385command
1386or implicitly as the result of cryptographic or rate limit
1387violations. 
1388Cryptographic violations include certificate
1389or identity verification failure; rate limit violations generally
1390result from defective NTP implementations that send packets
1391at abusive rates. 
1392Some violations cause denied service
1393only for the offending packet, others cause denied service
1394for a timed period and others cause the denied service for
1395an indefinate period. 
1396When a client or network is denied access
1397for an indefinate period, the only way at present to remove
1398the restrictions is by restarting the server.
1399
1400<h5 class="subsubsection">The Kiss-of-Death Packet</h5>
1401
1402<p>Ordinarily, packets denied service are simply dropped with no
1403further action except incrementing statistics counters. 
1404Sometimes a
1405more proactive response is needed, such as a server message that
1406explicitly requests the client to stop sending and leave a message
1407for the system operator. 
1408A special packet format has been created
1409for this purpose called the "kiss-of-death" (KoD) packet. 
1410KoD packets have the leap bits set unsynchronized and stratum set
1411to zero and the reference identifier field set to a four-byte
1412ASCII code. 
1413If the
1414<code>noserve</code>
1415or
1416<code>notrust</code>
1417flag of the matching restrict list entry is set,
1418the code is "DENY"; if the
1419<code>limited</code>
1420flag is set and the rate limit
1421is exceeded, the code is "RATE". 
1422Finally, if a cryptographic violation occurs, the code is "CRYP".
1423
1424  <p>A client receiving a KoD performs a set of sanity checks to
1425minimize security exposure, then updates the stratum and
1426reference identifier peer variables, sets the access
1427denied (TEST4) bit in the peer flash variable and sends
1428a message to the log. 
1429As long as the TEST4 bit is set,
1430the client will send no further packets to the server. 
1431The only way at present to recover from this condition is
1432to restart the protocol at both the client and server. 
1433This
1434happens automatically at the client when the association times out. 
1435It will happen at the server only if the server operator cooperates.
1436
1437<h5 class="subsubsection">Access Control Commands</h5>
1438
1439     <dl>
1440<dt><code>discard</code> <code>[average </code><kbd>avg</kbd><code>]</code> <code>[minimum </code><kbd>min</kbd><code>]</code> <code>[monitor </code><kbd>prob</kbd><code>]</code><dd>Set the parameters of the
1441<code>limited</code>
1442facility which protects the server from
1443client abuse. 
1444The
1445<code>average</code>
1446subcommand specifies the minimum average packet
1447spacing, while the
1448<code>minimum</code>
1449subcommand specifies the minimum packet spacing. 
1450Packets that violate these minima are discarded
1451and a kiss-o'-death packet returned if enabled. 
1452The default
1453minimum average and minimum are 5 and 2, respectively. 
1454The
1455<code>monitor</code>
1456subcommand specifies the probability of discard
1457for packets that overflow the rate-control window. 
1458<br><dt><code>restrict</code> <code>address</code> <code>[mask </code><kbd>mask</kbd><code>]</code> <code>[</code><kbd>flag</kbd> <kbd>...</kbd><code>]</code><dd>The
1459<kbd>address</kbd>
1460argument expressed in
1461dotted-quad form is the address of a host or network. 
1462Alternatively, the
1463<kbd>address</kbd>
1464argument can be a valid host DNS name. 
1465The
1466<kbd>mask</kbd>
1467argument expressed in dotted-quad form defaults to
1468<code>255.255.255.255</code>,
1469meaning that the
1470<kbd>address</kbd>
1471is treated as the address of an individual host. 
1472A default entry (address
1473<code>0.0.0.0</code>,
1474mask
1475<code>0.0.0.0</code>)
1476is always included and is always the first entry in the list. 
1477Note that text string
1478<code>default</code>,
1479with no mask option, may
1480be used to indicate the default entry. 
1481In the current implementation,
1482<code>flag</code>
1483always
1484restricts access, i.e., an entry with no flags indicates that free
1485access to the server is to be given. 
1486The flags are not orthogonal,
1487in that more restrictive flags will often make less restrictive
1488ones redundant. 
1489The flags can generally be classed into two
1490categories, those which restrict time service and those which
1491restrict informational queries and attempts to do run-time
1492reconfiguration of the server. 
1493One or more of the following flags
1494may be specified:
1495          <dl>
1496<dt><code>ignore</code><dd>Deny packets of all kinds, including
1497<code>ntpq(1ntpqmdoc)</code>
1498and
1499<code>ntpdc(1ntpdcmdoc)</code>
1500queries. 
1501<br><dt><code>kod</code><dd>If this flag is set when an access violation occurs, a kiss-o'-death
1502(KoD) packet is sent. 
1503KoD packets are rate limited to no more than one
1504per second. 
1505If another KoD packet occurs within one second after the
1506last one, the packet is dropped. 
1507<br><dt><code>limited</code><dd>Deny service if the packet spacing violates the lower limits specified
1508in the
1509<code>discard</code>
1510command. 
1511A history of clients is kept using the
1512monitoring capability of
1513<code>ntpd(1ntpdmdoc)</code>. 
1514Thus, monitoring is always active as
1515long as there is a restriction entry with the
1516<code>limited</code>
1517flag. 
1518<br><dt><code>lowpriotrap</code><dd>Declare traps set by matching hosts to be low priority. 
1519The
1520number of traps a server can maintain is limited (the current limit
1521is 3). 
1522Traps are usually assigned on a first come, first served
1523basis, with later trap requestors being denied service. 
1524This flag
1525modifies the assignment algorithm by allowing low priority traps to
1526be overridden by later requests for normal priority traps. 
1527<br><dt><code>nomodify</code><dd>Deny
1528<code>ntpq(1ntpqmdoc)</code>
1529and
1530<code>ntpdc(1ntpdcmdoc)</code>
1531queries which attempt to modify the state of the
1532server (i.e., run time reconfiguration). 
1533Queries which return
1534information are permitted. 
1535<br><dt><code>noquery</code><dd>Deny
1536<code>ntpq(1ntpqmdoc)</code>
1537and
1538<code>ntpdc(1ntpdcmdoc)</code>
1539queries. 
1540Time service is not affected. 
1541<br><dt><code>nopeer</code><dd>Deny packets which would result in mobilizing a new association. 
1542This
1543includes broadcast and symmetric active packets when a configured
1544association does not exist. 
1545It also includes
1546<code>pool</code>
1547associations, so if you want to use servers from a
1548<code>pool</code>
1549directive and also want to use
1550<code>nopeer</code>
1551by default, you'll want a
1552<code>restrict source ...</code> <code>line</code> <code>as</code> <code>well</code> <code>that</code> <code>does</code>
1553<br><dt>not<dd>include the
1554<code>nopeer</code>
1555directive. 
1556<br><dt><code>noserve</code><dd>Deny all packets except
1557<code>ntpq(1ntpqmdoc)</code>
1558and
1559<code>ntpdc(1ntpdcmdoc)</code>
1560queries. 
1561<br><dt><code>notrap</code><dd>Decline to provide mode 6 control message trap service to matching
1562hosts. 
1563The trap service is a subsystem of the ntpdq control message
1564protocol which is intended for use by remote event logging programs. 
1565<br><dt><code>notrust</code><dd>Deny service unless the packet is cryptographically authenticated. 
1566<br><dt><code>ntpport</code><dd>This is actually a match algorithm modifier, rather than a
1567restriction flag. 
1568Its presence causes the restriction entry to be
1569matched only if the source port in the packet is the standard NTP
1570UDP port (123). 
1571Both
1572<code>ntpport</code>
1573and
1574<code>non-ntpport</code>
1575may
1576be specified. 
1577The
1578<code>ntpport</code>
1579is considered more specific and
1580is sorted later in the list. 
1581<br><dt><code>version</code><dd>Deny packets that do not match the current NTP version. 
1582</dl>
1583
1584     <p>Default restriction list entries with the flags ignore, interface,
1585ntpport, for each of the local host's interface addresses are
1586inserted into the table at startup to prevent the server
1587from attempting to synchronize to its own time. 
1588A default entry is also always present, though if it is
1589otherwise unconfigured; no flags are associated
1590with the default entry (i.e., everything besides your own
1591NTP server is unrestricted). 
1592</dl>
1593<div class="node">
1594<p><hr>
1595<a name="Automatic-NTP-Configuration-Options"></a>
1596<br>
1597</div>
1598
1599<h4 class="subsection">Automatic NTP Configuration Options</h4>
1600
1601<h5 class="subsubsection">Manycasting</h5>
1602
1603<p>Manycasting is a automatic discovery and configuration paradigm
1604new to NTPv4. 
1605It is intended as a means for a multicast client
1606to troll the nearby network neighborhood to find cooperating
1607manycast servers, validate them using cryptographic means
1608and evaluate their time values with respect to other servers
1609that might be lurking in the vicinity. 
1610The intended result is that each manycast client mobilizes
1611client associations with some number of the "best"
1612of the nearby manycast servers, yet automatically reconfigures
1613to sustain this number of servers should one or another fail.
1614
1615  <p>Note that the manycasting paradigm does not coincide
1616with the anycast paradigm described in RFC-1546,
1617which is designed to find a single server from a clique
1618of servers providing the same service. 
1619The manycast paradigm is designed to find a plurality
1620of redundant servers satisfying defined optimality criteria.
1621
1622  <p>Manycasting can be used with either symmetric key
1623or public key cryptography. 
1624The public key infrastructure (PKI)
1625offers the best protection against compromised keys
1626and is generally considered stronger, at least with relatively
1627large key sizes. 
1628It is implemented using the Autokey protocol and
1629the OpenSSL cryptographic library available from
1630<code>http://www.openssl.org/</code>. 
1631The library can also be used with other NTPv4 modes
1632as well and is highly recommended, especially for broadcast modes.
1633
1634  <p>A persistent manycast client association is configured
1635using the
1636<code>manycastclient</code>
1637command, which is similar to the
1638<code>server</code>
1639command but with a multicast (IPv4 class
1640<code>D</code>
1641or IPv6 prefix
1642<code>FF</code>)
1643group address. 
1644The IANA has designated IPv4 address 224.1.1.1
1645and IPv6 address FF05::101 (site local) for NTP. 
1646When more servers are needed, it broadcasts manycast
1647client messages to this address at the minimum feasible rate
1648and minimum feasible time-to-live (TTL) hops, depending
1649on how many servers have already been found. 
1650There can be as many manycast client associations
1651as different group address, each one serving as a template
1652for a future ephemeral unicast client/server association.
1653
1654  <p>Manycast servers configured with the
1655<code>manycastserver</code>
1656command listen on the specified group address for manycast
1657client messages. 
1658Note the distinction between manycast client,
1659which actively broadcasts messages, and manycast server,
1660which passively responds to them. 
1661If a manycast server is
1662in scope of the current TTL and is itself synchronized
1663to a valid source and operating at a stratum level equal
1664to or lower than the manycast client, it replies to the
1665manycast client message with an ordinary unicast server message.
1666
1667  <p>The manycast client receiving this message mobilizes
1668an ephemeral client/server association according to the
1669matching manycast client template, but only if cryptographically
1670authenticated and the server stratum is less than or equal
1671to the client stratum. 
1672Authentication is explicitly required
1673and either symmetric key or public key (Autokey) can be used. 
1674Then, the client polls the server at its unicast address
1675in burst mode in order to reliably set the host clock
1676and validate the source. 
1677This normally results
1678in a volley of eight client/server at 2-s intervals
1679during which both the synchronization and cryptographic
1680protocols run concurrently. 
1681Following the volley,
1682the client runs the NTP intersection and clustering
1683algorithms, which act to discard all but the "best"
1684associations according to stratum and synchronization
1685distance. 
1686The surviving associations then continue
1687in ordinary client/server mode.
1688
1689  <p>The manycast client polling strategy is designed to reduce
1690as much as possible the volume of manycast client messages
1691and the effects of implosion due to near-simultaneous
1692arrival of manycast server messages. 
1693The strategy is determined by the
1694<code>manycastclient</code>,
1695<code>tos</code>
1696and
1697<code>ttl</code>
1698configuration commands. 
1699The manycast poll interval is
1700normally eight times the system poll interval,
1701which starts out at the
1702<code>minpoll</code>
1703value specified in the
1704<code>manycastclient</code>,
1705command and, under normal circumstances, increments to the
1706<code>maxpolll</code>
1707value specified in this command. 
1708Initially, the TTL is
1709set at the minimum hops specified by the
1710<code>ttl</code>
1711command. 
1712At each retransmission the TTL is increased until reaching
1713the maximum hops specified by this command or a sufficient
1714number client associations have been found. 
1715Further retransmissions use the same TTL.
1716
1717  <p>The quality and reliability of the suite of associations
1718discovered by the manycast client is determined by the NTP
1719mitigation algorithms and the
1720<code>minclock</code>
1721and
1722<code>minsane</code>
1723values specified in the
1724<code>tos</code>
1725configuration command. 
1726At least
1727<code>minsane</code>
1728candidate servers must be available and the mitigation
1729algorithms produce at least
1730<code>minclock</code>
1731survivors in order to synchronize the clock. 
1732Byzantine agreement principles require at least four
1733candidates in order to correctly discard a single falseticker. 
1734For legacy purposes,
1735<code>minsane</code>
1736defaults to 1 and
1737<code>minclock</code>
1738defaults to 3. 
1739For manycast service
1740<code>minsane</code>
1741should be explicitly set to 4, assuming at least that
1742number of servers are available.
1743
1744  <p>If at least
1745<code>minclock</code>
1746servers are found, the manycast poll interval is immediately
1747set to eight times
1748<code>maxpoll</code>. 
1749If less than
1750<code>minclock</code>
1751servers are found when the TTL has reached the maximum hops,
1752the manycast poll interval is doubled. 
1753For each transmission
1754after that, the poll interval is doubled again until
1755reaching the maximum of eight times
1756<code>maxpoll</code>. 
1757Further transmissions use the same poll interval and
1758TTL values. 
1759Note that while all this is going on,
1760each client/server association found is operating normally
1761it the system poll interval.
1762
1763  <p>Administratively scoped multicast boundaries are normally
1764specified by the network router configuration and,
1765in the case of IPv6, the link/site scope prefix. 
1766By default, the increment for TTL hops is 32 starting
1767from 31; however, the
1768<code>ttl</code>
1769configuration command can be
1770used to modify the values to match the scope rules.
1771
1772  <p>It is often useful to narrow the range of acceptable
1773servers which can be found by manycast client associations. 
1774Because manycast servers respond only when the client
1775stratum is equal to or greater than the server stratum,
1776primary (stratum 1) servers fill find only primary servers
1777in TTL range, which is probably the most common objective. 
1778However, unless configured otherwise, all manycast clients
1779in TTL range will eventually find all primary servers
1780in TTL range, which is probably not the most common
1781objective in large networks. 
1782The
1783<code>tos</code>
1784command can be used to modify this behavior. 
1785Servers with stratum below
1786<code>floor</code>
1787or above
1788<code>ceiling</code>
1789specified in the
1790<code>tos</code>
1791command are strongly discouraged during the selection
1792process; however, these servers may be temporally
1793accepted if the number of servers within TTL range is
1794less than
1795<code>minclock</code>.
1796
1797  <p>The above actions occur for each manycast client message,
1798which repeats at the designated poll interval. 
1799However, once the ephemeral client association is mobilized,
1800subsequent manycast server replies are discarded,
1801since that would result in a duplicate association. 
1802If during a poll interval the number of client associations
1803falls below
1804<code>minclock</code>,
1805all manycast client prototype associations are reset
1806to the initial poll interval and TTL hops and operation
1807resumes from the beginning. 
1808It is important to avoid
1809frequent manycast client messages, since each one requires
1810all manycast servers in TTL range to respond. 
1811The result could well be an implosion, either minor or major,
1812depending on the number of servers in range. 
1813The recommended value for
1814<code>maxpoll</code>
1815is 12 (4,096 s).
1816
1817  <p>It is possible and frequently useful to configure a host
1818as both manycast client and manycast server. 
1819A number of hosts configured this way and sharing a common
1820group address will automatically organize themselves
1821in an optimum configuration based on stratum and
1822synchronization distance. 
1823For example, consider an NTP
1824subnet of two primary servers and a hundred or more
1825dependent clients. 
1826With two exceptions, all servers
1827and clients have identical configuration files including both
1828<code>multicastclient</code>
1829and
1830<code>multicastserver</code>
1831commands using, for instance, multicast group address
1832239.1.1.1. 
1833The only exception is that each primary server
1834configuration file must include commands for the primary
1835reference source such as a GPS receiver.
1836
1837  <p>The remaining configuration files for all secondary
1838servers and clients have the same contents, except for the
1839<code>tos</code>
1840command, which is specific for each stratum level. 
1841For stratum 1 and stratum 2 servers, that command is
1842not necessary. 
1843For stratum 3 and above servers the
1844<code>floor</code>
1845value is set to the intended stratum number. 
1846Thus, all stratum 3 configuration files are identical,
1847all stratum 4 files are identical and so forth.
1848
1849  <p>Once operations have stabilized in this scenario,
1850the primary servers will find the primary reference source
1851and each other, since they both operate at the same
1852stratum (1), but not with any secondary server or client,
1853since these operate at a higher stratum. 
1854The secondary
1855servers will find the servers at the same stratum level. 
1856If one of the primary servers loses its GPS receiver,
1857it will continue to operate as a client and other clients
1858will time out the corresponding association and
1859re-associate accordingly.
1860
1861  <p>Some administrators prefer to avoid running
1862<code>ntpd(1ntpdmdoc)</code>
1863continuously and run either
1864<code>sntp(1sntpmdoc)</code>
1865or
1866<code>ntpd(1ntpdmdoc)</code>
1867<code>-q</code>
1868as a cron job. 
1869In either case the servers must be
1870configured in advance and the program fails if none are
1871available when the cron job runs. 
1872A really slick
1873application of manycast is with
1874<code>ntpd(1ntpdmdoc)</code>
1875<code>-q</code>. 
1876The program wakes up, scans the local landscape looking
1877for the usual suspects, selects the best from among
1878the rascals, sets the clock and then departs. 
1879Servers do not have to be configured in advance and
1880all clients throughout the network can have the same
1881configuration file.
1882
1883<h5 class="subsubsection">Manycast Interactions with Autokey</h5>
1884
1885<p>Each time a manycast client sends a client mode packet
1886to a multicast group address, all manycast servers
1887in scope generate a reply including the host name
1888and status word. 
1889The manycast clients then run
1890the Autokey protocol, which collects and verifies
1891all certificates involved. 
1892Following the burst interval
1893all but three survivors are cast off,
1894but the certificates remain in the local cache. 
1895It often happens that several complete signing trails
1896from the client to the primary servers are collected in this way.
1897
1898  <p>About once an hour or less often if the poll interval
1899exceeds this, the client regenerates the Autokey key list. 
1900This is in general transparent in client/server mode. 
1901However, about once per day the server private value
1902used to generate cookies is refreshed along with all
1903manycast client associations. 
1904In this case all
1905cryptographic values including certificates is refreshed. 
1906If a new certificate has been generated since
1907the last refresh epoch, it will automatically revoke
1908all prior certificates that happen to be in the
1909certificate cache. 
1910At the same time, the manycast
1911scheme starts all over from the beginning and
1912the expanding ring shrinks to the minimum and increments
1913from there while collecting all servers in scope.
1914
1915<h5 class="subsubsection">Manycast Options</h5>
1916
1917     <dl>
1918<dt><code>tos</code> <code>[ceiling </code><kbd>ceiling</kbd><code> | cohort { 0 | 1 } | floor </code><kbd>floor</kbd><code> | minclock </code><kbd>minclock</kbd><code> | minsane </code><kbd>minsane</kbd><code>]</code><dd>This command affects the clock selection and clustering
1919algorithms. 
1920It can be used to select the quality and
1921quantity of peers used to synchronize the system clock
1922and is most useful in manycast mode. 
1923The variables operate
1924as follows:
1925          <dl>
1926<dt><code>ceiling</code> <kbd>ceiling</kbd><dd>Peers with strata above
1927<code>ceiling</code>
1928will be discarded if there are at least
1929<code>minclock</code>
1930peers remaining. 
1931This value defaults to 15, but can be changed
1932to any number from 1 to 15. 
1933<br><dt><code>cohort</code> <code>{0 | 1}</code><dd>This is a binary flag which enables (0) or disables (1)
1934manycast server replies to manycast clients with the same
1935stratum level. 
1936This is useful to reduce implosions where
1937large numbers of clients with the same stratum level
1938are present. 
1939The default is to enable these replies. 
1940<br><dt><code>floor</code> <kbd>floor</kbd><dd>Peers with strata below
1941<code>floor</code>
1942will be discarded if there are at least
1943<code>minclock</code>
1944peers remaining. 
1945This value defaults to 1, but can be changed
1946to any number from 1 to 15. 
1947<br><dt><code>minclock</code> <kbd>minclock</kbd><dd>The clustering algorithm repeatedly casts out outlier
1948associations until no more than
1949<code>minclock</code>
1950associations remain. 
1951This value defaults to 3,
1952but can be changed to any number from 1 to the number of
1953configured sources. 
1954<br><dt><code>minsane</code> <kbd>minsane</kbd><dd>This is the minimum number of candidates available
1955to the clock selection algorithm in order to produce
1956one or more truechimers for the clustering algorithm. 
1957If fewer than this number are available, the clock is
1958undisciplined and allowed to run free. 
1959The default is 1
1960for legacy purposes. 
1961However, according to principles of
1962Byzantine agreement,
1963<code>minsane</code>
1964should be at least 4 in order to detect and discard
1965a single falseticker. 
1966</dl>
1967     <br><dt><code>ttl</code> <kbd>hop</kbd> <kbd>...</kbd><dd>This command specifies a list of TTL values in increasing
1968order, up to 8 values can be specified. 
1969In manycast mode these values are used in turn
1970in an expanding-ring search. 
1971The default is eight
1972multiples of 32 starting at 31. 
1973</dl>
1974<div class="node">
1975<p><hr>
1976<a name="Reference-Clock-Support"></a>
1977<br>
1978</div>
1979
1980<h4 class="subsection">Reference Clock Support</h4>
1981
1982<p>The NTP Version 4 daemon supports some three dozen different radio,
1983satellite and modem reference clocks plus a special pseudo-clock
1984used for backup or when no other clock source is available. 
1985Detailed descriptions of individual device drivers and options can
1986be found in the
1987"Reference Clock Drivers"
1988page
1989(available as part of the HTML documentation
1990provided in
1991<span class="file">/usr/share/doc/ntp</span>). 
1992Additional information can be found in the pages linked
1993there, including the
1994"Debugging Hints for Reference Clock Drivers"
1995and
1996"How To Write a Reference Clock Driver"
1997pages
1998(available as part of the HTML documentation
1999provided in
2000<span class="file">/usr/share/doc/ntp</span>). 
2001In addition, support for a PPS
2002signal is available as described in the
2003"Pulse-per-second (PPS) Signal Interfacing"
2004page
2005(available as part of the HTML documentation
2006provided in
2007<span class="file">/usr/share/doc/ntp</span>). 
2008Many
2009drivers support special line discipline/streams modules which can
2010significantly improve the accuracy using the driver. 
2011These are
2012described in the
2013"Line Disciplines and Streams Drivers"
2014page
2015(available as part of the HTML documentation
2016provided in
2017<span class="file">/usr/share/doc/ntp</span>).
2018
2019  <p>A reference clock will generally (though not always) be a radio
2020timecode receiver which is synchronized to a source of standard
2021time such as the services offered by the NRC in Canada and NIST and
2022USNO in the US. 
2023The interface between the computer and the timecode
2024receiver is device dependent, but is usually a serial port. 
2025A
2026device driver specific to each reference clock must be selected and
2027compiled in the distribution; however, most common radio, satellite
2028and modem clocks are included by default. 
2029Note that an attempt to
2030configure a reference clock when the driver has not been compiled
2031or the hardware port has not been appropriately configured results
2032in a scalding remark to the system log file, but is otherwise non
2033hazardous.
2034
2035  <p>For the purposes of configuration,
2036<code>ntpd(1ntpdmdoc)</code>
2037treats
2038reference clocks in a manner analogous to normal NTP peers as much
2039as possible. 
2040Reference clocks are identified by a syntactically
2041correct but invalid IP address, in order to distinguish them from
2042normal NTP peers. 
2043Reference clock addresses are of the form
2044<code>127.127.</code><kbd>t</kbd>.<kbd>u</kbd>,
2045where
2046<kbd>t</kbd>
2047is an integer
2048denoting the clock type and
2049<kbd>u</kbd>
2050indicates the unit
2051number in the range 0-3. 
2052While it may seem overkill, it is in fact
2053sometimes useful to configure multiple reference clocks of the same
2054type, in which case the unit numbers must be unique.
2055
2056  <p>The
2057<code>server</code>
2058command is used to configure a reference
2059clock, where the
2060<kbd>address</kbd>
2061argument in that command
2062is the clock address. 
2063The
2064<code>key</code>,
2065<code>version</code>
2066and
2067<code>ttl</code>
2068options are not used for reference clock support. 
2069The
2070<code>mode</code>
2071option is added for reference clock support, as
2072described below. 
2073The
2074<code>prefer</code>
2075option can be useful to
2076persuade the server to cherish a reference clock with somewhat more
2077enthusiasm than other reference clocks or peers. 
2078Further
2079information on this option can be found in the
2080"Mitigation Rules and the prefer Keyword"
2081(available as part of the HTML documentation
2082provided in
2083<span class="file">/usr/share/doc/ntp</span>)
2084page. 
2085The
2086<code>minpoll</code>
2087and
2088<code>maxpoll</code>
2089options have
2090meaning only for selected clock drivers. 
2091See the individual clock
2092driver document pages for additional information.
2093
2094  <p>The
2095<code>fudge</code>
2096command is used to provide additional
2097information for individual clock drivers and normally follows
2098immediately after the
2099<code>server</code>
2100command. 
2101The
2102<kbd>address</kbd>
2103argument specifies the clock address. 
2104The
2105<code>refid</code>
2106and
2107<code>stratum</code>
2108options can be used to
2109override the defaults for the device. 
2110There are two optional
2111device-dependent time offsets and four flags that can be included
2112in the
2113<code>fudge</code>
2114command as well.
2115
2116  <p>The stratum number of a reference clock is by default zero. 
2117Since the
2118<code>ntpd(1ntpdmdoc)</code>
2119daemon adds one to the stratum of each
2120peer, a primary server ordinarily displays an external stratum of
2121one. 
2122In order to provide engineered backups, it is often useful to
2123specify the reference clock stratum as greater than zero. 
2124The
2125<code>stratum</code>
2126option is used for this purpose. 
2127Also, in cases
2128involving both a reference clock and a pulse-per-second (PPS)
2129discipline signal, it is useful to specify the reference clock
2130identifier as other than the default, depending on the driver. 
2131The
2132<code>refid</code>
2133option is used for this purpose. 
2134Except where noted,
2135these options apply to all clock drivers.
2136
2137<h5 class="subsubsection">Reference Clock Commands</h5>
2138
2139     <dl>
2140<dt><code>server</code> <code>127.127.</code><kbd>t</kbd>.<kbd>u</kbd> <code>[prefer]</code> <code>[mode </code><kbd>int</kbd><code>]</code> <code>[minpoll </code><kbd>int</kbd><code>]</code> <code>[maxpoll </code><kbd>int</kbd><code>]</code><dd>This command can be used to configure reference clocks in
2141special ways. 
2142The options are interpreted as follows:
2143          <dl>
2144<dt><code>prefer</code><dd>Marks the reference clock as preferred. 
2145All other things being
2146equal, this host will be chosen for synchronization among a set of
2147correctly operating hosts. 
2148See the
2149"Mitigation Rules and the prefer Keyword"
2150page
2151(available as part of the HTML documentation
2152provided in
2153<span class="file">/usr/share/doc/ntp</span>)
2154for further information. 
2155<br><dt><code>mode</code> <kbd>int</kbd><dd>Specifies a mode number which is interpreted in a
2156device-specific fashion. 
2157For instance, it selects a dialing
2158protocol in the ACTS driver and a device subtype in the
2159parse
2160drivers. 
2161<br><dt><code>minpoll</code> <kbd>int</kbd><br><dt><code>maxpoll</code> <kbd>int</kbd><dd>These options specify the minimum and maximum polling interval
2162for reference clock messages, as a power of 2 in seconds
2163For
2164most directly connected reference clocks, both
2165<code>minpoll</code>
2166and
2167<code>maxpoll</code>
2168default to 6 (64 s). 
2169For modem reference clocks,
2170<code>minpoll</code>
2171defaults to 10 (17.1 m) and
2172<code>maxpoll</code>
2173defaults to 14 (4.5 h). 
2174The allowable range is 4 (16 s) to 17 (36.4 h) inclusive. 
2175</dl>
2176     <br><dt><code>fudge</code> <code>127.127.</code><kbd>t</kbd>.<kbd>u</kbd> <code>[time1 </code><kbd>sec</kbd><code>]</code> <code>[time2 </code><kbd>sec</kbd><code>]</code> <code>[stratum </code><kbd>int</kbd><code>]</code> <code>[refid </code><kbd>string</kbd><code>]</code> <code>[mode </code><kbd>int</kbd><code>]</code> <code>[flag1 0 | 1]</code> <code>[flag2 0 | 1]</code> <code>[flag3 0 | 1]</code> <code>[flag4 0 | 1]</code><dd>This command can be used to configure reference clocks in
2177special ways. 
2178It must immediately follow the
2179<code>server</code>
2180command which configures the driver. 
2181Note that the same capability
2182is possible at run time using the
2183<code>ntpdc(1ntpdcmdoc)</code>
2184program. 
2185The options are interpreted as
2186follows:
2187          <dl>
2188<dt><code>time1</code> <kbd>sec</kbd><dd>Specifies a constant to be added to the time offset produced by
2189the driver, a fixed-point decimal number in seconds. 
2190This is used
2191as a calibration constant to adjust the nominal time offset of a
2192particular clock to agree with an external standard, such as a
2193precision PPS signal. 
2194It also provides a way to correct a
2195systematic error or bias due to serial port or operating system
2196latencies, different cable lengths or receiver internal delay. 
2197The
2198specified offset is in addition to the propagation delay provided
2199by other means, such as internal DIPswitches. 
2200Where a calibration
2201for an individual system and driver is available, an approximate
2202correction is noted in the driver documentation pages. 
2203Note: in order to facilitate calibration when more than one
2204radio clock or PPS signal is supported, a special calibration
2205feature is available. 
2206It takes the form of an argument to the
2207<code>enable</code>
2208command described in
2209<a href="#Miscellaneous-Options">Miscellaneous Options</a>
2210page and operates as described in the
2211"Reference Clock Drivers"
2212page
2213(available as part of the HTML documentation
2214provided in
2215<span class="file">/usr/share/doc/ntp</span>). 
2216<br><dt><code>time2</code> <kbd>secs</kbd><dd>Specifies a fixed-point decimal number in seconds, which is
2217interpreted in a driver-dependent way. 
2218See the descriptions of
2219specific drivers in the
2220"Reference Clock Drivers"
2221page
2222(available as part of the HTML documentation
2223provided in
2224<span class="file">/usr/share/doc/ntp</span>). 
2225<br><dt><code>stratum</code> <kbd>int</kbd><dd>Specifies the stratum number assigned to the driver, an integer
2226between 0 and 15. 
2227This number overrides the default stratum number
2228ordinarily assigned by the driver itself, usually zero. 
2229<br><dt><code>refid</code> <kbd>string</kbd><dd>Specifies an ASCII string of from one to four characters which
2230defines the reference identifier used by the driver. 
2231This string
2232overrides the default identifier ordinarily assigned by the driver
2233itself. 
2234<br><dt><code>mode</code> <kbd>int</kbd><dd>Specifies a mode number which is interpreted in a
2235device-specific fashion. 
2236For instance, it selects a dialing
2237protocol in the ACTS driver and a device subtype in the
2238parse
2239drivers. 
2240<br><dt><code>flag1</code> <code>0</code> <code>|</code> <code>1</code><br><dt><code>flag2</code> <code>0</code> <code>|</code> <code>1</code><br><dt><code>flag3</code> <code>0</code> <code>|</code> <code>1</code><br><dt><code>flag4</code> <code>0</code> <code>|</code> <code>1</code><dd>These four flags are used for customizing the clock driver. 
2241The
2242interpretation of these values, and whether they are used at all,
2243is a function of the particular clock driver. 
2244However, by
2245convention
2246<code>flag4</code>
2247is used to enable recording monitoring
2248data to the
2249<code>clockstats</code>
2250file configured with the
2251<code>filegen</code>
2252command. 
2253Further information on the
2254<code>filegen</code>
2255command can be found in
2256<a href="#Monitoring-Options">Monitoring Options</a>. 
2257</dl>
2258     </dl>
2259<div class="node">
2260<p><hr>
2261<a name="Miscellaneous-Options"></a>
2262<br>
2263</div>
2264
2265<h4 class="subsection">Miscellaneous Options</h4>
2266
2267     <dl>
2268<dt><code>broadcastdelay</code> <kbd>seconds</kbd><dd>The broadcast and multicast modes require a special calibration
2269to determine the network delay between the local and remote
2270servers. 
2271Ordinarily, this is done automatically by the initial
2272protocol exchanges between the client and server. 
2273In some cases,
2274the calibration procedure may fail due to network or server access
2275controls, for example. 
2276This command specifies the default delay to
2277be used under these circumstances. 
2278Typically (for Ethernet), a
2279number between 0.003 and 0.007 seconds is appropriate. 
2280The default
2281when this command is not used is 0.004 seconds. 
2282<br><dt><code>calldelay</code> <kbd>delay</kbd><dd>This option controls the delay in seconds between the first and second
2283packets sent in burst or iburst mode to allow additional time for a modem
2284or ISDN call to complete. 
2285<br><dt><code>driftfile</code> <kbd>driftfile</kbd><dd>This command specifies the complete path and name of the file used to
2286record the frequency of the local clock oscillator. 
2287This is the same
2288operation as the
2289<code>-f</code>
2290command line option. 
2291If the file exists, it is read at
2292startup in order to set the initial frequency and then updated once per
2293hour with the current frequency computed by the daemon. 
2294If the file name is
2295specified, but the file itself does not exist, the starts with an initial
2296frequency of zero and creates the file when writing it for the first time. 
2297If this command is not given, the daemon will always start with an initial
2298frequency of zero.
2299
2300     <p>The file format consists of a single line containing a single
2301floating point number, which records the frequency offset measured
2302in parts-per-million (PPM). 
2303The file is updated by first writing
2304the current drift value into a temporary file and then renaming
2305this file to replace the old version. 
2306This implies that
2307<code>ntpd(1ntpdmdoc)</code>
2308must have write permission for the directory the
2309drift file is located in, and that file system links, symbolic or
2310otherwise, should be avoided. 
2311<br><dt><code>dscp</code> <kbd>value</kbd><dd>This option specifies the Differentiated Services Control Point (DSCP) value,
2312a 6-bit code.  The default value is 46, signifying Expedited Forwarding. 
2313<br><dt><code>enable</code> <code>[auth | bclient | calibrate | kernel | mode7 | monitor | ntp | stats | unpeer_crypto_early | unpeer_crypto_nak_early | unpeer_digest_early]</code><br><dt><code>disable</code> <code>[auth | bclient | calibrate | kernel | mode7 | monitor | ntp | stats | unpeer_crypto_early | unpeer_crypto_nak_early | unpeer_digest_early]</code><dd>Provides a way to enable or disable various server options. 
2314Flags not mentioned are unaffected. 
2315Note that all of these flags
2316can be controlled remotely using the
2317<code>ntpdc(1ntpdcmdoc)</code>
2318utility program.
2319          <dl>
2320<dt><code>auth</code><dd>Enables the server to synchronize with unconfigured peers only if the
2321peer has been correctly authenticated using either public key or
2322private key cryptography. 
2323The default for this flag is
2324<code>enable</code>. 
2325<br><dt><code>bclient</code><dd>Enables the server to listen for a message from a broadcast or
2326multicast server, as in the
2327<code>multicastclient</code>
2328command with default
2329address. 
2330The default for this flag is
2331<code>disable</code>. 
2332<br><dt><code>calibrate</code><dd>Enables the calibrate feature for reference clocks. 
2333The default for
2334this flag is
2335<code>disable</code>. 
2336<br><dt><code>kernel</code><dd>Enables the kernel time discipline, if available. 
2337The default for this
2338flag is
2339<code>enable</code>
2340if support is available, otherwise
2341<code>disable</code>. 
2342<br><dt><code>mode7</code><dd>Enables processing of NTP mode 7 implementation-specific requests
2343which are used by the deprecated
2344<code>ntpdc(1ntpdcmdoc)</code>
2345program. 
2346The default for this flag is disable. 
2347This flag is excluded from runtime configuration using
2348<code>ntpq(1ntpqmdoc)</code>. 
2349The
2350<code>ntpq(1ntpqmdoc)</code>
2351program provides the same capabilities as
2352<code>ntpdc(1ntpdcmdoc)</code>
2353using standard mode 6 requests. 
2354<br><dt><code>monitor</code><dd>Enables the monitoring facility. 
2355See the
2356<code>ntpdc(1ntpdcmdoc)</code>
2357program
2358and the
2359<code>monlist</code>
2360command or further information. 
2361The
2362default for this flag is
2363<code>enable</code>. 
2364<br><dt><code>ntp</code><dd>Enables time and frequency discipline. 
2365In effect, this switch opens and
2366closes the feedback loop, which is useful for testing. 
2367The default for
2368this flag is
2369<code>enable</code>. 
2370<br><dt><code>stats</code><dd>Enables the statistics facility. 
2371See the
2372<a href="#Monitoring-Options">Monitoring Options</a>
2373section for further information. 
2374The default for this flag is
2375<code>disable</code>. 
2376<br><dt><code>unpeer_crypto_early</code><dd>By default, if
2377<code>ntpd(1ntpdmdoc)</code>
2378receives an autokey packet that fails TEST9,
2379a crypto failure,
2380the association is immediately cleared. 
2381This is almost certainly a feature,
2382but if, in spite of the current recommendation of not using autokey,
2383you are
2384.B still
2385using autokey
2386.B and
2387you are seeing this sort of DoS attack
2388disabling this flag will delay
2389tearing down the association until the reachability counter
2390becomes zero. 
2391You can check your
2392<code>peerstats</code>
2393file for evidence of any of these attacks. 
2394The
2395default for this flag is
2396<code>enable</code>. 
2397<br><dt><code>unpeer_crypto_nak_early</code><dd>By default, if
2398<code>ntpd(1ntpdmdoc)</code>
2399receives a crypto-NAK packet that
2400passes the duplicate packet and origin timestamp checks
2401the association is immediately cleared. 
2402While this is generally a feature
2403as it allows for quick recovery if a server key has changed,
2404a properly forged and appropriately delivered crypto-NAK packet
2405can be used in a DoS attack. 
2406If you have active noticable problems with this type of DoS attack
2407then you should consider
2408disabling this option. 
2409You can check your
2410<code>peerstats</code>
2411file for evidence of any of these attacks. 
2412The
2413default for this flag is
2414<code>enable</code>. 
2415<br><dt><code>unpeer_digest_early</code><dd>By default, if
2416<code>ntpd(1ntpdmdoc)</code>
2417receives what should be an authenticated packet
2418that passes other packet sanity checks but
2419contains an invalid digest
2420the association is immediately cleared. 
2421While this is generally a feature
2422as it allows for quick recovery,
2423if this type of packet is carefully forged and sent
2424during an appropriate window it can be used for a DoS attack. 
2425If you have active noticable problems with this type of DoS attack
2426then you should consider
2427disabling this option. 
2428You can check your
2429<code>peerstats</code>
2430file for evidence of any of these attacks. 
2431The
2432default for this flag is
2433<code>enable</code>. 
2434</dl>
2435     <br><dt><code>includefile</code> <kbd>includefile</kbd><dd>This command allows additional configuration commands
2436to be included from a separate file. 
2437Include files may
2438be nested to a depth of five; upon reaching the end of any
2439include file, command processing resumes in the previous
2440configuration file. 
2441This option is useful for sites that run
2442<code>ntpd(1ntpdmdoc)</code>
2443on multiple hosts, with (mostly) common options (e.g., a
2444restriction list). 
2445<br><dt><code>leapsmearinterval</code> <kbd>seconds</kbd><dd>This EXPERIMENTAL option is only available if
2446<code>ntpd(1ntpdmdoc)</code>
2447was built with the
2448<code>--enable-leap-smear</code>
2449option to the
2450<code>configure</code>
2451script. 
2452It specifies the interval over which a leap second correction will be applied. 
2453Recommended values for this option are between
24547200 (2 hours) and 86400 (24 hours). 
2455.Sy DO NOT USE THIS OPTION ON PUBLIC-ACCESS SERVERS! 
2456See http://bugs.ntp.org/2855 for more information. 
2457<br><dt><code>logconfig</code> <kbd>configkeyword</kbd><dd>This command controls the amount and type of output written to
2458the system
2459<code>syslog(3)</code>
2460facility or the alternate
2461<code>logfile</code>
2462log file. 
2463By default, all output is turned on. 
2464All
2465<kbd>configkeyword</kbd>
2466keywords can be prefixed with
2467=,
2468+
2469and
2470-,
2471where
2472=
2473sets the
2474<code>syslog(3)</code>
2475priority mask,
2476+
2477adds and
2478-
2479removes
2480messages. 
2481<code>syslog(3)</code>
2482messages can be controlled in four
2483classes
2484(<code>clock</code>, <code>peer</code>, <code>sys</code> and <code>sync</code>). 
2485Within these classes four types of messages can be
2486controlled: informational messages
2487(<code>info</code>),
2488event messages
2489(<code>events</code>),
2490statistics messages
2491(<code>statistics</code>)
2492and
2493status messages
2494(<code>status</code>).
2495
2496     <p>Configuration keywords are formed by concatenating the message class with
2497the event class. 
2498The
2499<code>all</code>
2500prefix can be used instead of a message class. 
2501A
2502message class may also be followed by the
2503<code>all</code>
2504keyword to enable/disable all
2505messages of the respective message class.Thus, a minimal log configuration
2506could look like this:
2507<pre class="verbatim">     
2508     logconfig =syncstatus +sysevents
2509</pre>
2510
2511     <p>This would just list the synchronizations state of
2512<code>ntpd(1ntpdmdoc)</code>
2513and the major system events. 
2514For a simple reference server, the
2515following minimum message configuration could be useful:
2516<pre class="verbatim">     
2517     logconfig =syncall +clockall
2518</pre>
2519
2520     <p>This configuration will list all clock information and
2521synchronization information. 
2522All other events and messages about
2523peers, system events and so on is suppressed. 
2524<br><dt><code>logfile</code> <kbd>logfile</kbd><dd>This command specifies the location of an alternate log file to
2525be used instead of the default system
2526<code>syslog(3)</code>
2527facility. 
2528This is the same operation as the
2529<code>-l</code>
2530command line option. 
2531<br><dt><code>setvar</code> <kbd>variable</kbd> <code>[default]</code><dd>This command adds an additional system variable. 
2532These
2533variables can be used to distribute additional information such as
2534the access policy. 
2535If the variable of the form
2536<code>name</code><code>=</code><kbd>value</kbd>
2537is followed by the
2538<code>default</code>
2539keyword, the
2540variable will be listed as part of the default system variables
2541(<code>rv</code> command)). 
2542These additional variables serve
2543informational purposes only. 
2544They are not related to the protocol
2545other that they can be listed. 
2546The known protocol variables will
2547always override any variables defined via the
2548<code>setvar</code>
2549mechanism. 
2550There are three special variables that contain the names
2551of all variable of the same group. 
2552The
2553<code>sys_var_list</code>
2554holds
2555the names of all system variables. 
2556The
2557<code>peer_var_list</code>
2558holds
2559the names of all peer variables and the
2560<code>clock_var_list</code>
2561holds the names of the reference clock variables. 
2562<br><dt><code>tinker</code> <code>[allan </code><kbd>allan</kbd><code> | dispersion </code><kbd>dispersion</kbd><code> | freq </code><kbd>freq</kbd><code> | huffpuff </code><kbd>huffpuff</kbd><code> | panic </code><kbd>panic</kbd><code> | step </code><kbd>step</kbd><code> | stepback </code><kbd>stepback</kbd><code> | stepfwd </code><kbd>stepfwd</kbd><code> | stepout </code><kbd>stepout</kbd><code>]</code><dd>This command can be used to alter several system variables in
2563very exceptional circumstances. 
2564It should occur in the
2565configuration file before any other configuration options. 
2566The
2567default values of these variables have been carefully optimized for
2568a wide range of network speeds and reliability expectations. 
2569In
2570general, they interact in intricate ways that are hard to predict
2571and some combinations can result in some very nasty behavior. 
2572Very
2573rarely is it necessary to change the default values; but, some
2574folks cannot resist twisting the knobs anyway and this command is
2575for them. 
2576Emphasis added: twisters are on their own and can expect
2577no help from the support group.
2578
2579     <p>The variables operate as follows:
2580          <dl>
2581<dt><code>allan</code> <kbd>allan</kbd><dd>The argument becomes the new value for the minimum Allan
2582intercept, which is a parameter of the PLL/FLL clock discipline
2583algorithm. 
2584The value in log2 seconds defaults to 7 (1024 s), which is also the lower
2585limit. 
2586<br><dt><code>dispersion</code> <kbd>dispersion</kbd><dd>The argument becomes the new value for the dispersion increase rate,
2587normally .000015 s/s. 
2588<br><dt><code>freq</code> <kbd>freq</kbd><dd>The argument becomes the initial value of the frequency offset in
2589parts-per-million. 
2590This overrides the value in the frequency file, if
2591present, and avoids the initial training state if it is not. 
2592<br><dt><code>huffpuff</code> <kbd>huffpuff</kbd><dd>The argument becomes the new value for the experimental
2593huff-n'-puff filter span, which determines the most recent interval
2594the algorithm will search for a minimum delay. 
2595The lower limit is
2596900 s (15 m), but a more reasonable value is 7200 (2 hours). 
2597There
2598is no default, since the filter is not enabled unless this command
2599is given. 
2600<br><dt><code>panic</code> <kbd>panic</kbd><dd>The argument is the panic threshold, normally 1000 s. 
2601If set to zero,
2602the panic sanity check is disabled and a clock offset of any value will
2603be accepted. 
2604<br><dt><code>step</code> <kbd>step</kbd><dd>The argument is the step threshold, which by default is 0.128 s. 
2605It can
2606be set to any positive number in seconds. 
2607If set to zero, step
2608adjustments will never occur. 
2609Note: The kernel time discipline is
2610disabled if the step threshold is set to zero or greater than the
2611default. 
2612<br><dt><code>stepback</code> <kbd>stepback</kbd><dd>The argument is the step threshold for the backward direction,
2613which by default is 0.128 s. 
2614It can
2615be set to any positive number in seconds. 
2616If both the forward and backward step thresholds are set to zero, step
2617adjustments will never occur. 
2618Note: The kernel time discipline is
2619disabled if
2620each direction of step threshold are either
2621set to zero or greater than .5 second. 
2622<br><dt><code>stepfwd</code> <kbd>stepfwd</kbd><dd>As for stepback, but for the forward direction. 
2623<br><dt><code>stepout</code> <kbd>stepout</kbd><dd>The argument is the stepout timeout, which by default is 900 s. 
2624It can
2625be set to any positive number in seconds. 
2626If set to zero, the stepout
2627pulses will not be suppressed. 
2628</dl>
2629     <br><dt><code>rlimit</code> <code>[memlock </code><kbd>Nmegabytes</kbd><code> | stacksize </code><kbd>N4kPages</kbd><code> filenum </code><kbd>Nfiledescriptors</kbd><code>]</code><dd>
2630          <dl>
2631<dt><code>memlock</code> <kbd>Nmegabytes</kbd><dd>Specify the number of megabytes of memory that should be
2632allocated and locked. 
2633Probably only available under Linux, this option may be useful
2634when dropping root (the
2635<code>-i</code>
2636option). 
2637The default is 32 megabytes on non-Linux machines, and -1 under Linux. 
2638-1 means "do not lock the process into memory". 
26390 means "lock whatever memory the process wants into memory". 
2640<br><dt><code>stacksize</code> <kbd>N4kPages</kbd><dd>Specifies the maximum size of the process stack on systems with the
2641<code>mlockall()</code>
2642function. 
2643Defaults to 50 4k pages (200 4k pages in OpenBSD). 
2644<br><dt><code>filenum</code> <kbd>Nfiledescriptors</kbd><dd>Specifies the maximum number of file descriptors ntpd may have open at once. Defaults to the system default. 
2645</dl>
2646     <br><dt><code>trap</code> <kbd>host_address</kbd> <code>[port </code><kbd>port_number</kbd><code>]</code> <code>[interface </code><kbd>interface_address</kbd><code>]</code><dd>This command configures a trap receiver at the given host
2647address and port number for sending messages with the specified
2648local interface address. 
2649If the port number is unspecified, a value
2650of 18447 is used. 
2651If the interface address is not specified, the
2652message is sent with a source address of the local interface the
2653message is sent through. 
2654Note that on a multihomed host the
2655interface used may vary from time to time with routing changes.
2656
2657     <p>The trap receiver will generally log event messages and other
2658information from the server in a log file. 
2659While such monitor
2660programs may also request their own trap dynamically, configuring a
2661trap receiver will ensure that no messages are lost when the server
2662is started. 
2663<br><dt><code>hop</code> <kbd>...</kbd><dd>This command specifies a list of TTL values in increasing order, up to 8
2664values can be specified. 
2665In manycast mode these values are used in turn in
2666an expanding-ring search. 
2667The default is eight multiples of 32 starting at
266831. 
2669</dl>
2670
2671  <p>This section was generated by <strong>AutoGen</strong>,
2672using the <code>agtexi-cmd</code> template and the option descriptions for the <code>ntp.conf</code> program. 
2673This software is released under the NTP license, &lt;http://ntp.org/license>;.
2674
2675<ul class="menu">
2676<li><a accesskey="1" href="#ntp_002econf-Files">ntp.conf Files</a>:                   Files
2677<li><a accesskey="2" href="#ntp_002econf-See-Also">ntp.conf See Also</a>:                See Also
2678<li><a accesskey="3" href="#ntp_002econf-Bugs">ntp.conf Bugs</a>:                    Bugs
2679<li><a accesskey="4" href="#ntp_002econf-Notes">ntp.conf Notes</a>:                   Notes
2680</ul>
2681
2682<div class="node">
2683<p><hr>
2684<a name="ntp_002econf-Files"></a>
2685<br>
2686</div>
2687
2688<h4 class="subsection">ntp.conf Files</h4>
2689
2690     <dl>
2691<dt><span class="file">/etc/ntp.conf</span><dd>the default name of the configuration file
2692<br><dt><span class="file">ntp.keys</span><dd>private MD5 keys
2693<br><dt><span class="file">ntpkey</span><dd>RSA private key
2694<br><dt><span class="file">ntpkey_</span><kbd>host</kbd><dd>RSA public key
2695<br><dt><span class="file">ntp_dh</span><dd>Diffie-Hellman agreement parameters
2696</dl>
2697<div class="node">
2698<p><hr>
2699<a name="ntp_002econf-See-Also"></a>
2700<br>
2701</div>
2702
2703<h4 class="subsection">ntp.conf See Also</h4>
2704
2705<p><code>ntpd(1ntpdmdoc)</code>,
2706<code>ntpdc(1ntpdcmdoc)</code>,
2707<code>ntpq(1ntpqmdoc)</code>
2708
2709  <p>In addition to the manual pages provided,
2710comprehensive documentation is available on the world wide web
2711at
2712<code>http://www.ntp.org/</code>. 
2713A snapshot of this documentation is available in HTML format in
2714<span class="file">/usr/share/doc/ntp</span>. 
2715<br>
2716
2717  <p><br>
2718David L. Mills, <em>Network Time Protocol (Version 4)</em>, RFC5905
2719<div class="node">
2720<p><hr>
2721<a name="ntp_002econf-Bugs"></a>
2722<br>
2723</div>
2724
2725<h4 class="subsection">ntp.conf Bugs</h4>
2726
2727<p>The syntax checking is not picky; some combinations of
2728ridiculous and even hilarious options and modes may not be
2729detected.
2730
2731  <p>The
2732<span class="file">ntpkey_</span><kbd>host</kbd>
2733files are really digital
2734certificates. 
2735These should be obtained via secure directory
2736services when they become universally available. 
2737<div class="node">
2738<p><hr>
2739<a name="ntp_002econf-Notes"></a>
2740<br>
2741</div>
2742
2743<h4 class="subsection">ntp.conf Notes</h4>
2744
2745<p>This document was derived from FreeBSD.
2746
2747</body></html>
2748
2749