This document describes the configuration file for the NTP Project's
ntpd
program.
This document applies to version 4.2.7p335 of ntp.conf
.
The behavior of ntpd
can be changed by a configuration file,
by default ntp.conf
.
The
ntp.conf
configuration file is read at initial startup by the
ntpd(1ntpdmdoc)
daemon in order to specify the synchronization sources,
modes and other related information.
Usually, it is installed in the
.Pa
/etc
directory,
but could be installed elsewhere
(see the daemon's
-c
command line option).
The file format is similar to other .Ux configuration files. Comments begin with a .Ql # character and extend to the end of the line; blank lines are ignored. Configuration commands consist of an initial keyword followed by a list of arguments, some of which may be optional, separated by whitespace. Commands may not be continued over multiple lines. Arguments may be host names, host addresses written in numeric, dotted-quad form, integers, floating point numbers (when specifying times in seconds) and text strings.
The rest of this page describes the configuration and control options. The .Qq Notes on Configuring NTP and Setting up a NTP Subnet page (available as part of the HTML documentation provided in .Pa /usr/share/doc/ntp ) contains an extended discussion of these options. In addition to the discussion of general .Sx Configuration Options , there are sections describing the following supported functionality and the options used to control it:
Following these is a section describing .Sx Miscellaneous Options . While there is a rich set of options available, the only required option is one or more .Ic pool , .Ic server , .Ic peer , .Ic broadcast or .Ic manycastclient commands. .Sh Configuration Support Following is a description of the configuration commands in NTPv4. These commands have the same basic functions as in NTPv3 and in some cases new functions and new arguments. There are two classes of commands, configuration commands that configure a persistent association with a remote server or peer or reference clock, and auxiliary commands that specify environmental variables that control various related operations. .Ss Configuration Commands The various modes are determined by the command keyword and the type of the required IP address. Addresses are classed by type as (s) a remote server or peer (IPv4 class A, B and C), (b) the broadcast address of a local interface, (m) a multicast address (IPv4 class D), or (r) a reference clock address (127.127.x.x). Note that only those options applicable to each command are listed below. Use of options not listed may not be caught as an error, but may result in some weird and even destructive behavior.
If the Basic Socket Interface Extensions for IPv6 (RFC-2553) is detected, support for the IPv6 address family is generated in addition to the default support of the IPv4 address family. In a few cases, including the reslist billboard generated by ntpdc, IPv6 addresses are automatically generated. IPv6 addresses can be identified by the presence of colons .Dq \&: in the address field. IPv6 addresses can be used almost everywhere where IPv4 addresses can be used, with the exception of reference clock addresses, which are always IPv4.
Note that in contexts where a host name is expected, a
-4
qualifier preceding
the host name forces DNS resolution to the IPv4 namespace,
while a
-6
qualifier forces DNS resolution to the IPv6 namespace.
See IPv6 references for the
equivalent classes for that address family.
These five commands specify the time server name or address to be used and the mode in which to operate. The .Ar address can be either a DNS name or an IP address in dotted-quad notation. Additional information on association behavior can be found in the .Qq Association Management page (available as part of the HTML documentation provided in .Pa /usr/share/doc/ntp ) .
Options:
ntpd(1ntpdmdoc)
is started with the
-q
option.
.Ss Auxiliary Commands
.Sh Authentication Support Authentication support allows the NTP client to verify that the server is in fact known and trusted and not an intruder intending accidentally or on purpose to masquerade as that server. The NTPv3 specification RFC-1305 defines a scheme which provides cryptographic authentication of received NTP packets. Originally, this was done using the Data Encryption Standard (DES) algorithm operating in Cipher Block Chaining (CBC) mode, commonly called DES-CBC. Subsequently, this was replaced by the RSA Message Digest 5 (MD5) algorithm using a private key, commonly called keyed-MD5. Either algorithm computes a message digest, or one-way hash, which can be used to verify the server has the correct private key and key identifier.
NTPv4 retains the NTPv3 scheme, properly described as symmetric key cryptography and, in addition, provides a new Autokey scheme based on public key cryptography. Public key cryptography is generally considered more secure than symmetric key cryptography, since the security is based on a private value which is generated by each server and never revealed. With Autokey all key distribution and management functions involve only public values, which considerably simplifies key distribution and storage. Public key management is based on X.509 certificates, which can be provided by commercial services or produced by utility programs in the OpenSSL software library or the NTPv4 distribution.
While the algorithms for symmetric key cryptography are included in the NTPv4 distribution, public key cryptography requires the OpenSSL software library to be installed before building the NTP distribution. Directions for doing that are on the Building and Installing the Distribution page.
Authentication is configured separately for each association using the .Cm key or .Cm autokey subcommand on the .Ic peer , .Ic server , .Ic broadcast and .Ic manycastclient configuration commands as described in .Sx Configuration Options page. The authentication options described below specify the locations of the key files, if other than default, which symmetric keys are trusted and the interval between various operations, if other than default.
Authentication is always enabled, although ineffective if not configured as described below. If a NTP packet arrives including a message authentication code (MAC), it is accepted only if it passes all cryptographic checks. The checks require correct key ID, key value and message digest. If the packet has been modified in any way or replayed by an intruder, it will fail one or more of these checks and be discarded. Furthermore, the Autokey scheme requires a preliminary protocol exchange to obtain the server certificate, verify its credentials and initialize the protocol
The
.Cm
auth
flag controls whether new associations or
remote configuration commands require cryptographic authentication.
This flag can be set or reset by the
.Ic
enable
and
.Ic
disable
commands and also by remote
configuration commands sent by a
ntpdc(1ntpdcmdoc)
program running in
another machine.
If this flag is enabled, which is the default
case, new broadcast client and symmetric passive associations and
remote configuration commands must be cryptographically
authenticated using either symmetric key or public key cryptography.
If this
flag is disabled, these operations are effective
even if not cryptographic
authenticated.
It should be understood
that operating with the
.Ic
auth
flag disabled invites a significant vulnerability
where a rogue hacker can
masquerade as a falseticker and seriously
disrupt system timekeeping.
It is
important to note that this flag has no purpose
other than to allow or disallow
a new association in response to new broadcast
and symmetric active messages
and remote configuration commands and, in particular,
the flag has no effect on
the authentication process itself.
An attractive alternative where multicast support is available is manycast mode, in which clients periodically troll for servers as described in the .Sx Automatic NTP Configuration Options page. Either symmetric key or public key cryptographic authentication can be used in this mode. The principle advantage of manycast mode is that potential servers need not be configured in advance, since the client finds them during regular operation, and the configuration files for all clients can be identical.
The security model and protocol schemes for
both symmetric key and public key
cryptography are summarized below;
further details are in the briefings, papers
and reports at the NTP project page linked from
.Li
http://www.ntp.org/
.
.Ss
Symmetric-Key
Cryptography
The original RFC-1305 specification allows any one of possibly
65,534 keys, each distinguished by a 32-bit key identifier, to
authenticate an association.
The servers and clients involved must
agree on the key and key identifier to
authenticate NTP packets.
Keys and
related information are specified in a key
file, usually called
.Pa
ntp.keys
,
which must be distributed and stored using
secure means beyond the scope of the NTP protocol itself.
Besides the keys used
for ordinary NTP associations,
additional keys can be used as passwords for the
ntpq(1ntpqmdoc)
and
ntpdc(1ntpdcmdoc)
utility programs.
When
ntpd(1ntpdmdoc)
is first started, it reads the key file specified in the
.Ic
keys
configuration command and installs the keys
in the key cache.
However,
individual keys must be activated with the
.Ic
trusted
command before use.
This
allows, for instance, the installation of possibly
several batches of keys and
then activating or deactivating each batch
remotely using
ntpdc(1ntpdcmdoc)
.
This also provides a revocation capability that can be used
if a key becomes compromised.
The
.Ic
requestkey
command selects the key used as the password for the
ntpdc(1ntpdcmdoc)
utility, while the
.Ic
controlkey
command selects the key used as the password for the
ntpq(1ntpqmdoc)
utility.
.Ss
Public
Key
Cryptography
NTPv4 supports the original NTPv3 symmetric key scheme
described in RFC-1305 and in addition the Autokey protocol,
which is based on public key cryptography.
The Autokey Version 2 protocol described on the Autokey Protocol
page verifies packet integrity using MD5 message digests
and verifies the source with digital signatures and any of several
digest/signature schemes.
Optional identity schemes described on the Identity Schemes
page and based on cryptographic challenge/response algorithms
are also available.
Using all of these schemes provides strong security against
replay with or without modification, spoofing, masquerade
and most forms of clogging attacks.
The Autokey protocol has several modes of operation corresponding to the various NTP modes supported. Most modes use a special cookie which can be computed independently by the client and server, but encrypted in transmission. All modes use in addition a variant of the S-KEY scheme, in which a pseudo-random key list is generated and used in reverse order. These schemes are described along with an executive summary, current status, briefing slides and reading list on the .Sx Autonomous Authentication page.
The specific cryptographic environment used by Autokey servers
and clients is determined by a set of files
and soft links generated by the
ntp-keygen(1ntpkeygenmdoc)
program.
This includes a required host key file,
required certificate file and optional sign key file,
leapsecond file and identity scheme files.
The
digest/signature scheme is specified in the X.509 certificate
along with the matching sign key.
There are several schemes
available in the OpenSSL software library, each identified
by a specific string such as
.Cm
md5WithRSAEncryption
,
which stands for the MD5 message digest with RSA
encryption scheme.
The current NTP distribution supports
all the schemes in the OpenSSL library, including
those based on RSA and DSA digital signatures.
NTP secure groups can be used to define cryptographic compartments and security hierarchies. It is important that every host in the group be able to construct a certificate trail to one or more trusted hosts in the same group. Each group host runs the Autokey protocol to obtain the certificates for all hosts along the trail to one or more trusted hosts. This requires the configuration file in all hosts to be engineered so that, even under anticipated failure conditions, the NTP subnet will form such that every group host can find a trail to at least one trusted host. .Ss Naming and Addressing It is important to note that Autokey does not use DNS to resolve addresses, since DNS can't be completely trusted until the name servers have synchronized clocks. The cryptographic name used by Autokey to bind the host identity credentials and cryptographic values must be independent of interface, network and any other naming convention. The name appears in the host certificate in either or both the subject and issuer fields, so protection against DNS compromise is essential.
By convention, the name of an Autokey host is the name returned
by the Unix
gethostname(2)
system call or equivalent in other systems.
By the system design
model, there are no provisions to allow alternate names or aliases.
However, this is not to say that DNS aliases, different names
for each interface, etc., are constrained in any way.
It is also important to note that Autokey verifies authenticity using the host name, network address and public keys, all of which are bound together by the protocol specifically to deflect masquerade attacks. For this reason Autokey includes the source and destinatino IP addresses in message digest computations and so the same addresses must be available at both the server and client. For this reason operation with network address translation schemes is not possible. This reflects the intended robust security model where government and corporate NTP servers are operated outside firewall perimeters. .Ss Operation A specific combination of authentication scheme (none, symmetric key, public key) and identity scheme is called a cryptotype, although not all combinations are compatible. There may be management configurations where the clients, servers and peers may not all support the same cryptotypes. A secure NTPv4 subnet can be configured in many ways while keeping in mind the principles explained above and in this section. Note however that some cryptotype combinations may successfully interoperate with each other, but may not represent good security practice.
The cryptotype of an association is determined at the time of mobilization, either at configuration time or some time later when a message of appropriate cryptotype arrives. When mobilized by a .Ic server or .Ic peer configuration command and no .Ic key or .Ic autokey subcommands are present, the association is not authenticated; if the .Ic key subcommand is present, the association is authenticated using the symmetric key ID specified; if the .Ic autokey subcommand is present, the association is authenticated using Autokey.
When multiple identity schemes are supported in the Autokey protocol, the first message exchange determines which one is used. The client request message contains bits corresponding to which schemes it has available. The server response message contains bits corresponding to which schemes it has available. Both server and client match the received bits with their own and select a common scheme.
Following the principle that time is a public value, a server responds to any client packet that matches its cryptotype capabilities. Thus, a server receiving an unauthenticated packet will respond with an unauthenticated packet, while the same server receiving a packet of a cryptotype it supports will respond with packets of that cryptotype. However, unconfigured broadcast or manycast client associations or symmetric passive associations will not be mobilized unless the server supports a cryptotype compatible with the first packet received. By default, unauthenticated associations will not be mobilized unless overridden in a decidedly dangerous way.
Some examples may help to reduce confusion. Client Alice has no specific cryptotype selected. Server Bob has both a symmetric key file and minimal Autokey files. Alice's unauthenticated messages arrive at Bob, who replies with unauthenticated messages. Cathy has a copy of Bob's symmetric key file and has selected key ID 4 in messages to Bob. Bob verifies the message with his key ID 4. If it's the same key and the message is verified, Bob sends Cathy a reply authenticated with that key. If verification fails, Bob sends Cathy a thing called a crypto-NAK, which tells her something broke. She can see the evidence using the ntpq program.
Denise has rolled her own host key and certificate. She also uses one of the identity schemes as Bob. She sends the first Autokey message to Bob and they both dance the protocol authentication and identity steps. If all comes out okay, Denise and Bob continue as described above.
It should be clear from the above that Bob can support
all the girls at the same time, as long as he has compatible
authentication and identity credentials.
Now, Bob can act just like the girls in his own choice of servers;
he can run multiple configured associations with multiple different
servers (or the same server, although that might not be useful).
But, wise security policy might preclude some cryptotype
combinations; for instance, running an identity scheme
with one server and no authentication with another might not be wise.
.Ss
Key
Management
The cryptographic values used by the Autokey protocol are
incorporated as a set of files generated by the
ntp-keygen(1ntpkeygenmdoc)
utility program, including symmetric key, host key and
public certificate files, as well as sign key, identity parameters
and leapseconds files.
Alternatively, host and sign keys and
certificate files can be generated by the OpenSSL utilities
and certificates can be imported from public certificate
authorities.
Note that symmetric keys are necessary for the
ntpq(1ntpqmdoc)
and
ntpdc(1ntpdcmdoc)
utility programs.
The remaining files are necessary only for the
Autokey protocol.
Certificates imported from OpenSSL or public certificate authorities have certian limitations. The certificate should be in ASN.1 syntax, X.509 Version 3 format and encoded in PEM, which is the same format used by OpenSSL. The overall length of the certificate encoded in ASN.1 must not exceed 1024 bytes. The subject distinguished name field (CN) is the fully qualified name of the host on which it is used; the remaining subject fields are ignored. The certificate extension fields must not contain either a subject key identifier or a issuer key identifier field; however, an extended key usage field for a trusted host must contain the value .Cm trustRoot ; . Other extension fields are ignored. .Ss Authentication Commands
ntpq(1ntpqmdoc)
utility, which uses the standard
protocol defined in RFC-1305.
The
.Ar
key
argument is
the key identifier for a trusted key, where the value can be in the
range 1 to 65,534, inclusive.
.It
Ic
keys
Ar
keyfile
Specifies the complete path and location of the MD5 key file
containing the keys and key identifiers used by
ntpd(1ntpdmdoc)
,
ntpq(1ntpqmdoc)
and
ntpdc(1ntpdcmdoc)
when operating with symmetric key cryptography.
This is the same operation as the
-k
command line option.
.It
Ic
keysdir
Ar
path
This command specifies the default directory path for
cryptographic keys, parameters and certificates.
The default is
.Pa
/usr/local/etc/
.
.It
Ic
requestkey
Ar
key
Specifies the key identifier to use with the
ntpdc(1ntpdcmdoc)
utility program, which uses a
proprietary protocol specific to this implementation of
ntpd(1ntpdmdoc)
.
The
.Ar
key
argument is a key identifier
for the trusted key, where the value can be in the range 1 to
65,534, inclusive.
.It
Ic
revoke
Ar
logsec
Specifies the interval between re-randomization of certain
cryptographic values used by the Autokey scheme, as a power of 2 in
seconds.
These values need to be updated frequently in order to
deflect brute-force attacks on the algorithms of the scheme;
however, updating some values is a relatively expensive operation.
The default interval is 16 (65,536 s or about 18 hours).
For poll
intervals above the specified interval, the values will be updated
for every message sent.
.It
Ic
trustedkey
Ar
key
...
Specifies the key identifiers which are trusted for the
purposes of authenticating peers with symmetric key cryptography,
as well as keys used by the
ntpq(1ntpqmdoc)
and
ntpdc(1ntpdcmdoc)
programs.
The authentication procedures require that both the local
and remote servers share the same key and key identifier for this
purpose, although different keys can be used with different
servers.
The
.Ar
key
arguments are 32-bit unsigned
integers with values from 1 to 65,534.
.Ss Error Codes The following error codes are reported via the NTP control and monitoring protocol trap mechanism.
.Sh
Monitoring
Support
ntpd(1ntpdmdoc)
includes a comprehensive monitoring facility suitable
for continuous, long term recording of server and client
timekeeping performance.
See the
.Ic
statistics
command below
for a listing and example of each type of statistics currently
supported.
Statistic files are managed using file generation sets
and scripts in the
.Pa
./scripts
directory of this distribution.
Using
these facilities and
.Ux
cron(8)
jobs, the data can be
automatically summarized and archived for retrospective analysis.
.Ss
Monitoring
Commands
The first two fields show the date (Modified Julian Day) and time
(seconds and fraction past UTC midnight).
The next field shows the
clock address in dotted-quad notation.
The final field shows the last
timecode received from the clock in decoded ASCII format, where
meaningful.
In some clock drivers a good deal of additional information
can be gathered and displayed as well.
See information specific to each
clock for further details.
The first two fields show the date (Modified Julian Day) and time
(seconds and fraction past UTC midnight).
The next field shows the peer
address in dotted-quad notation, The final message field includes the
message type and certain ancillary information.
See the
.Sx
Authentication
Options
section for further information.
The first two fields show the date (Modified Julian Day) and
time (seconds and fraction past UTC midnight).
The next five fields
show time offset (seconds), frequency offset (parts per million -
PPM), RMS jitter (seconds), Allan deviation (PPM) and clock
discipline time constant.
The first two fields show the date (Modified Julian Day) and
time (seconds and fraction past UTC midnight).
The next two fields
show the peer address in dotted-quad notation and status,
respectively.
The status field is encoded in hex in the format
described in Appendix A of the NTP specification RFC 1305.
The final four fields show the offset,
delay, dispersion and RMS jitter, all in seconds.
The first two fields show the date (Modified Julian Day) and
time (seconds and fraction past UTC midnight).
The next two fields
show the remote peer or clock address followed by the local address
in dotted-quad notation.
The final four fields show the originate,
receive, transmit and final NTP timestamps in order.
The timestamp
values are as received and before processing by the various data
smoothing and mitigation algorithms.
The first two fields show the date (Modified Julian Day) and time (seconds and fraction past UTC midnight). The remaining ten fields show the statistics counter values accumulated since the last generated line.
.It Cm statsdir Ar directory_path Indicates the full path of a directory where statistics files should be created (see below). This keyword allows the (otherwise constant) .Cm filegen filename prefix to be modified for file generation sets, which is useful for handling statistics logs. .It Cm filegen Ar name Xo .Op Cm file Ar filename .Op Cm type Ar typename .Op Cm link | nolink .Op Cm enable | disable .Xc Configures setting of generation file set name. Generation file sets provide a means for handling files that are continuously growing during the lifetime of a server. Server statistics are a typical example for such files. Generation file sets provide access to a set of files used to store the actual data. At any time at most one element of the set is being written to. The type given specifies when and how data will be directed to a new element of the set. This way, information stored in elements of a file set that are currently unused are available for administrational operations without the risk of disturbing the operation of ntpd. (Most important: they can be removed to free space for new data produced.)
Note that this command can be sent from the
ntpdc(1ntpdcmdoc)
program running at a remote location.
.It Cm type Ar typename A file generation set is characterized by its type. The following types are supported:
ntpd(1ntpdmdoc)
server incarnations.
The set member filename is built by appending a
.Ql
\&.
to concatenated
.Ar
prefix
and
.Ar
filename
strings, and
appending the decimal representation of the process ID of the
ntpd(1ntpdmdoc)
server process.
.It Cm link | nolink It is convenient to be able to access the current element of a file generation set by a fixed name. This feature is enabled by specifying .Cm link and disabled using .Cm nolink . If link is specified, a hard link from the current file set element to a file without suffix is created. When there is already a file with this name and the number of links of this file is one, it is renamed appending a dot, the letter .Cm C , and the pid of the ntpd server process. When the number of links is greater than one, the file is unlinked. This allows the current file to be accessed by a constant name. .It Cm enable \&| Cm disable Enables or disables the recording function.
.Sh
Access
Control
Support
The
ntpd(1ntpdmdoc)
daemon implements a general purpose address/mask based restriction
list.
The list contains address/match entries sorted first
by increasing address values and and then by increasing mask values.
A match occurs when the bitwise AND of the mask and the packet
source address is equal to the bitwise AND of the mask and
address in the list.
The list is searched in order with the
last match found defining the restriction flags associated
with the entry.
Additional information and examples can be found in the
.Qq
Notes
on
Configuring
NTP
and
Setting
up
a
NTP
Subnet
page
(available as part of the HTML documentation
provided in
.Pa
/usr/share/doc/ntp
)
.
The restriction facility was implemented in conformance with the access policies for the original NSFnet backbone time servers. Later the facility was expanded to deflect cryptographic and clogging attacks. While this facility may be useful for keeping unwanted or broken or malicious clients from congesting innocent servers, it should not be considered an alternative to the NTP authentication facilities. Source address based restrictions are easily circumvented by a determined cracker.
Clients can be denied service because they are explicitly included in the restrict list created by the restrict command or implicitly as the result of cryptographic or rate limit violations. Cryptographic violations include certificate or identity verification failure; rate limit violations generally result from defective NTP implementations that send packets at abusive rates. Some violations cause denied service only for the offending packet, others cause denied service for a timed period and others cause the denied service for an indefinate period. When a client or network is denied access for an indefinate period, the only way at present to remove the restrictions is by restarting the server. .Ss The Kiss-of-Death Packet Ordinarily, packets denied service are simply dropped with no further action except incrementing statistics counters. Sometimes a more proactive response is needed, such as a server message that explicitly requests the client to stop sending and leave a message for the system operator. A special packet format has been created for this purpose called the "kiss-of-death" (KoD) packet. KoD packets have the leap bits set unsynchronized and stratum set to zero and the reference identifier field set to a four-byte ASCII code. If the .Cm noserve or .Cm notrust flag of the matching restrict list entry is set, the code is "DENY"; if the .Cm limited flag is set and the rate limit is exceeded, the code is "RATE". Finally, if a cryptographic violation occurs, the code is "CRYP".
A client receiving a KoD performs a set of sanity checks to minimize security exposure, then updates the stratum and reference identifier peer variables, sets the access denied (TEST4) bit in the peer flash variable and sends a message to the log. As long as the TEST4 bit is set, the client will send no further packets to the server. The only way at present to recover from this condition is to restart the protocol at both the client and server. This happens automatically at the client when the association times out. It will happen at the server only if the server operator cooperates. .Ss Access Control Commands
ntpq(1ntpqmdoc)
and
ntpdc(1ntpdcmdoc)
queries.
ntpd(1ntpdmdoc)
.
Thus, monitoring is always active as
long as there is a restriction entry with the
.Cm
limited
flag.
ntpq(1ntpqmdoc)
and
ntpdc(1ntpdcmdoc)
queries which attempt to modify the state of the
server (i.e., run time reconfiguration).
Queries which return
information are permitted.
ntpq(1ntpqmdoc)
and
ntpdc(1ntpdcmdoc)
queries.
Time service is not affected.
ntpq(1ntpqmdoc)
and
ntpdc(1ntpdcmdoc)
queries.
Default restriction list entries with the flags ignore, interface, ntpport, for each of the local host's interface addresses are inserted into the table at startup to prevent the server from attempting to synchronize to its own time. A default entry is also always present, though if it is otherwise unconfigured; no flags are associated with the default entry (i.e., everything besides your own NTP server is unrestricted).
.Sh Automatic NTP Configuration Options .Ss Manycasting Manycasting is a automatic discovery and configuration paradigm new to NTPv4. It is intended as a means for a multicast client to troll the nearby network neighborhood to find cooperating manycast servers, validate them using cryptographic means and evaluate their time values with respect to other servers that might be lurking in the vicinity. The intended result is that each manycast client mobilizes client associations with some number of the "best" of the nearby manycast servers, yet automatically reconfigures to sustain this number of servers should one or another fail.
Note that the manycasting paradigm does not coincide with the anycast paradigm described in RFC-1546, which is designed to find a single server from a clique of servers providing the same service. The manycast paradigm is designed to find a plurality of redundant servers satisfying defined optimality criteria.
Manycasting can be used with either symmetric key or public key cryptography. The public key infrastructure (PKI) offers the best protection against compromised keys and is generally considered stronger, at least with relatively large key sizes. It is implemented using the Autokey protocol and the OpenSSL cryptographic library available from .Li http://www.openssl.org/ . The library can also be used with other NTPv4 modes as well and is highly recommended, especially for broadcast modes.
A persistent manycast client association is configured using the manycastclient command, which is similar to the server command but with a multicast (IPv4 class .Cm D or IPv6 prefix .Cm FF ) group address. The IANA has designated IPv4 address 224.1.1.1 and IPv6 address FF05::101 (site local) for NTP. When more servers are needed, it broadcasts manycast client messages to this address at the minimum feasible rate and minimum feasible time-to-live (TTL) hops, depending on how many servers have already been found. There can be as many manycast client associations as different group address, each one serving as a template for a future ephemeral unicast client/server association.
Manycast servers configured with the .Ic manycastserver command listen on the specified group address for manycast client messages. Note the distinction between manycast client, which actively broadcasts messages, and manycast server, which passively responds to them. If a manycast server is in scope of the current TTL and is itself synchronized to a valid source and operating at a stratum level equal to or lower than the manycast client, it replies to the manycast client message with an ordinary unicast server message.
The manycast client receiving this message mobilizes an ephemeral client/server association according to the matching manycast client template, but only if cryptographically authenticated and the server stratum is less than or equal to the client stratum. Authentication is explicitly required and either symmetric key or public key (Autokey) can be used. Then, the client polls the server at its unicast address in burst mode in order to reliably set the host clock and validate the source. This normally results in a volley of eight client/server at 2-s intervals during which both the synchronization and cryptographic protocols run concurrently. Following the volley, the client runs the NTP intersection and clustering algorithms, which act to discard all but the "best" associations according to stratum and synchronization distance. The surviving associations then continue in ordinary client/server mode.
The manycast client polling strategy is designed to reduce as much as possible the volume of manycast client messages and the effects of implosion due to near-simultaneous arrival of manycast server messages. The strategy is determined by the .Ic manycastclient , .Ic tos and .Ic ttl configuration commands. The manycast poll interval is normally eight times the system poll interval, which starts out at the .Cm minpoll value specified in the .Ic manycastclient , command and, under normal circumstances, increments to the .Cm maxpolll value specified in this command. Initially, the TTL is set at the minimum hops specified by the ttl command. At each retransmission the TTL is increased until reaching the maximum hops specified by this command or a sufficient number client associations have been found. Further retransmissions use the same TTL.
The quality and reliability of the suite of associations discovered by the manycast client is determined by the NTP mitigation algorithms and the .Cm minclock and .Cm minsane values specified in the .Ic tos configuration command. At least .Cm minsane candidate servers must be available and the mitigation algorithms produce at least .Cm minclock survivors in order to synchronize the clock. Byzantine agreement principles require at least four candidates in order to correctly discard a single falseticker. For legacy purposes, .Cm minsane defaults to 1 and .Cm minclock defaults to 3. For manycast service .Cm minsane should be explicitly set to 4, assuming at least that number of servers are available.
If at least .Cm minclock servers are found, the manycast poll interval is immediately set to eight times .Cm maxpoll . If less than .Cm minclock servers are found when the TTL has reached the maximum hops, the manycast poll interval is doubled. For each transmission after that, the poll interval is doubled again until reaching the maximum of eight times .Cm maxpoll . Further transmissions use the same poll interval and TTL values. Note that while all this is going on, each client/server association found is operating normally it the system poll interval.
Administratively scoped multicast boundaries are normally specified by the network router configuration and, in the case of IPv6, the link/site scope prefix. By default, the increment for TTL hops is 32 starting from 31; however, the .Ic ttl configuration command can be used to modify the values to match the scope rules.
It is often useful to narrow the range of acceptable servers which can be found by manycast client associations. Because manycast servers respond only when the client stratum is equal to or greater than the server stratum, primary (stratum 1) servers fill find only primary servers in TTL range, which is probably the most common objective. However, unless configured otherwise, all manycast clients in TTL range will eventually find all primary servers in TTL range, which is probably not the most common objective in large networks. The .Ic tos command can be used to modify this behavior. Servers with stratum below .Cm floor or above .Cm ceiling specified in the .Ic tos command are strongly discouraged during the selection process; however, these servers may be temporally accepted if the number of servers within TTL range is less than .Cm minclock .
The above actions occur for each manycast client message, which repeats at the designated poll interval. However, once the ephemeral client association is mobilized, subsequent manycast server replies are discarded, since that would result in a duplicate association. If during a poll interval the number of client associations falls below .Cm minclock , all manycast client prototype associations are reset to the initial poll interval and TTL hops and operation resumes from the beginning. It is important to avoid frequent manycast client messages, since each one requires all manycast servers in TTL range to respond. The result could well be an implosion, either minor or major, depending on the number of servers in range. The recommended value for .Cm maxpoll is 12 (4,096 s).
It is possible and frequently useful to configure a host as both manycast client and manycast server. A number of hosts configured this way and sharing a common group address will automatically organize themselves in an optimum configuration based on stratum and synchronization distance. For example, consider an NTP subnet of two primary servers and a hundred or more dependent clients. With two exceptions, all servers and clients have identical configuration files including both .Ic multicastclient and .Ic multicastserver commands using, for instance, multicast group address 239.1.1.1. The only exception is that each primary server configuration file must include commands for the primary reference source such as a GPS receiver.
The remaining configuration files for all secondary servers and clients have the same contents, except for the .Ic tos command, which is specific for each stratum level. For stratum 1 and stratum 2 servers, that command is not necessary. For stratum 3 and above servers the .Cm floor value is set to the intended stratum number. Thus, all stratum 3 configuration files are identical, all stratum 4 files are identical and so forth.
Once operations have stabilized in this scenario, the primary servers will find the primary reference source and each other, since they both operate at the same stratum (1), but not with any secondary server or client, since these operate at a higher stratum. The secondary servers will find the servers at the same stratum level. If one of the primary servers loses its GPS receiver, it will continue to operate as a client and other clients will time out the corresponding association and re-associate accordingly.
Some administrators prefer to avoid running
ntpd(1ntpdmdoc)
continuously and run either
ntpdate(8)
or
ntpd(1ntpdmdoc)
-q
as a cron job.
In either case the servers must be
configured in advance and the program fails if none are
available when the cron job runs.
A really slick
application of manycast is with
ntpd(1ntpdmdoc)
-q
. The program wakes up, scans the local landscape looking
for the usual suspects, selects the best from among
the rascals, sets the clock and then departs.
Servers do not have to be configured in advance and
all clients throughout the network can have the same
configuration file.
.Ss
Manycast
Interactions
with
Autokey
Each time a manycast client sends a client mode packet
to a multicast group address, all manycast servers
in scope generate a reply including the host name
and status word.
The manycast clients then run
the Autokey protocol, which collects and verifies
all certificates involved.
Following the burst interval
all but three survivors are cast off,
but the certificates remain in the local cache.
It often happens that several complete signing trails
from the client to the primary servers are collected in this way.
About once an hour or less often if the poll interval exceeds this, the client regenerates the Autokey key list. This is in general transparent in client/server mode. However, about once per day the server private value used to generate cookies is refreshed along with all manycast client associations. In this case all cryptographic values including certificates is refreshed. If a new certificate has been generated since the last refresh epoch, it will automatically revoke all prior certificates that happen to be in the certificate cache. At the same time, the manycast scheme starts all over from the beginning and the expanding ring shrinks to the minimum and increments from there while collecting all servers in scope. .Ss Manycast Options
0.Cm floor Ar floor | .Cm minclock Ar minclock | .Cm minsane Ar minsane .Oc .Xc This command affects the clock selection and clustering algorithms. It can be used to select the quality and quantity of peers used to synchronize the system clock and is most useful in manycast mode. The variables operate as follows:
.It Cm ttl Ar hop ... This command specifies a list of TTL values in increasing order, up to 8 values can be specified. In manycast mode these values are used in turn in an expanding-ring search. The default is eight multiples of 32 starting at 31.
.Sh Reference Clock Support The NTP Version 4 daemon supports some three dozen different radio, satellite and modem reference clocks plus a special pseudo-clock used for backup or when no other clock source is available. Detailed descriptions of individual device drivers and options can be found in the .Qq Reference Clock Drivers page (available as part of the HTML documentation provided in .Pa /usr/share/doc/ntp ) . Additional information can be found in the pages linked there, including the .Qq Debugging Hints for Reference Clock Drivers and .Qq How To Write a Reference Clock Driver pages (available as part of the HTML documentation provided in .Pa /usr/share/doc/ntp ) . In addition, support for a PPS signal is available as described in the .Qq Pulse-per-second (PPS) Signal Interfacing page (available as part of the HTML documentation provided in .Pa /usr/share/doc/ntp ) . Many drivers support special line discipline/streams modules which can significantly improve the accuracy using the driver. These are described in the .Qq Line Disciplines and Streams Drivers page (available as part of the HTML documentation provided in .Pa /usr/share/doc/ntp ) .
A reference clock will generally (though not always) be a radio timecode receiver which is synchronized to a source of standard time such as the services offered by the NRC in Canada and NIST and USNO in the US. The interface between the computer and the timecode receiver is device dependent, but is usually a serial port. A device driver specific to each reference clock must be selected and compiled in the distribution; however, most common radio, satellite and modem clocks are included by default. Note that an attempt to configure a reference clock when the driver has not been compiled or the hardware port has not been appropriately configured results in a scalding remark to the system log file, but is otherwise non hazardous.
For the purposes of configuration,
ntpd(1ntpdmdoc)
treats
reference clocks in a manner analogous to normal NTP peers as much
as possible.
Reference clocks are identified by a syntactically
correct but invalid IP address, in order to distinguish them from
normal NTP peers.
Reference clock addresses are of the form
.Sm
off
.Li
127.127.
Ar
t
.
Ar
u
,
.Sm
on
where
.Ar
t
is an integer
denoting the clock type and
.Ar
u
indicates the unit
number in the range 0-3.
While it may seem overkill, it is in fact
sometimes useful to configure multiple reference clocks of the same
type, in which case the unit numbers must be unique.
The .Ic server command is used to configure a reference clock, where the .Ar address argument in that command is the clock address. The .Cm key , .Cm version and .Cm ttl options are not used for reference clock support. The .Cm mode option is added for reference clock support, as described below. The .Cm prefer option can be useful to persuade the server to cherish a reference clock with somewhat more enthusiasm than other reference clocks or peers. Further information on this option can be found in the .Qq Mitigation Rules and the prefer Keyword (available as part of the HTML documentation provided in .Pa /usr/share/doc/ntp ) page. The .Cm minpoll and .Cm maxpoll options have meaning only for selected clock drivers. See the individual clock driver document pages for additional information.
The .Ic fudge command is used to provide additional information for individual clock drivers and normally follows immediately after the .Ic server command. The .Ar address argument specifies the clock address. The .Cm refid and .Cm stratum options can be used to override the defaults for the device. There are two optional device-dependent time offsets and four flags that can be included in the .Ic fudge command as well.
The stratum number of a reference clock is by default zero.
Since the
ntpd(1ntpdmdoc)
daemon adds one to the stratum of each
peer, a primary server ordinarily displays an external stratum of
one.
In order to provide engineered backups, it is often useful to
specify the reference clock stratum as greater than zero.
The
.Cm
stratum
option is used for this purpose.
Also, in cases
involving both a reference clock and a pulse-per-second (PPS)
discipline signal, it is useful to specify the reference clock
identifier as other than the default, depending on the driver.
The
.Cm
refid
option is used for this purpose.
Except where noted,
these options apply to all clock drivers.
.Ss
Reference
Clock
Commands
.It
Xo
Ic
fudge
.Sm
off
.Li
127.127.
Ar
t
.
Ar
u
.Sm
on
.Op
Cm
time1
Ar
sec
.Op
Cm
time2
Ar
sec
.Op
Cm
stratum
Ar
int
.Op
Cm
refid
Ar
string
.Op
Cm
mode
Ar
int
.Op
Cm
flag1
Cm
0.Op
Cm
flag2
Cm
0.Op
Cm
flag3
Cm
0.Op
Cm
flag4
Cm
0.Xc
This command can be used to configure reference clocks in
special ways.
It must immediately follow the
.Ic
server
command which configures the driver.
Note that the same capability
is possible at run time using the
ntpdc(1ntpdcmdoc)
program.
The options are interpreted as
follows:
.Sh Miscellaneous Options
-f
command line option.
If the file exists, it is read at
startup in order to set the initial frequency and then updated once per
hour with the current frequency computed by the daemon.
If the file name is
specified, but the file itself does not exist, the starts with an initial
frequency of zero and creates the file when writing it for the first time.
If this command is not given, the daemon will always start with an initial
frequency of zero.
The file format consists of a single line containing a single
floating point number, which records the frequency offset measured
in parts-per-million (PPM).
The file is updated by first writing
the current drift value into a temporary file and then renaming
this file to replace the old version.
This implies that
ntpd(1ntpdmdoc)
must have write permission for the directory the
drift file is located in, and that file system links, symbolic or
otherwise, should be avoided.
ntpdc(1ntpdcmdoc)
utility program.
ntpdc(1ntpdcmdoc)
program
and the
.Ic
monlist
command or further information.
The
default for this flag is
.Ic
enable
.
.It
Ic
includefile
Ar
includefile
This command allows additional configuration commands
to be included from a separate file.
Include files may
be nested to a depth of five; upon reaching the end of any
include file, command processing resumes in the previous
configuration file.
This option is useful for sites that run
ntpd(1ntpdmdoc)
on multiple hosts, with (mostly) common options (e.g., a
restriction list).
.It
Ic
logconfig
Ar
configkeyword
This command controls the amount and type of output written to
the system
syslog(3)
facility or the alternate
.Ic
logfile
log file.
By default, all output is turned on.
All
.Ar
configkeyword
keywords can be prefixed with
.Ql
=
,
.Ql
+
and
.Ql
-
,
where
.Ql
=
sets the
syslog(3)
priority mask,
.Ql
+
adds and
.Ql
-
removes
messages.
syslog(3)
messages can be controlled in four
classes
.Po
.Cm
clock
,
.Cm
peer
,
.Cm
sys
and
.Cm
sync
.Pc
.
Within these classes four types of messages can be
controlled: informational messages
.Po
.Cm
info
.Pc
,
event messages
.Po
.Cm
events
.Pc
,
statistics messages
.Po
.Cm
statistics
.Pc
and
status messages
.Po
.Cm
status
.Pc
.
Configuration keywords are formed by concatenating the message class with the event class. The .Cm all prefix can be used instead of a message class. A message class may also be followed by the .Cm all keyword to enable/disable all messages of the respective message class.Thus, a minimal log configuration could look like this: .Bd -literal logconfig =syncstatus +sysevents .Ed
This would just list the synchronizations state of
ntpd(1ntpdmdoc)
and the major system events.
For a simple reference server, the
following minimum message configuration could be useful:
.Bd
-literal
logconfig =syncall +clockall
.Ed
This configuration will list all clock information and
synchronization information.
All other events and messages about
peers, system events and so on is suppressed.
.It
Ic
logfile
Ar
logfile
This command specifies the location of an alternate log file to
be used instead of the default system
syslog(3)
facility.
This is the same operation as the -l command line option.
.It
Ic
setvar
Ar
variable
Op
Cm
default
This command adds an additional system variable.
These
variables can be used to distribute additional information such as
the access policy.
If the variable of the form
.Sm
off
.Va
name
=
Ar
value
.Sm
on
is followed by the
.Cm
default
keyword, the
variable will be listed as part of the default system variables
.Po
ntpq(1ntpqmdoc)
.Ic
rv
command
.Pc
)
.
These additional variables serve
informational purposes only.
They are not related to the protocol
other that they can be listed.
The known protocol variables will
always override any variables defined via the
.Ic
setvar
mechanism.
There are three special variables that contain the names
of all variable of the same group.
The
.Va
sys_var_list
holds
the names of all system variables.
The
.Va
peer_var_list
holds
the names of all peer variables and the
.Va
clock_var_list
holds the names of the reference clock variables.
.It
Xo
Ic
tinker
.Oo
.Cm
allan
Ar
allan
|
.Cm
dispersion
Ar
dispersion
|
.Cm
freq
Ar
freq
|
.Cm
huffpuff
Ar
huffpuff
|
.Cm
panic
Ar
panic
|
.Cm
step
Ar
srep
|
.Cm
stepout
Ar
stepout
.Oc
.Xc
This command can be used to alter several system variables in
very exceptional circumstances.
It should occur in the
configuration file before any other configuration options.
The
default values of these variables have been carefully optimized for
a wide range of network speeds and reliability expectations.
In
general, they interact in intricate ways that are hard to predict
and some combinations can result in some very nasty behavior.
Very
rarely is it necessary to change the default values; but, some
folks cannot resist twisting the knobs anyway and this command is
for them.
Emphasis added: twisters are on their own and can expect
no help from the support group.
The variables operate as follows:
.It Xo Ic trap Ar host_address .Op Cm port Ar port_number .Op Cm interface Ar interface_address .Xc This command configures a trap receiver at the given host address and port number for sending messages with the specified local interface address. If the port number is unspecified, a value of 18447 is used. If the interface address is not specified, the message is sent with a source address of the local interface the message is sent through. Note that on a multihomed host the interface used may vary from time to time with routing changes.
The trap receiver will generally log event messages and other information from the server in a log file. While such monitor programs may also request their own trap dynamically, configuring a trap receiver will ensure that no messages are lost when the server is started. .It Cm hop Ar ... This command specifies a list of TTL values in increasing order, up to 8 values can be specified. In manycast mode these values are used in turn in an expanding-ring search. The default is eight multiples of 32 starting at 31.
This section was generated by AutoGen,
using the agtexi-cmd
template and the option descriptions for the ntp.conf
program.
This software is released under the NTP license, <http://ntp.org/license>.
This is the automatically generated usage text for ntp.conf.
The text printed is the same whether selected with the help
option
(--help) or the more-help
option (--more-help). more-help
will print
the usage text by passing it through a pager program.
more-help
is disabled on platforms without a working
fork(2)
function. The PAGER
environment variable is
used to select the program, defaulting to more. Both will exit
with a status code of 0.
ntp.conf is unavailable - no --help
Any option that is not marked as not presettable may be preset by
loading values from environment variables named NTP.CONF
and NTP.CONF_<OPTION_NAME>
. <OPTION_NAME>
must be one of
the options listed above in upper case and segmented with underscores.
The NTP.CONF
variable will be tokenized and parsed like
the command line. The remaining variables are tested for existence and their
values are treated like option arguments.
The command line options relating to configuration and/or usage help are:
Print the program version to standard out, optionally with licensing information, then exit 0. The optional argument specifies how much licensing detail to provide. The default is to print just the version. The licensing infomation may be selected with an option argument. Only the first letter of the argument is examined:
One of the following exit values will be returned:
.Sh
SEE
ALSO
ntpd(1ntpdmdoc)
,
ntpdc(1ntpdcmdoc)
,
ntpq(1ntpqmdoc)
In addition to the manual pages provided, comprehensive documentation is available on the world wide web at .Li http://www.ntp.org/ . A snapshot of this documentation is available in HTML format in .Pa /usr/share/doc/ntp . .Rs .%A David L. Mills .%T Network Time Protocol (Version 4) .%O RFC5905 .Re
The syntax checking is not picky; some combinations of ridiculous and even hilarious options and modes may not be detected.
The .Pa ntpkey_ Ns Ar host files are really digital certificates. These should be obtained via secure directory services when they become universally available.
This document corresponds to version of NTP. This document was derived from FreeBSD.