diff options
author | sheldonh <sheldonh@FreeBSD.org> | 2001-08-29 14:50:56 +0000 |
---|---|---|
committer | sheldonh <sheldonh@FreeBSD.org> | 2001-08-29 14:50:56 +0000 |
commit | 692bc648fffcac38fd766ba0c4aa92d593444e95 (patch) | |
tree | 1eaecaa5d377b7b1ce5983e729189cf951de8393 /usr.sbin/ntp/doc | |
parent | edc758be4634e1860f1e2d6bfafe352d642aedcf (diff) | |
download | FreeBSD-src-692bc648fffcac38fd766ba0c4aa92d593444e95.zip FreeBSD-src-692bc648fffcac38fd766ba0c4aa92d593444e95.tar.gz |
Update the mdoc NTP documentation transcribed from the HTML documentation
for ntp-4.1.0.
Unfortunately, David Mills insists on managing the documentation in
such a way as to make it impossible for me to make things easy on our
translators, without printing out the documentation and reading through
it side-by-side with a finger on each page.
Diffstat (limited to 'usr.sbin/ntp/doc')
-rw-r--r-- | usr.sbin/ntp/doc/ntp-genkeys.8 | 206 | ||||
-rw-r--r-- | usr.sbin/ntp/doc/ntp.conf.5 | 3008 | ||||
-rw-r--r-- | usr.sbin/ntp/doc/ntp.keys.5 | 55 | ||||
-rw-r--r-- | usr.sbin/ntp/doc/ntpd.8 | 594 | ||||
-rw-r--r-- | usr.sbin/ntp/doc/ntpdate.8 | 329 | ||||
-rw-r--r-- | usr.sbin/ntp/doc/ntpdc.8 | 1014 | ||||
-rw-r--r-- | usr.sbin/ntp/doc/ntpq.8 | 1000 |
7 files changed, 3705 insertions, 2501 deletions
diff --git a/usr.sbin/ntp/doc/ntp-genkeys.8 b/usr.sbin/ntp/doc/ntp-genkeys.8 new file mode 100644 index 0000000..3af0f47 --- /dev/null +++ b/usr.sbin/ntp/doc/ntp-genkeys.8 @@ -0,0 +1,206 @@ +.\" +.\" $FreeBSD$ +.\" +.Dd August 2, 2001 +.Dt NTP_GENKEYS 8 +.Os +.Sh NAME +.Nm ntp-genkeys +.Nd generate public and private keys +.Sh SYNOPSIS +.Nm +.Op Fl dfhlnt +.Op Fl c Ar conffile +.Op Fl g Ar target +.Op Fl k Ar keyfile +.Sh DESCRIPTION +This program generates random keys used by either or both the +NTPv3/NTPv4 symmetric key or the NTPv4 public key (Autokey) +cryptographic authentication schemes. +.Pp +The following options are available: +.Bl -tag -width indent +.It Fl c Ar conffile +Location of +.Xr ntp.conf 8 +file. +.It Fl d +enable debug messages (can be used multiple times) +.It Fl f +force installation of generated keys. +.It Fl g target +Generate file or files indicated by the characters in the +.Ar target +string: +.Bl -tag -width X +.It Li d +Generate D-H parameter file. +.It Li m +Generate MD5 key file. +.It Li r +Generate RSA keys. +.El +.It Fl h +Build keys here (current directory). +Implies +.Fl l . +.It Fl k Ar keyfile +Location of key file. +.It Fl l +Do not make the symlinks. +.It Fl n +Do not actually do anything, just say what would be done. +.It Fl t +Trash the (old) files at the end of symlink. +.El +.Pp +By default the program +generates the +.Xr ntp.keys 5 +file containing 16 random symmetric +keys. +In addition, if the +rsaref20 +package is configured +for the software build, the program generates cryptographic values +used by the Autokey scheme. +These values are incorporated as a set +of three files, +.Pa ntpkey +containing the RSA private key, +.Pa ntpkey_ Ns Ar host +containing the RSA public key, where +.Ar host +is the DNS name of the generating machine, and +.Pa ntpkey_dh +containing the parameters for the Diffie-Hellman +key-agreement algorithm. +All files and are in printable ASCII +format. +A timestamp in NTP seconds is appended to each. +Since the +algorithms are seeded by the system clock, each run of this program +produces a different file and file name. +.Pp +The +.Xr ntp.keys 5 +file contains 16 MD5 keys. +Each key +consists of 16 characters randomized over the ASCII 95-character +printing subset. +The file is read by the daemon at the location +specified by the +.Ic keys +configuration file command and made +visible only to root. +An additional key consisting of a easily +remembered password should be added by hand for use with the +.Xr ntpq 8 +and +.Xr ntpdc 8 +programs. +The file must be +distributed by secure means to other servers and clients sharing +the same security compartment. +While the key identifiers for MD5 +and DES keys must be in the range 1-65534, inclusive, the +.Nm +program uses only the identifiers from 1 to +16. +The key identifier for each association is specified as the key +argument in the +.Ic server +or +.Ic peer +configuration file command. +.Pp +The +.Pa ntpkey +file contains the RSA private key. +It is +read by the daemon at the location specified by the +.Ar privatekey +argument of the +.Ic crypto +configuration +file command and made visible only to root. +This file is useful +only to the machine that generated it and never shared with any +other daemon or application program. +.Pp +The +.Pa ntpkey_ Ns Ar host +file contains the RSA public +key, where +.Ar host +is the DNS name of the host that +generated it. +The file is read by the daemon at the location +specified by the +.Ar publickey +argument to the +.Ic server +or +.Ic peer +configuration file command. +This file can be +widely distributed and stored without using secure means, since the +data are public values. +.Pp +The +.Pa ntp_dh +file contains two Diffie-Hellman parameters: +the prime modulus and the generator. +The file is read by the daemon +at the location specified by the +.Ar dhparams +argument of the +.Ic crypto +configuration file command. +The file can be +distributed by insecure means to other servers and clients sharing +the same key agreement compartment, since the data are public +values. +.Pp +The file formats begin with two lines, the first containing the +generating system DNS name and the second the datestamp. +Lines +beginning with +.Ql # +are considered comments and ignored by +the daemon. +In the +.Xr ntp.keys 5 +file, the next 16 lines +contain the MD5 keys in order. +If necessary, this file can be +further customized by an ordinary text editor. +The format is +described in the following section. +In the +.Pa ntpkey +and +.Pa ntpkey_ Ns Ar host +files, the next line contains the +modulus length in bits followed by the key as a PEM encoded string. +In the +.Pa ntpkey_dh +file, the next line contains the prime +length in bytes followed by the prime as a PEM encoded string, and +the next and final line contains the generator length in bytes +followed by the generator as a PEM encoded string. +.Pp +Note: See the file +.Pa ./source/rsaref.h +in the +rsaref20 +package for explanation of return values, if +necessary. +.Sh SEE ALSO +.Xr ntp.keys 5 , +.Xr ntpdc 8 , +.Xr ntpq 8 +.Sh BUGS +It can take quite a while to generate the RSA public/private key +pair and Diffie-Hellman parameters, from a few seconds on a modern +workstation to several minutes on older machines. diff --git a/usr.sbin/ntp/doc/ntp.conf.5 b/usr.sbin/ntp/doc/ntp.conf.5 index af4e162..a605e08 100644 --- a/usr.sbin/ntp/doc/ntp.conf.5 +++ b/usr.sbin/ntp/doc/ntp.conf.5 @@ -24,9 +24,11 @@ but could be installed elsewhere .Fl c command line option). .Pp -The file format is similar to other Unix configuration files. +The file format is similar to other +.Ux +configuration files. Comments begin with a -.Qq # +.Ql # character and extend to the end of the line; blank lines are ignored. Configuration commands consist of an initial keyword @@ -40,9 +42,7 @@ and text strings. .Pp The rest of this page describes the configuration and control options. The -.Qo -Notes on Configuring NTP and Setting up a NTP Subnet -.Qc +.Qq "Notes on Configuring NTP and Setting up a NTP Subnet" page (available as part of the HTML documentation provided in @@ -73,470 +73,400 @@ the only required option is one or more or .Ic manycastclient commands. -.Ss Configuration Options -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 operands. -The various modes are determined by the command keyword -and the type of the required IP address. +.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 auxilliary 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 (IP class A, B and C), -(b) the broadcast address of a local interface, -(m) a multicast address (IP class D), -or (r) a reference clock address (127.127.x.x). -Note that, -while autokey and burst modes are supported by these commands, -their effect in some weird mode combinationscan be meaningless -or even destructive. +(s) a remote server or peer (IP class A, B and C), (b) the +broadcast address of a local interface, (m) a multicast address (IP +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. .Bl -tag -width indent -.It Xo Ic peer -.Ar address -.Op autokey | key Ar key -.Op burst -.Op version Ar version -.Op prefer -.Op minpoll Ar minpoll -.Op maxpoll Ar maxpoll +.It Xo Ic server Ar address +.Op Cm key Ar key \&| Cm autokey +.Op Cm burst +.Op Cm iburst +.Op Cm version Ar version +.Op Cm prefer +.Op Cm minpoll Ar minpoll +.Op Cm maxpoll Ar maxpoll .Xc -.It Xo Ic server -.Ar address -.Op autokey | key Ar key -.Op burst -.Op version Ar version -.Op prefer -.Op minpoll Ar minpoll -.Op maxpoll Ar maxpoll +.It Xo Ic peer Ar address +.Op Cm key Ar key \&| Cm autokey +.Op Cm version Ar version +.Op Cm prefer +.Op Cm minpoll Ar minpoll +.Op Cm maxpoll Ar maxpoll .Xc -.It Xo Ic broadcast -.Ar address -.Op autokey | key Ar key -.Op burst -.Op version Ar version -.Op minpoll Ar minpoll -.Op maxpoll Ar maxpoll -.Op ttl Ar ttl +.It Xo Ic broadcast Ar address +.Op Cm key Ar key \&| Cm autokey +.Op Cm version Ar version +.Op Cm prefer +.Op Cm minpoll Ar minpoll +.Op Cm ttl Ar ttl .Xc -.It Xo Ic manycastclient -.Ar address -.Op autokey | key Ar key -.Op burst -.Op version Ar version -.Op minpoll Ar minpoll -.Op maxpoll Ar maxpoll -.Op ttl Ar ttl +.It Xo Ic manycastclient Ar address +.Op Cm key Ar key \&| Cm autokey +.Op Cm version Ar version +.Op Cm prefer +.Op Cm minpoll Ar minpoll +.Op Cm maxpoll Ar maxpoll +.Op Cm ttl Ar ttl .Xc -These four commands specify the time server name or address -to be used and the mode in which to operate. -The 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 -.Qo -Association Management -.Qc +.El +.Pp +These four 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 a IP address in dotted-quad notation. +Additional information on association behavior can be found in the +.Qq "Association Management" page. .Bl -tag -width indent -.It Ic peer -For type s addresses (only), -this operates as the current peer command, -which mobilizes a persistent symmetric-active mode association, -except that additional modes are available. +.It Ic server +For type s and r addresses, this command mobilizes a persistent +client mode association with the specified remote server or local +radio clock. +In this mode the local clock can synchronized to the +remote server, but the remote server can never be synchronized to +the local clock. This command should .Em not -be used for type b, m or r addresses. -.Pp -The -.Ic peer -command specifies that the local server is to operate -in symmetric active mode with the remote server. -In this mode, -the local server can be synchronized to the remote server -and, in addition, -the remote server can be synchronized by the local server. -This is useful in a network of servers where, -depending on various failure scenarios, -either the local or remote server may be the better source of time. -.It Ic server -For type s and r addresses, -this operates as the NTPv3 server command, -which mobilizes a persistent client mode association. -The server command specifies -that the local server is to operate in client mode -with the specified remote server. -In this mode, -the local server can be synchronized to the remote server, -but the remote server can never be synchronized to the local server. +be used for type +b or m addresses. +.It Ic peer +For type s addresses (only), this command mobilizes a +persistent symmetric-active mode association with the specified +remote peer. +In this mode the local clock can be synchronized to +the remote peer or the remote peer can be synchronized to the local +clock. +This is useful in a network of servers where, depending on +various failure scenarios, either the local or remote peer may be +the better source of time. +This command should NOT be used for type +b, m or r addresses. .It Ic broadcast -For type b and m addresses (only), -this is operates as the current NTPv3 broadcast command, -which mobilizes a persistent broadcast mode association, -except that additional modes are available. -Multiple commands can be used -to specify multiple local broadcast interfaces (subnets) -and/or multiple multicast groups. -Note that local broadcast messages go only to the interface -associated with the subnet specified, -but multicast messages go to all interfaces. -In the current implementation, -the source address used for these messages -is the Unix host default address. -.Pp -In broadcast mode, -the local server sends periodic broadcast messages -to a client population at the address specified, -which is usually the broadcast address -on (one of) the local network(s) -or a multicast address assigned to NTP. -The IANA has assigned the multicast group address 224.0.1.1 -exclusively to NTP, -but other non-conflicting addresses can be used -to contain the messages within administrative boundaries. -Ordinarily, this specification applies -only to the local server operating as a sender; -for operation as a broadcast client, -see the +For type b and m addresses (only), this +command mobilizes a persistent broadcast mode association. +Multiple +commands can be used to specify multiple local broadcast interfaces +(subnets) and/or multiple multicast groups. +Note that local +broadcast messages go only to the interface associated with the +subnet specified, but multicast messages go to all interfaces. +In broadcast mode the local server sends periodic broadcast +messages to a client population at the <i><tt>address</tt></i> +specified, which is usually the broadcast address on (one of) the +local network(s) or a multicast address assigned to NTP. +The IANA +has assigned the multicast group address 224.0.1.1 exclusively to +NTP, but other nonconflicting addresses can be used to contain the +messages within administrative boundaries. +Ordinarily, this +specification applies only to the local server operating as a +sender; for operation as a broadcast client, see the .Ic broadcastclient or .Ic multicastclient -commands below. +commands +below. .It Ic manycastclient -For type m addresses (only), -this mobilizes a manycast client-mode association -for the multicast address specified. -In this case a specific address must be supplied -which matches the address used on the +For type m addresses (only), this command mobilizes a +manycast client mode association for the multicast address +specified. +In this case a specific address must be supplied which +matches the address used on the .Ic manycastserver -command for the designated manycast servers. -The NTP multicast address 224.0.1.1 assigned by the IANA should -.Em not -be used, -unless specific means are taken -to avoid spraying large areas of the Internet -with these messages -and causing a possibly massive implosion of replies at the sender. -.Pp +command for +the designated manycast servers. +The NTP multicast address +224.0.1.1 assigned by the IANA should NOT be used, unless specific +means are taken to avoid spraying large areas of the Internet with +these messages and causing a possibly massive implosion of replies +at the sender. The -.Ic manycastclient -command specifies -that the local server is to operate in client mode -with the remote servers -that are discovered as the result of broadcast/multicast messages. -The client broadcasts a request message -to the group address associated with the specified address -and specifically enabled servers respond to these messages. -The client selects the servers providing the best time -and continues as with the +.Ic manycastserver +command specifies that the local server +is to operate in client mode with the remote servers that are +discovered as the result of broadcast/multicast messages. +The +client broadcasts a request message to the group address associated +with the specified +.Ar address +and specifically enabled +servers respond to these messages. +The client selects the servers +providing the best time and continues as with the .Ic server command. -The remaining servers are discarded as if never heard. +The remaining servers are discarded as if never +heard. .El .Pp -The following options to these commands are available: +Options: .Bl -tag -width indent -.It autokey -All packets sent to the address -are to include authentication fields -encrypted using the autokey scheme. -.It burst -At each poll interval, -send a burst of eight packets spaced, -instead of the usual one. -.It key Ar key -All packets sent to the address -are to include authentication fields -encrypted using the specified key identifier, -which is an unsigned 32-bit integer -less than 65536. -The default is to include no encryption field. -.It version Ar version -Specifies the version number to be used for outgoing NTP packets. -Versions 1-4 are the choices, with version 4 the default. -.It prefer +.It Cm autokey +All packets sent to and received from the server or peer are to +include authentication fields encrypted using the autokey scheme +described in +.Sx Authentication Options . +.It Cm burst +when the server is reachable and at each poll interval, send a +burst of eight packets instead of the usual one packet. +The spacing +between the first and the second packets is about 16s to allow a +modem call to complete, while the spacing between the remaining +packets is about 2s. +This is designed to improve timekeeping +quality with the +.Ic server +command and s +addresses. +.It Cm iburst +When the server is unreachable and at each poll interval, send +a burst of eight packets instead of the usual one. +As long as the +server is unreachable, the spacing between packets is about 16s to +allow a modem call to complete. +Once the server is reachable, the +spacing between packets is about 2s. +This is designed to speed the +initial synchronization acquisition with the +.Ic server +command and s addresses and when +.Nm +is started +with the +.Fl q +option. +.It Cm key Ar key +All packets sent to and received from the server or peer are to +include authentication fields encrypted using the specified +.Ar key +identifier with values from 1 to 65534, inclusive. +The +default is to include no encryption field. +.It Cm minpoll Ar minpoll +.It Cm maxpoll Ar maxpoll +These options specify the minimum and maximum poll intervals +for NTP messages, in seconds to the power of two. +The maximum poll +interval defaults to 10 (1,024 s), but can be increased by the +.Cm maxpoll +option to an upper limit of 17 (36.4 h). +The +minimum poll interval defaults to 6 (64 s), but can be decreased by +the +.Cm minpoll +option to a lower limit of 4 (16 s). +.It Cm prefer Marks the server as preferred. All other things being equal, -this host will be chosen for synchronization -among a set of correctly operating hosts. +this host will be chosen for synchronization among a set of +correctly operating hosts. See the -.Qo -Mitigation Rules and the prefer Keyword -.Qc -page -for further information. -.It ttl Ar ttl -This option is used only with broadcast mode. -It specifies the time-to-live (TTL) to use -on multicast packets. -Selection of the proper value, -which defaults to 127, -is something of a black art -and must be coordinated with the network administrator. -.It minpoll Ar minpoll -.It maxpoll Ar maxpoll -These options specify the minimum -and maximum polling intervals for NTP messages, -in seconds to the power of two. -The default range is 6 (64 s) to 10 (1,024 s). -The allowable range is 4 (16 s) to 17 (36.4 h) inclusive. +.Qq "Mitigation Rules and the prefer Keyword" +page for further +information. +.It Cm ttl Ar ttl +This option is used only with broadcast server and manycast +client modes. +It specifies the time-to-live +.Cm ttl +to +use on broadcast server and multicast server and the maximum +.Cm ttl +for the expanding ring search with manycast +client packets. +Selection of the proper value, which defaults to +127, is something of a black art and should be coordinated with the +network administrator. +.It Cm version Ar version +Specifies the version number to be used for outgoing NTP +packets. +Versions 1-4 are the choices, with version 4 the +default. .El +.Ss Auxilliary Commands +.Bl -tag -width indent .It Ic broadcastclient -This command directs the local server to listen for and respond -to broadcast messages received on any local interface. -Upon hearing a broadcast message for the first time, -the local server measures the nominal network delay -using a brief client/server exchange with the remote server, -then enters the broadcastclient mode, -in which it listens for -and synchronizes to succeeding broadcast messages. +This command enables reception of broadcast server messages to +any local interface (type b) address. +Upon receiving a message for +the first time, the broadcast client measures the nominal server +propagation delay using a brief client/server exchange with the +server, then enters the broadcast client mode, in which it +synchronizes to succeeding broadcast messages. +Note that, in order +to avoid accidental or malicious disruption in this mode, both the +server and client should operate using symmetric-key or public-key +authentication as described in +.Sx Authentication Options . +.It Ic manycastserver Ar address ... +This command enables reception of manycast client messages to +the multicast group address(es) (type m) specified. +At least one +address is required, but The NTP multicast address 224.0.1.1 +assigned by the IANA should NOT be used, unless specific means are +taken to limit the span of the reply and avoid a possibly massive +implosion at the original sender. +Note that, in order to avoid +accidental or malicious disruption in this mode, both the server +and client should operate using symmetric-key or public-key +authentication as described in +.Sx Authentication Options . +.It Ic multicastclient Ar address ... +This command enables reception of multicast server messages to +the multicast group address(es) (type m) specified. +Upon receiving +a message for the first time, the multicast client measures the +nominal server propagation delay using a brief client/server +exchange with the server, then enters the broadcast client mode, in +which it synchronizes to succeeding multicast messages. Note that, in order to avoid accidental or malicious disruption in this mode, -both the local and remote servers should operate -using authentication and the same trusted key and key identifier. -.It Xo Ic multicastclient -.Op Ar address -.Op ... -.Xc -This command directs the local serverto listen for -multicast messages at the group address(es) -of the global network. -The default address is that assigned by the Numbers Czar -to NTP (224.0.1.1). -This command operates in the same way as the -.Ic broadcastclient -command, but uses IP multicasting. -Support for this command requires a multicast kernel. -.It Ic driftfile Ar driftfile -This command specifies the name of the file used -to record the frequency offset of the local clock oscillator. -If the file exists, -it is read at startup in order to set the initial frequency offset -and then updated once per hour with the current frequency offset -computed by the daemon. -If the file does not exist or this command is not given, -the initial frequency offset is assumed zero. -In this case, -it may take some hours for the frequency to stabilize -and the residual timing errors to subside. +both the server and client should operate using symmetric-key or +public-key authentication as described in +.Sx Authentication Options . +.El +.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 an 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 augmented 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. .Pp -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 -.Xr ntpd 8 -must have write permission for the directory -the drift file is located in, -and that file system links, symbolic or otherwise, should be avoided. -.It Xo Ic manycastserver -.Ar address -.Op ... -.Xc -This command directs the local server to listen for -and respond to broadcast messages received on any local interface, -and in addition enables the server to respond -to client mode messages to the multicast group address(es) -(type m) specified. -At least one address is required, -but the NTP multicast address 224.0.1.1 -assigned by the IANA should -.Em not -be used, -unless specific means are taken to limit the span of the reply -and avoid a possibly massive implosion at the original sender. -.It Xo Ic revoke -.Op Ar logsec -.Xc -Specifies the interval between recomputations -of the private value used with the autokey feature, -which ordinarily requires an expensive public-key computation. -The default value is 12 (65,536 s or about 18 hours). -For poll intervals above the specified interval, -a new private value will be recomputed for every message sent. -.It Xo Ic autokey -.Op Ar logsec -.Xc -Specifies the interval between regenerations -of the session key list used with the autokey feature. -Note that the size of the key list for each association -depends on this interval and the current poll interval. -The default value is 12 (4096 s or about 1.1 hours). -For poll intervals above the specified interval, -a session key list with a single entry -will be regenerated for every message sent. -.It Xo Ic enable -.Op Ar flag -.Op ... -.Xc -.It Xo Ic disable -.Op Ar flag -.Op ... -.Xc -Provides a way to enable or disable various server options. -Flags not mentioned are unaffected. -Note that all of these flags can be controlled remotely +NTPv4 retains the NTPv3 schemes, 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. +.Pp +Authentication is configured separately for each association using the -.Xr ntpdc 8 -utility program. -Following is a description of the flags. -.Bl -tag -width indent -.It auth -Enables the server to synchronize with unconfigured peers -only if the peer has been correctly authenticated -using a trusted key and key identifier. -The default for this flag is enable. -.It bclient -When enabled, this is identical to the broadcastclient -command. -The default for this flag is disable. -.It kernel -Enables the precision-time kernel support -for the -.Xr ntp_adjtime 2 -system call, if implemented. -Ordinarily, support for this routine is detected automatically -when the NTP daemon is compiled, -so it is not necessary for the user to worry about this flag. -It provided primarily so that this support can be disabled -during kernel development. -.It monitor -Enables the monitoring facility. -See the -.Ic monlist -command of the -.Xr ntpdc 8 -program -further information. -The default for this flag is enable. -.It ntp -Enables the server to adjust its local clock by means of NTP. -If disabled, -the local clock free-runs at its intrinsic time and frequency offset. -This flag is useful in case the local clock is controlled -by some other device or protocol and NTP is used -only to provide synchronization to other clients. -In this case, -the local clock driver can be used to provide this function -and also certain time variables for error estimates -and leap-indicators. -See the -.Qo -Reference Clock Drivers -.Qc -page -for further information. -The default for this flag is enable. -.It stats -Enables the statistics facility. -See the -.Sx Monitoring Options -section -for further information. -The default for this flag is enable. -.El -.El -.Ss 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) -operating in Cipher Block Chaining (CBC) mode, -commonly called DES-CBC. -Subsequently, this was augmented by the RSA Message Digest 5 (MD5) -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 this scheme and, in addition, -provides a new autokey scheme based on reverse hashing -and public key cryptography. -Authentication can be configured separately for each association -using the key or autokey subcommands on the -.Ic peer Ns , -.Ic server Ns , +.Cm key +or +.Cm autokey +subcommands on the +.Ic peer , +.Ic server , .Ic broadcast and .Ic manycastclient -commands as described in the -.Sx Configuration Options -section. +commands as described in +.Sx Configuration Options . +The authentication +options described below specify the suite of keys, select the key +for each configured association and manage the configuration +operations. .Pp -The authentication options specify the suite of keys, -select the key for each configured association -and manage the configuration operations, -as described below. -The auth flag which controls these functions -can be set or reset by the +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 -configuration commands and also by remote configuration commands -sent by a +configuration commands and also by remote +configuration commands sent by a .Xr ntpdc 8 -program running in another machine. -If this flag is set, persistent peer associations -and remote configuration commands are effective -only if cryptographically authenticated. -If this flag is disabled, -these operations are effective -even if not cryptographic authenticated. -It should be understood that operating in the latter mode -invites a significant vulnerability -where a rogue hacker can seriously disrupt client operations. +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 schemes. +If +this flag is disabled, these operations are effective even if not +cryptographic authenticated. +It should be understood that operating +in the latter mode invites a significant vulnerability where a +rogue hacker can seriously disrupt client timekeeping. .Pp -The auth flag affects all authentication procedures described below; -however, it operates differently -if cryptographic support is compiled in the distribution. -If this support is available and the flag is enabled, -then persistent associations are mobilized -and remote configuration commands are effective -only if successfully authenticated. -If the support is unavailable and the flag is enabled, -then it is not possible under any conditions -to mobilize persistent associations -or respond to remote configuration commands. -The auth flag normally defaults to set -if cryptographic support is available and to reset otherwise. +In networks with firewalls and large numbers of broadcast +clients it may be acceptable to disable authentication, since that +avoids key distribution and simplifies network maintenance. +However, when the configuration file contains host names, or when a +server or client is configured remotely, host names are resolved +using the DNS and a separate name resolution process. +In order to +protect against bogus name server messages, name resolution +messages are authenticated using an internally generated key which +is normally invisible to the user. +However, if cryptographic +support is disabled, the name resolution process will fail. +This +can be avoided either by specifying IP addresses instead of host +names, which is generally inadvisable, or by enabling the flag for +name resolution and disabled it once the name resolution process is +complete. .Pp -With the above vulnerabilities in mind, -it is desirable to set the auth flag in all cases. -One aspect which is often confusing -is the name resolution process -which maps server names in the configuration file to IP addresses. -In order to protect against bogus name server messages, -this process is authenticated -using an internally generated key -which is normally invisible to the user. -However, if cryptographic support is unavailable -and the auth flag is enabled, -the name resolution process will fail. -This can be avoided -either by specifying IP addresses instead of host names, -which is generally inadvisable, -or by leaving the flag disabled -and enabling it once the name resolution process is complete. +An attractive alternative where multicast support is available +is manycast mode, in which clients periodically troll for servers. +Cryptographic authentication in this mode uses public-key schemes +as described below. +The principle advantage of this 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. .Pp -Following is a description -of the two available cryptographic authentication schemes. -.Bl -tag -width indent -.It Private Key Scheme -The original RFC 1305 specification allows any one of possibly -65,536 keys, each distinguished a 32-bit key identifier, -to authenticate an association. -The servers involved must agree on the key -and key identifier to authenticate their messages. -Keys and related information are specified in a key file, -usually called -.Xr ntp.keys 5 -which should be exchanged and stored using secure procedures -beyond the scope of the NTP protocol itself. +In addition to the default symmetric-key cryptographic support, +support for public-key cryptography is available if the requisite +.Sy rsaref20 +software distribution has been installed before +building the distribution. +Public-key cryptography provides secure +authentication of servers without compromising accuracy and +stability. +The security model and protocol schemes for both +symmetric-key and public-key cryptography are described below. +.Ss Symmetric-Key Scheme +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 their messages. +Keys and related information are specified in a key file, usually +called +.Pa ntp.keys , +which should be exchanged and stored +using secure procedures beyond the scope of the NTP protocol +itself. Besides the keys used for ordinary NTP associations, -additional ones can be used as passwords for the +additional keys can be used as passwords for the .Xr ntpq 8 and .Xr ntpdc 8 @@ -544,984 +474,1360 @@ utility programs. .Pp When .Xr ntpd 8 -is first started, -it reads the key file and installs the keys in the key cache. -However, the keys must be activated -before they can be used with the trusted command. -This allows, for instance, -the installation of possibly several batches of keys -and then activating or inactivating each batch remotely using -.Xr ntpdc 8 . -This also provides a revocation capability -that can be used if a key becomes compromised. +is first started, it reads the key file +specified in the +.Ic keys +command and installs the keys in the +key cache. +However, the 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 +.Xr ntpdc 8 . +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 .Xr ntpdc 8 -utility, -while the +utility, while the .Ic controlkey -command selects the key used as the password for the the +command selects the key used +as the password for the .Xr ntpq 8 utility. -.It Autokey Scheme -The original NTPv3 authentication scheme -described in RFC 1305 continues to be supported. -In NTPv4, -an additional authentication scheme called autokey is available. -It operates much like the S-KEY scheme, -in that a session key list is constructed -and the entries used in reverse order. -A description of the scheme, -along with a comprehensive security analysis, -is contained in a technical report -available from the IETF web page -.Li http://www.ietf.org/ . +.Ss Public-Key Scheme +The original NTPv3 authentication scheme described in RFC-1305 +continues to be supported; however, in NTPv4 an additional +authentication scheme called Autokey is available. +It uses MD5 +message digest, RSA public-key signature and Diffie-Hellman key +agreement algorithms available from several sources, but not +included in the NTPv4 software distribution. +In order to be +effective, the +.Sy rsaref20 +package must be installed as +described in the +.Pa README.rsa +file. +Once installed, the +configure and build process automatically detects it and compiles +the routines required. +The Autokey scheme has several modes of +operation corresponding to the various NTP modes supported. +RSA +signatures with timestamps are used in all modes to verify the +source of cryptographic values. +All modes use a special cookie +which can be computed independently by the client and server. +In +symmetric modes the cookie is constructed using the Diffie-Hellman +key agreement algorithm. +In other modes the cookie is constructed +from the IP addresses and a private value known only to the server. +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, in the +.Qq "Autonomous Authentication" +page. +.Pp +The cryptographic values used by the Autokey scheme are +incorporated as a set of files generated by the +.Xr ntp-genkeys 8 +program, including the +symmetric private keys, public/private key pair, and the agreement +parameters. +See the +.Xr ntp.keys 5 +page for a description of +the formats of these files. +They contain cryptographic values +generated by the algorithms of the +.Sy rsaref20 +package and +are in printable ASCII format. +All file names include the +timestamp, in NTP seconds, following the default names given below. +Since the file data are derived from random values seeded by the +system clock and the file name includes the timestamp, every +generation produces a different file and different file name. +.Pp +The +.Pa ntp.keys +file contains the DES/MD5 private keys. +It +must be distributed by secure means to other servers and clients +sharing the same security compartment and made visible only to +root. +While this file is not used with the Autokey scheme, it is +needed to authenticate some remote configuration commands used by +the +.Xr ntpdc 8 , +.Xr ntpq 8 , +.Xr ntpdc 8 +utilities. +The +.Pa ntpkey +file +contains the RSA private key. +It is useful only to the machine that +generated it and never shared with any other daemon or application +program, so must be made visible only to root. +.Pp +The +.Pa ntp_dh +file contains the agreement parameters, +which are used only in symmetric (active and passive) modes. +It is +necessary that both peers beginning a symmetric-mode association +share the same parameters, but it does not matter which +.Pa ntp_dh +file generates them. +If one of the peers contains +the parameters, the other peer obtains them using the Autokey +protocol. +If both peers contain the parameters, the most recent +copy is used by both peers. +If a peer does not have the parameters, +they will be requested by all associations, either configured or +not; but, none of the associations can proceed until one of them +has received the parameters. +Once loaded, the parameters can be +provided on request to other clients and servers. +The +.Pa ntp_dh +file can be also be distributed using insecure +means, since the data are public values. .Pp -The autokey scheme is specifically designed for multicast modes, -where clients normally do not send messages to the server. -In these modes, -the server uses the scheme to generate a key list -by repeated hashing of a secret value. -The list is used in reverse order -to generate a unique session key for each message sent. -The client regenerates the session key -and verifies the hash matches the previous session key. -Each message contains the public values -binding the session key to the secret value, -but these values need to be verified -only when the server generates a new key list -or more than four server messages have been lost. +The +.Pa ntpkey_ Ns Ar host +file contains the RSA public +key, where +.Ar host +is the name of the host. +Each host +must have its own +.Pa ntpkey_ Ns Ar host +file, which is +normally provided to other hosts using the Autokey protocol. +Each +.Ic server +or +.Ic peer +association requires the public +key associated with the particular server or peer to be loaded +either directly from a local file or indirectly from the server +using the Autokey protocol. +These files can be widely distributed +and stored using insecure means, since the data are public +values. .Pp -The scheme is appropriate for client/server -and symmetric-peer modes as well. -In these modes, -the client generates a session key as in multicast modes. -The server regenerates the session key -and uses it to formulates a reply using its own public values. -The client verifies -the key identifier of the reply matches the request, -verifies the public values and validates the message. -In peer mode, each peer independently generates a key list -and operates as in the multicast mode. +The optional +.Pa ntpkey_certif_ Ns Ar host +file contains +the PKI certificate for the host. +This provides a binding between +the host hame and RSA public key. +In the current implementation the +certificate is obtained by a client, if present, but the contents +are ignored. .Pp -The autokey scheme requires no change to the NTP packet header format -or message authentication code (MAC), which is appended to the header; -however, if autokey is in use, an extensions field is inserted -between the header and MAC. -The extensions field contains a random public value -which is updated at intervals specified by the revoke command, -together with related cryptographic values -used in the signing algorithm. -The format of the extensions field is defined in -Internet Draft -.Li draft-NTP-auth-coexist-00.txt . -The MAC itself is constructed in the same way as NTPv3, -but using the original NTP header -and the extensions field padded to a 64-bit boundary. -Each new public value is encrypted by the host private value. -It is the intent of the design, not yet finalized, -that the public value, encrypted public value, -public key and certificate be embedded in the extensions field -where the client can decrypt as needed. -However, the relatively expensive encryption -and decryption operations are necessary -only when the public value is changed. +Due to the widespread use of interface-specific naming, the host +names used in configured and mobilized associations are determined +by the +.Ux +.Xr gethostname 3 +library routine. +Both the +.Xr ntp-genkeys 8 +program and the Autokey protocol derive the +name of the public key file using the name returned by this +routine. +While every server and client is required to load their +own public and private keys, the public keys for each client or +peer association can be obtained from the server or peer using the +Autokey protocol. +Note however, that at the current stage of +development the authenticity of the server or peer and the +cryptographic binding of the server name, address and public key is +not yet established by a certificate authority or web of trust. +.Ss Leapseconds Table +The NIST provides a table showing the epoch for all historic +occasions of leap second insertion since 1972. +The leapsecond table +shows each epoch of insertion along with the offset of +International Atomic Time (TAI) with respect to Coordinated +Universtal Time (UTC), as disseminated by NTP. +The table can be +obtained directly from NIST national time servers using +FTP as the ASCII file +.Pa pub/leap-seconds . .Pp -Note that both the original NTPv3 authentication scheme -and the new NTPv4 autokey scheme -operate separately for each configured association, -so there may be several session key lists -operating independently at the same time. -Since all keys, including session keys, -occupy the same key cache, -provisions have been made to avoid collisions, -where some random roll happens to collide -with another already generated. -Since something like four billion different session key identifiers -are available, -the chances are small that this might happen. -If it happens during generation, -the generator terminates the current session key list. -By the time the next list is generated, -the collided key will probably have been expired or revoked. +While not strictly a security function, the Autokey scheme +provides means to securely retrieve the leapsecond table from a +server or peer. +Servers load the leapsecond table directly from the +file specified in the +.Ic crypto +command, while clients can +load the table indirectly from the servers using the Autokey +protocol. +Once loaded, the table can be provided on request to +other clients and servers. +.Ss Key Management +All key files are installed by default in +.Pa /usr/local/etc , +which is normally in a shared filesystem +in NFS-mounted networks and avoids installing them in each machine +separately. +The default can be overridden by the +.Ic keysdir +configuration command. +However, this is not a good place to install +the private key file, since each machine needs its own file. +A +suitable place to install it is in +.Pa /etc , +which is normally +not in a shared filesystem. .Pp -While permanent keys have lifetimes that expire -only when manually revoked, -random session keys have a lifetime -specified at the time of generation. -When generating a key list for an association, -the lifetime of each key is set to expire -one poll interval later than it is scheduled to be used. -The maximum lifetime of any key in the list -is specified by the -.Ic autokey +The recommended practice is to keep the timestamp extensions +when installing a file and to install a link from the default name +(without the timestamp extension) to the actual file. +This allows +new file generations to be activated simply by changing the link. +However, +.Xr ntpd 8 +parses the link name when present to extract +the extension value and sends it along with the public key and host +name when requested. +This allows clients to verify that the file +and generation time are always current. +However, the actual +location of each file can be overridden by the +.Ic crypto +configuration command. +.Pp +All cryptographic keys and related parameters should be +regenerated on a periodic and automatic basis, like once per month. +The +.Xr ntp-genkeys 8 +program uses the same timestamp extension +for all files generated at one time, so each generation is distinct +and can be readily recognized in monitoring data. +While a +public/private key pair must be generated by every server and +client, the public keys and agreement parameters do not need to be +explicitly copied to all machines in the same security compartment, +since they can be obtained automatically using the Autokey +protocol. +However, it is necessary that all primary servers have +the same agreement parameter file. +The recommended way to do this +is for one of the primary servers to generate that file and then +copy it to the other primary servers in the same compartment using +the +.Ux +.Xr rdist 1 command. -Lifetime enforcement is a backup -to the normal procedure that revokes the last-used key -at the time the next key on the key list is used. -.El -.Ss Authentication Options -The following authentication commands are available: +Future versions of the Autokey +protocol are to contain provisions for an agreement protocol to do +this automatically. +.Pp +Servers and clients can make a new generation in the following +way. +All machines have loaded the old generation at startup and are +operating normally. +At designated intervals, each machine generates +a new public/private key pair and makes links from the default file +names to the new file names. +The +.Xr ntpd 8 +is then restarted +and loads the new generation, with result clients no longer can +authenticate correctly. +The Autokey protocol is designed so that +after a few minutes the clients time out and restart the protocol +from the beginning, with result the new generation is loaded and +operation continues as before. +A similar procedure can be used for +the agreement parameter file, but in this case precautions must be +take to be sure that all machines with this file have the same +copy. +.Ss Authentication Commands .Bl -tag -width indent -.It Ic keys Ar keyfile -Specifies the file name containing the encryption keys and -key identifiers used by -.Xr ntpd 8 , +.It Ic autokey Op Ar logsec +Specifies the interval between regenerations of the session key +list used with the Autokey protocol. +Note that the size of the key +list for each association depends on this interval and the current +poll interval. +The default value is 12 (4096 s or about 1.1 hours). +For poll intervals above the specified interval, a session key list +with a single entry will be regenerated for every message +sent. +.It Ic controlkey Ar key +Specifies the key identifier to use with the .Xr ntpq 8 -and -.Xr ntpdc 8 -when operating in authenticated mode. -The format of this file is described in the -.Xr ntp.keys 5 -page. -.It Xo Ic trustedkey +utility, which uses the standard +protocol defined in RFC-1305. +The .Ar key -.Op ... +argument is +the key identifier for a trusted key, where the value can be in the +range 1 to 65534, inclusive. +.It Xo Ic crypto +.Op Cm flags Ar flags +.Op Cm privatekey Ar file +.Op Cm publickey Ar file +.Op Cm dhparms Ar file +.Op Cm leap Ar file .Xc -Specifies the encryption key identifiers which are trusted -for the purposes of authenticating peers -suitable for synchronization, as well as keys used by the +This command requires the NTP daemon build process be +configured with the RSA library. +This command activates public-key +cryptography and loads the required RSA private and public key +files and the optional Diffie-Hellman agreement parameter file, if +present. +If one or more files are left unspecified, the default +names are used as described below. +Following are the +subcommands: +.Bl -tag -width indent +.It Cm privatekey Ar file +Specifies the location of the RSA private key file, which +otherwise defaults to +.Pa /usr/local/etc/ntpkey . +.It Cm publickey Ar file +Specifies the location of the RSA public key file, which +otherwise defaults to +.Pa /usr/local/etc/ntpkey_ Ns Ar host , +where +.Ar host +is the name of the generating machine. +.It Cm dhparms Ar file +Specifies the location of the Diffie-Hellman parameters file, +which otherwise defaults to +.Pa /usr/local/etc/ntpkey_dh . +.It Cm leap Ar file +Specifies the location of the leapsecond table file, which +otherwise defaults to +.Pa /usr/local/etc/ntpkey_leap . +.El +.It Ic keys Ar keyfile +Specifies the location of the DES/MD5 private key file +containing the keys and key identifiers used by +.Xr ntpd 8 , .Xr ntpq 8 and .Xr ntpdc 8 -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 trustedkey -arguments are 32-bit unsigned integers -with values less than 65,536. -Note that NTP key 0 is used to indicate an invalid key -and/or key identifier, -so should not be used for any other purpose. +when operating in symmetric-key +mode. +.It Ic keysdir Ar path +This command requires the NTP daemon build process be +configured with the RSA library. +It specifies the default directory +path for the private key file, agreement parameters file and one or +more public key files. +The default when this command does not +appear in the configuration file is +.Pa /usr/local/etc . .It Ic requestkey Ar key Specifies the key identifier to use with the .Xr ntpdc 8 -program, -which uses a proprietary protocol -specific to this implementation of -.Xr ntpd 8 . -This program is useful to diagnose and repair problems -that affect -.Xr ntpd 8 -operation. +utility program, which uses a +proprietary protocol specific to this implementation of +.Xr ntpd 8 . The .Ar key -argument to this command is a 32-bit key identifier -for a previously defined trusted key. -If no -.Ic requestkey -command is included in -the configuration file, -or if the keys don't match, -any request to change a server variable with be denied. -.It Ic controlkey Ar key -Specifies the key identifier to use with the +argument is a key identifier +for the trusted key, where the value can be in the range 1 to +65534, 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 .Xr ntpq 8 -program, -which uses the standard protocol defined in RFC 1305. -This program is useful to diagnose and repair problems -that affect -.Xr ntpd 8 -operation. +and +.Xr ntpdc 8 +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 -argument to this command is a 32-bit key identifier -for a trusted key in the key cache. -If no -.Ic controlkey -command is included in the configuration file, -or if the keys don't match, -any request to change a server variable with be denied. +arguments are 32-bit unsigned +integers with values from 1 to 65,534. .El -.Ss Monitoring Support -.Xr ntpd 8 -includes a comprehensive monitoring facility -suitable for continuous, long term recording -of server and client timekeeping performance. +.Sh Monitoring Support +.Xr ntpd 8 +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. +.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 the source distribution. -Using these facilities and Unix -.Xr cron 8 -jobs, -the data can be automatically summarized and archived -for retrospective analysis. -.Ss Monitoring Options -The following monitoring commands are available: +directory of this distribution. +Using +these facilities and +.Ux +.Xr cron 8 +jobs, the data can be +automatically summarized and archived for retrospective analysis. +.Ss Monitoring Commands .Bl -tag -width indent -.It Xo Ic statistics -.Ar name -.Op ... -.Xc +.It Ic statistics Ar name ... Enables writing of statistics records. Currently, four kinds of .Ar name statistics are supported. .Bl -tag -width indent -.It loopstats +.It Cm loopstats Enables recording of loop filter statistics information. -Each update of the local clock outputs -a line of the following form -to the file generation set named loopstats: -.Pp -.Dl 50935 75440.031 0.000006019 13.778190 0.000351733 0.013380 6 +Each +update of the local clock outputs a line of the following form to +the file generation set named loopstats: +.Bd -literal +50935 75440.031 0.000006019 13.778190 0.000351733 0.013380 6 +.Ed .Pp -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. -.It peerstats +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. +.It Cm peerstats Enables recording of peer statistics information. -This includes statistics records of all peers of a NTP server -and of special signals, where present and configured. -Each valid update appends a line of the following form to -the current element of a file generation set named peerstats: -.Pp -.Dl 48773 10847.650 127.127.4.1 9714 -0.001605 0.00000 0.00142 +This includes +statistics records of all peers of a NTP server and of special +signals, where present and configured. +Each valid update appends a +line of the following form to the current element of a file +generation set named peerstats: +.Bd -literal +48773 10847.650 127.127.4.1 9714 -0.001605 0.00000 0.00142 +.Ed .Pp -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 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 three fields show the offset, delay and RMS jitter, -all in seconds. -.It clockstats +The +final three fields show the offset, delay and RMS jitter, all in +seconds. +.It Cm clockstats Enables recording of clock driver statistics information. -Each update received from a clock driver appends a line -of the following form to the file generation set named clockstats: -.Pp -.Dl 49213 525.624 127.127.4.1 93 226 00:08:29.606 D +Each +update received from a clock driver appends a line of the following +form to the file generation set named clockstats: +.Bd -literal +49213 525.624 127.127.4.1 93 226 00:08:29.606 D +.Ed .Pp -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. -.It rawstats +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. +.It Cm rawstats Enables recording of raw-timestamp statistics information. -This includes statistics records of all peers of a NTP server -and of special signals, where present and configured. -Each NTP message received from a peer or clock driver -appends a line of the following form -to the file generation set named rawstats: -.Pp -.Bd -ragged -offset indent -.Li 50928 -.Li 2132.543 -.Li 128.4.1.1 -.Li 128.4.1.20 -.Li 3102453281.584327000 -.Li 3102453281.58622800031 -.Li 02453332.540806000 -.Li 3102453332.541458000 +This +includes statistics records of all peers of a NTP server and of +special signals, where present and configured. +Each NTP message +received from a peer or clock driver appends a line of the +following form to the file generation set named rawstats: +.Bd -literal +50928 2132.543 128.4.1.1 128.4.1.20 3102453281.584327000 3102453281.58622800031 02453332.540806000 3102453332.541458000 .Ed -.Pp -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, +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 timestamp +values are as received and before processing by the various data +smoothing and mitigation algorithms. .El .It Ic 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) filegen filename prefix to be modified -for file generation sets, -which is useful for handling statistics logs. -.It Xo Ic filegen -.Ar name -.Op file Ar filename -.Op type Ar typename -.Op link | nolink -.Op enable | disable +Indicates the full path of a directory where statistics files +should be created (see below). +This keyword allows the (otherwise +constant) +.Ic filegen +filename prefix to be modified for file +generation sets, which is useful for handling statistics logs. +.It Xo Ic filegen Ar name +.Op Cm file Ar filename +.Op Cm type Ar typename +.Op Cm link \&| Cm nolink +.Op Cm enable \&| Cm 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 administrative operations -without the risk of disturbing the operation of -.Xr ntpd 8 . -Most importantly, -they can be removed to free space for new data produced. -.Pp +Configures setting of generation file set +.Ar 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 +.Xr ntpd 8 . +(Most important: they can be removed to +free space for new data produced.) Note that this command can be sent from the -.Xr ntpdc 8 +.Xr ntpdc 8 program running at a remote location. .Bl -tag -width indent -.It name -This is the type of the statistics records, -as shown in the -.Ic statistics +.It Ar name +This is the type of the statistics records, as shown in the +.Ic statistics command. -.It file Ar filename +.It Cm file Ar filename This is the file name for the statistics records. -Filenames of set members are built -from three concatenated elements -prefix, filename and suffix: +Filenames of +set members are built from three concatenated elements +prefix, filename and +suffix: .Bl -tag -width indent .It prefix This is a constant filename path. -It is not subject to modifications via the -.Ic filegen +It is not subject to +modifications via the +.Ic filegen option. -It is defined by the server, -usually specified as a compile-time constant. -It may, however, be configurable for individual file generation sets -via other commands. -For example, the prefix used with loopstats and peerstats generation -can be configured using the -.Ic statsdir +It is defined by the +server, usually specified as a compile-time constant. +It may, +however, be configurable for individual file generation sets via +other commands. +For example, the prefix used with +.Cm loopstats +and +.Cm peerstats +generation can be +configured using the +.Ic statsdir option explained above. -.Ar filename -This string is directly concatenated to the prefix mentioned above -(no intervening -.Qq / -(slash)) . -This can be modified using the -.Ar filename +.It filename +This string is directly concatenated to the prefix mentioned +above (no intervening +.Ql / +(slash)). +This can be modified +using the +.Ar file argument to the -.Ic filegen +.Ic filegen statement. No -.Qq .. -elements are allowed in this component -to prevent filenames referring to parts -outside the filesystem hierarchy denoted by prefix. -.Ic suffix +.Ql \&.. +elements are allowed in this component to prevent +filenames referring to parts outside the filesystem hierarchy +denoted by prefix. +.It suffix This part is reflects individual elements of a file set. -It is generated according to the type of a file set. +It is +generated according to the type of a file set. .El -.It type Ar typename +.It Cm type Ar typename A file generation set is characterized by its type. -The following types are supported: +The +following types are supported: .Bl -tag -width indent .It none The file set is actually a single plain file. .It pid One element of file set is used per incarnation of a -.Xr ntpd 8 +.Xr ntpd 8 server. -This type does not perform any changes -to file set members during runtime, -however it provides an easy way of separating files -belonging to different -.Xr ntpd 8 -server incarnations. +This type does not perform any changes to +file set members during runtime, however it provides an easy way of +separating files belonging to different +.Xr ntpd 8 +server +incarnations. The set member filename is built by appending a -.Qq \&. -(dot) to concatenated prefix and -.Ar filename -strings, -and appending the decimal representation -of the process ID of the -.Xr ntpd 8 +.Ql \&. +(dot) to concatenated prefix and filename +strings, and appending the decimal representation of the process ID +of the +.Xr ntpd 8 server process. .It day One file generation set element is created per day. -A day is defined as the period between 00:00 and 24:00 UTC. -The file set member suffix consists of a -.Qq \&. -(dot) and a day specification in the form YYYYMMdd. -YYYY is a 4-digit year number (e.g. 1992). -MM is a two digit month number. -dd is a two digit day number. -Thus, all information written at 10 December 1992 -would end up in a file named -.Pa <prefix><filename>.19921210 . +A day is +defined as the period between 00:00 and 24:00 UTC. +The file set +member suffix consists of a +.Ql \&. +(dot) and a day +specification in the form +.Ar YYYYMMdd . +.Ar YYYY +is a 4-digit year +number (e.g., 1992). +.Ar MM +is a two digit month number. +.Ar dd +is a two digit day number. +Thus, all information +written at 10 December 1992 would end up in a file named +.Sm off +.Pa Ar prefix / Ar filename / 19921210 . +.Sm on .It week -Any file set member contains data -related to a certain week of a year. -The term week is defined by computing the day of the year modulo 7. -Elements of such a file generation set are distinguished -by appending the following suffix to the file set -.Ar filename -base: -A dot, a 4-digit year number, the letter W, -and a 2-digit week number. -For example, information from January, 10th 1992 -would end up in a file with suffix .1992W1. +Any file set member contains data related to a certain week of +a year. +The term week is defined by computing day-of-year modulo 7. +Elements of such a file generation set are distinguished by +appending the following suffix to the file set filename base: A +dot, a 4-digit year number, the letter +Ql W , +and a 2-digit +week number. +For example, information from January, 10th 1992 would +end up in a file with suffix +.Pa .1992W1 . .It month One generation file set element is generated per month. -The file name suffix consists of a dot, a 4-digit year number, -and a 2-digit month. +The +file name suffix consists of a dot, a 4-digit year number, and a +2-digit month. .It year One generation file element is generated per year. -The filename suffix consists of a dot and a 4 digit year number. +The filename +suffix consists of a dot and a 4 digit year number. .It age -This type of file generation sets changes to a new element -of the file set every 24 hours of server operation. -The filename suffix consists of a dot, the letter a, -and an 8-digit number. -This number is taken to be the number of seconds -the server has been running -at the start of the corresponding 24-hour period. -Information is only written to a file generation -by specifying enable; -output is prevented by specifying disable. -.It 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 link -and disabled using 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 C, -and the pid of the -.Xr ntpd +This type of file generation sets changes to a new element of +the file set every 24 hours of server operation. +The filename +suffix consists of a dot, the letter +.Ql a , +and an 8-digit +number. +This number is taken to be the number of seconds the server +is running at the start of the corresponding 24-hour period. +Information is only written to a file generation by specifying +.Ic enable ; +output is prevented by specifying +.Ic disable . +.El +.It Cm link \&| Cm 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 +.Cm 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 +.Ql C , +and the pid +of the +.Xr ntpd 8 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 enable | disable +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. .El .El -.El -.Ss Access Control Support -.Xr ntpd 8 -implements a general purpose -address-and-mask based restriction list. -The list is sorted by address and by mask, -and the list is searched in this order for matches, -with the last match found -defining the restriction flags associated with the incoming packets. -The source address of incoming packets is used for the match, -with the 32-bit address being AND'ed with the mask -associated with the restriction entry -and then compared with the entry's address -(which has also been AND'ed with the mask) -to look for a match. +.Sh Access Control Support +.Xr ntpd 8 +implements a general purpose address-and-mask based +restriction list. +The list is sorted by address and by mask, and +the list is searched in this order for matches, with the last match +found defining the restriction flags associated with the incoming +packets. +The source address of incoming packets is used for the +match, with the 32- bit address being and'ed with the mask +associated with the restriction entry and then compared with the +entry's address (which has also been and'ed with the mask) to look +for a match. Additional information and examples can be found in the -.Qo -Notes on Configuring NTP and Setting up a NTP Subnet -.Qc +.Qq "Notes on Configuring NTP and Setting up a NTP Subnet" page. .Pp -The restriction facility was implemented -in conformance with the access policies -for the original NSFnet backbone time servers. -While this facility may be otherwise useful -for keeping unwanted or broken remote time servers -from affecting your own, -it should not be considered an alternative -to the standard NTP authentication facility. +The restriction facility was implemented in conformance with the +access policies for the original NSFnet backbone time servers. +While this facility may be otherwise useful for keeping unwanted or +broken remote time servers from affecting your own, it should not +be considered an alternative to the standard NTP authentication +facility. Source address based restrictions are easily circumvented by a determined cracker. -.Ss Access Control Options -The following access control commands are available: +.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 packet. +If the +.Cm kod +flag is set and either service is denied or the client +limit is exceeded, the server it returns the packet and sets the +leap bits unsynchronized, stratum zero and the ASCII string "DENY" +in the reference source identifier field. +If the +.Cm kod +flag +is not set, the server simply drops the packet. +.Pp +A client or peer receiving a kiss-of-death packet performs a set +of sanity checks to minimize security exposure. +If this is the +first packet received from the server, the client assumes an access +denied condition at the server. +It updates the stratum and +reference identifier peer variables and sets the access denied +(test 4) bit in the peer flash variable. +If this bit is set, the +client sends no packets to the server. +If this is not the first +packet, the client assumes a client limit condition at the server, +but does not update the peer variables. +In either case, a message +is sent to the system log. +.Ss Access Control Commands .Bl -tag -width indent -.It Xo Ic restrict -.Ar numeric_address -.Op mask Ar numeric_mask -.Op Ar flag -.Op ... +.It Xo Ic restrict numeric_address +.Op Cm mask Ar numeric_mask +.Op Ar flag ... .Xc The .Ar numeric_address -argument, expressed in dotted-quad form, -is the address of an host or network. +argument, expressed in +dotted- quad form, is the address of an host or network. The -.Ar numeric_mask -argument, also expressed in dotted-quad form, -defaults to 255.255.255.255, -meaning that the +.Cm mask , +also expressed in dotted-quad form, +defaults to 255.255.255.255, meaning that the .Ar numeric_address -is treated as the address of an individual host. -A default entry -(address 0.0.0.0, mask 0.0.0.0) -is always included and, given the sort algorithm, +is treated as the address of an +individual host. +A default entry (address 0.0.0.0, mask +0.0.0.0) is always included and, given the sort algorithm, is always the first entry in the list. Note that, while .Ar numeric_address -is normally given in dotted-quad format, -the text string default, with no mask option, -may be used to indicate the default entry. -.Pp -In the current implementation, flag always restricts access, -i.e. an entry with no flags indicates -that free access to the server is to be given. -The flags are not orthogonal, in that more restrictive flags -will often make less restrictive ones redundant. -The flags can generally be classed into two catagories, -those which restrict time service -and those which restrict informational queries -and attempts to do run-time reconfiguration of the server. -One or more of the following flags may be specified: +is normally given in dotted-quad +format, the text string +.Ql default , +with no mask option, may +be used to indicate the default entry. +In the current implementation, +.Cm flag +always +restricts access, i.e., an entry with no flags indicates that free +access to the server is to be given. +The flags are not orthogonal, +in that more restrictive flags will often make less restrictive +ones redundant. +The flags can generally be classed into two +catagories, those which restrict time service and those which +restrict informational queries and attempts to do run-time +reconfiguration of the server. +One or more of the following flags +may be specified: .Bl -tag -width indent -.It ignore +.It Cm kod +If access is denied, send a kiss-of-death packet. +.It Cm ignore Ignore all packets from hosts which match this entry. -If this flag is specified neither queries -nor time server polls will be responded to. -.It noquery -Ignore all NTP mode 6 and 7 packets -(i.e. information queries and configuration requests) -from the source. -Time service is not affected. -.It nomodify -Ignore all NTP mode 6 and 7 packets -which attempt to modify the state of the server -(i.e. run time reconfiguration). -Queries which return information are permitted. -.It notrap -Decline to provide mode 6 control message trap service -to matching hosts. -The trap service is a subsystem -of the mode 6 control message protocol -which is intended for use by remote event logging programs. -.It lowpriotrap +If this +flag is specified neither queries nor time server polls will be +responded to. +.It Cm noquery +Ignore all NTP mode 6 and 7 packets (i.e. information queries +and configuration requests) from the source. +Time service is not +affected. +.It Cm nomodify +Ignore all NTP mode 6 and 7 packets which attempt to modify the +state of the server (i.e. run time reconfiguration). +Queries which +return information are permitted. +.It Cm notrap +Decline to provide mode 6 control message trap service to +matching hosts. +The trap service is a subsystem of the mode 6 +control message protocol which is intended for use by remote event +logging programs. +.It Cm lowpriotrap Declare traps set by matching hosts to be low priority. -The number of traps a server can maintain is limited -(the current limit is 3). -Traps are usually assigned on a first come, -first served basis, -with later trap requestors being denied service. -This flag modifies the assignment algorithm -by allowing low priority traps to be overridden -by later requests for normal priority traps. -.It noserve +The +number of traps a server can maintain is limited (the current limit +is 3). +Traps are usually assigned on a first come, first served +basis, with later trap requestors being denied service. +This flag +modifies the assignment algorithm by allowing low priority traps to +be overridden by later requests for normal priority traps. +.It Cm noserve Ignore NTP packets whose mode is other than 6 or 7. In effect, -time service is denied, -though queries may still be permitted. -.It nopeer -Provide stateless time service to polling hosts, -but do not allocate peer memory resources to these hosts -even if they otherwise might be considered useful -as future synchronization partners. -.It notrust -Treat these hosts normally in other respects, -but never use them as synchronization sources. -.It limited -These hosts are subject to limitation -of number of clients from the same net. +time service is denied, though queries may still be permitted. +.It Cm nopeer +Provide stateless time service to polling hosts, but do not +allocate peer memory resources to these hosts even if they +otherwise might be considered useful as future synchronization +partners. +.It Cm notrust +Treat these hosts normally in other respects, but never use +them as synchronization sources. +.It Cm limited +These hosts are subject to limitation of number of clients from +the same net. Net in this context refers to the IP notion of net (class A, class B, class C, etc.). Only the first .Va client_limit -hosts (see below) that have shown up at the server -and that have been active during the last +hosts that have shown up at the server and +that have been active during the last .Va client_limit_period -seconds (see below) are accepted. -Requests from other clients from the same net are rejected. +seconds are accepted. +Requests from other clients from the same net +are rejected. Only time request packets are taken into account. Query packets sent by the -.Xr ntpq 8 +.Xr ntpq 8 and -.Xr ntpdc 8 -programs are not subject to these limits. -A history of clients is kept using the monitoring capability of -.Xr ntpd 8 . -Thus, monitoring is always active -as long as there is a restriction entry with the limited flag. -.It ntpport -This is actually a match algorithm modifier, -rather than a restriction flag. -Its presence causes the restriction entry to be matched -only if the source port in the packet -is the standard NTP UDP port (123). -Both ntpport and non-ntpport may be specified. -The ntpport is considered more specific -and is sorted later in the list. +.Xr ntpdc 8 +programs +are not subject to these limits. +A history of clients is kept using +the monitoring capability of +.Xr ntpd 8 . +Thus, monitoring is +always active as long as there is a restriction entry with the +.Cm limited +flag. +.It Cm ntpport +This is actually a match algorithm modifier, rather than a +restriction flag. +Its presence causes the restriction entry to be +matched only if the source port in the packet is the standard NTP +UDP port (123). +Both +.Cm ntpport +and +.Cm non-ntpport +may +be specified. +The +.Cm ntpport +is considered more specific and +is sorted later in the list. +.It Cm version +Ignore these hosts if not the current NTP version. .El .Pp -Default restriction list entries, -with the flags ignore and 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, -unless if it is otherwise unconfigured; -no flags are associated with the default entry -(i.e. everything besides your own NTP server is unrestricted). -.It clientlimit Ar limit +Default restriction list entries, with the flags +.Cm ignore , +.Cm interface , +.Cm 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). +.It Ic clientlimit Ar limit Set the .Va client_limit -variable, -which limits the number of simultaneous access-controlled clients. -The default value for this variable is 3. -.It clientperiod Ar period +variable, which limits the number +of simultaneous access-controlled clients. +The default value for +this variable is 3. +.It Ic clientperiod Ar period Set the .Va client_limit_period -variable, -which specifies the number of seconds -after which a client is considered inactive +variable, which specifies +the number of seconds after which a client is considered inactive and thus no longer is counted for client limit restriction. -The default value for this variable is 3600 seconds. +The +default value for this variable is 3600 seconds. .El -.Ss Reference Clock Support -The NTP Version 4 daemon supports many 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 -.Qo -Reference Clock Drivers -.Qc -page. -Additional information can be found in the pages referenced there, -including the -.Qo -Debugging Hints for Reference Clock Drivers -.Qc +.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 -.Qo -How To Write a Reference Clock Driver -.Qc +.Qq "How To Write a Reference Clock Driver" pages. -In many drivers, -support for a PPS signal is available as described in the -.Qo -Pulse-per-second (PPS) Signal Interfacing -.Qc +In addition, support for a PPS +signal is available as described in the +.Qq "Pulse-per-second (PPS) Signal Interfacing" page. -Many drivers support special line discipline/streams modules -which can significantly improve the accuracy using the driver. -These are described in the -.Qo -Line Disciplines and Streams Drivers -.Qc +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. .Pp -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 United States. -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 included -or the hardware port has not been appropriately configured -results in a scalding remark to the system log file, -but is not otherwise hazardous. +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. .Pp For the purposes of configuration, .Xr ntpd 8 -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 127.127.t.u, +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 +is an integer +denoting the clock type and .Ar u -indicates the unit number. -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. +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. .Pp The .Ic server -command is used to configure a reference clock, -where the address argument in that command is the clock address. -The key, -version and ttl options are not used for reference clock support. -The mode option is added for reference clock support, -as described below. -The 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 -.Qo -Mitigation Rules and the prefer Keyword -.Qc +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" page. -The minpoll and maxpoll options have meaning -only for selected clock drivers. -See the individual clock driver document pages -for additional information. +The +.Cm minpoll +and +.Cm maxpoll +options have +meaning only for selected clock drivers. +See the individual clock +driver document pages for additional information. +.Pp +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 control 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. .Pp The stratum number of a reference clock is by default zero. Since the .Xr ntpd 8 -daemon adds one to the stratum of each peer, -a primary server ordinarily displays stratum one. -In order to provide engineered backups, -it is often useful to specify the reference clock stratum -as greater than zero. -The 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 refid option is used for this purpose. +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 Options +.Ss Reference Clock Commands .Bl -tag -width indent -.It Xo Ic server No 127.127. Ns -.Ar t . Ns Ar u -.Op prefer -.Op mode Ar int -.Op minpoll Ar int -.Op maxpoll Ar int +.It Xo Ic server +.Sm off +.Li 127.127. Ar t . Ar u +.Sm on +.Op Cm prefer +.Op Cm mode Ar int +.Op Cm minpoll Ar int +.Op Cm maxpoll Ar int .Xc -This command can be used to configure reference clocks -in special ways. +This command can be used to configure reference clocks in +special ways. The options are interpreted as follows: .Bl -tag -width indent -.It prefer +.It Cm prefer Marks the reference clock as preferred. -All other things being equal, -this host will be chosen for synchronization -among a set of correctly operating hosts. +All other things being +equal, this host will be chosen for synchronization among a set of +correctly operating hosts. See the -.Qo -Mitigation Rules and the prefer Keyword -.Qc -page -for further information. -.It mode Ar int -Specifies a mode number -which is interpreted in a device-specific fashion. -For instance, it selects a dialing protocol in the ACTS driver -and a device subtype in the parse drivers. -.It minpoll Ar int -.It maxpoll Ar int +.Qq "Mitigation Rules and the prefer Keyword" +page for further +information. +.It Cm mode Ar int +Specifies a mode number which is interpreted in a +device-specific fashion. +For instance, it selects a dialing +protocol in the ACTS driver and a device subtype in the +parse +drivers. +.It Cm minpoll Ar int +.It Cm maxpoll Ar int These options specify the minimum and maximum polling interval for reference clock messages, in seconds to the power of two. -For most directly connected reference clocks, -both minpoll and maxpoll default to 6 (64 s). +For +most directly connected reference clocks, both +.Cm minpoll +and +.Cm maxpoll +default to 6 (64 s). For modem reference clocks, -minpoll defaults to 10 (17.1 m) -and maxpoll defaults to 14 (4.5 h). +.Cm minpoll +defaults to 10 (17.1 m) and +.Cm maxpoll +defaults to 14 (4.5 h). The allowable range is 4 (16 s) to 17 (36.4 h) inclusive. .El -.It Xo Ic fudge No 127.127. Ns -.Ar t . Ns Ar u -.Op time1 Ar sec -.Op time2 Ar sec -.Op stratum Ar int -.Op refid Ar string -.Op mode Ar int -.Op flag1 Ar 0 Ns | Ns Ar 1 -.Op flag2 Ar 0 Ns | Ns Ar 1 -.Op flag3 Ar 0 Ns | Ns Ar 1 -.Op flag4 Ar 0 Ns | Ns Ar 1 +.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 \&| Cm 1 +.Op Cm flag2 Cm 0 \&| Cm 1 +.Op Cm flag3 Cm 0 \&| Cm 1 +.Op Cm flag4 Cm 0 \&| Cm 1 .Xc -This command can be used to configure reference clocks -in special ways. +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 +Note that the same capability +is possible at run time using the .Xr ntpdc 8 program. -The options are interpreted as follows: +The options are interpreted as +follows: .Bl -tag -width indent -.It time1 Ar sec -Specifies a constant to be added to the time offset produced -by the driver, a fixed-point decimal number in seconds. -This is used as a calibration constant -to adjust the nominal time offset of a particular clock -to agree with an external standard, -such as a precision PPS signal. -It also provides a way to correct a systematic error -or bias due to serial port latencies, -different cable lengths or receiver internal delay. -The specified offset is in addition to the propagation delay -provided by other means, such as internal DIPswitches. -Where a calibration for an individual system -and driver is available, -an approximate correction is noted -in the driver documentation pages. -.It time2 Ar secs -Specifies a fixed-point decimal number in seconds, -which is interpreted in a driver-dependent way. -See the descriptions of specific drivers in the -.Qo -Reference Clock Drivers -.Qc +.It Cm time1 Ar sec +Specifies a constant to be added to the time offset produced by +the driver, a fixed-point decimal number in seconds. +This is used +as a calibration constant to adjust the nominal time offset of a +particular clock to agree with an external standard, such as a +precision PPS signal. +It also provides a way to correct a +systematic error or bias due to serial port or operating system +latencies, different cable lengths or receiver internal delay. +The +specified offset is in addition to the propagation delay provided +by other means, such as internal DIPswitches. +Where a calibration +for an individual system and driver is available, an approximate +correction is noted in the driver documentation pages. +Note: in order to facilitate calibration when more than one +radio clock or PPS signal is supported, a special calibration +feature is available. +It takes the form of an argument to the +.Ic enable +command described in +.Sx Miscellaneous Options +page and operates as described in the +.Qq "Reference Clock Drivers" +page. +.It Cm time2 Ar secs +Specifies a fixed-point decimal number in seconds, which is +interpreted in a driver-dependent way. +See the descriptions of +specific drivers in the +.Qq "reference clock drivers" page. -.It stratum Ar int -Specifies the stratum number assigned to the driver, -an integer between 0 and 15. +.It Cm stratum Ar int +Specifies the stratum number assigned to the driver, an integer +between 0 and 15. This number overrides the default stratum number ordinarily assigned by the driver itself, usually zero. -.It refid Ar string -Specifies an ASCII string from one to four characters -which defines the reference identifier used by the driver. -This string overrides the default identifier -ordinarily assigned by the driver itself. -.It mode Ar int -Specifies a mode number which is interpreted -in a device-specific fashion. -For instance, -it selects a dialing protocol in the ACTS driver -and a device subtype in the parse drivers. -.It flag1 flag2 flag3 flag4 +.It Cm refid Ar string +Specifies an ASCII string of from one to four characters which +defines the reference identifier used by the driver. +This string +overrides the default identifier ordinarily assigned by the driver +itself. +.It Cm mode Ar int +Specifies a mode number which is interpreted in a +device-specific fashion. +For instance, it selects a dialing +protocol in the ACTS driver and a device subtype in the +parse +drivers. +.It Cm flag1 Cm 0 \&| Cm 1 +.It Cm flag2 Cm 0 \&| Cm 1 +.It Cm flag3 Cm 0 \&| Cm 1 +.It Cm flag4 Cm 0 \&| Cm 1 These four flags are used for customizing the clock driver. -The interpretation of these values, -and whether they are used at all, +The +interpretation of these values, and whether they are used at all, is a function of the particular clock driver. -However, by convention -flag4 is used to enable recording monitoring data -to the clockstats file configured with the +However, by +convention +.Cm flag4 +is used to enable recording monitoring +data to the +.Cm clockstats +file configured with the .Ic filegen command. -When a PPS signal is available, -a special automatic calibration facility is provided. -If the flag1 switch is set -and the PPS signal is actively disciplining the system time, -the calibration value is automatically adjusted -to maintain a residual offset of zero. Further information on the .Ic filegen -command can be found in the -.Sx Monitoring Options -section. +command can be found in +.Sx Monitoring Options . .El -.It Ic pps device [assert|clear] [hardpps] -Specifies the name and options for the serial port device -to which the PPS signal is connected. -Note, this command replaces use of fudge flag3, -which was used for the same purpose in NTPv3. -Note that this command should precede the -.Ic server -and -.Ic fudge -commands for the same device. -Note also that the assert, -clear and hardpps options are only available -if the ppsapi standard PPS interface is available. -.Bl -tag -width indent -.It device -Specify the device name associated with the PPS signal. -The name must match exactly the link name specified -in the driver documentation page. -.It assert -.It clear -Using assert or clear specifies -if the high going or low going edge -of the signal must be used. -The default is assert. -.It hardpps -This flag is used to tell the kernel that the signal -from this device must be used to drive hardpps(). -The assert, clear and hardpps options are only available -if the PPSAPI is used. .El -.El -.Ss Miscellaneous Options -The following miscellaneous configuration options are available: +.Sh Miscellaneous Options .Bl -tag -width indent .It Ic broadcastdelay Ar seconds The broadcast and multicast modes require a special calibration to determine the network delay between the local and remote servers. -Ordinarily, this is done automatically -by the initial protocol exchanges -between the local and remote servers. -In some cases, the calibration procedure may fail -due to network or server access controls, for example. -This command specifies -the default delay to be used under these circumstances. -Typically (for Ethernet), -a number between 0.003 and 0.007 seconds is appropriate. -The default when this command is not used is 0.004 seconds. -.It Xo Ic trap -.Ar host_address -.Op port Ar port_number -.Op interface Ar interface_address +Ordinarily, this is done automatically by the initial +protocol exchanges between the client and server. +In some cases, +the calibration procedure may fail due to network or server access +controls, for example. +This command specifies the default delay to +be used under these circumstances. +Typically (for Ethernet), a +number between 0.003 and 0.007 seconds is appropriate. +The default +when this command is not used is 0.004 seconds. +.It Ic driftfile Ar driftfile +This command specifies the name of the file used to record the +frequency offset of the local clock oscillator. +If the file exists, +it is read at startup in order to set the initial frequency offset +and then updated once per hour with the current frequency offset +computed by the daemon. +If the file does not exist or this command +is not given, the initial frequency offset is assumed zero. +In this +case, it may take some hours for the frequency to stabilize and the +residual timing errors to subside. +.Pp +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 +.Xr ntpd 8 +must have write permission for the directory the +drift file is located in, and that file system links, symbolic or +otherwise, should be avoided. +.It Xo Ic enable +.Oo +.Cm auth | Cm bclient | +.Cm calibrate | Cm kernel | +.Cm monitor | Cm ntp | +.Cm stats +.Oc .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 Ic setvar Ar variable Op 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 -.Va name -= -.Ar value -is followed by the default keyword, -the variable will be listed -as part of the default system variables -(see the -.Xr ntpq 8 -.Ic rv -command). -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 variables of the same group. -The -.Va sys_var_list -holds the names of all system variables. +.It Xo Ic disable +.Oo +.Cm auth | Cm bclient | +.Cm calibrate | Cm kernel | +.Cm monitor | Cm ntp | +.Cm stats +.Oc +.Xc +Provides a way to enable or disable various server options. +Flags not mentioned are unaffected. +Note that all of these flags +can be controlled remotely using the +.Xr ntpdc 8 +utility program. +.Bl -tag -width indent +.It Cm bclient +When enabled, this is identical to the +.Ic broadcastclient +command. +The default for this flag is +.Ic disable . +.It Cm calibrate +Enables the calibration facility, which automatically adjusts +the +.Ic time1 +values for each clock driver to display the same +offset as the currently selected source or kernel discipline +signal. +See the +.Qq "Reference Clock Drivers" +page +for further information. +The default for this flag is +.Ic disable . +.It Cm kernel +Enables the precision-time kernel support for the +.Xr adjtime 2 +system call, if implemented. +Ordinarily, +support for this routine is detected automatically when the NTP +daemon is compiled, so it is not necessary for the user to worry +about this flag. +It flag is provided primarily so that this support +can be disabled during kernel development. +The default for this +flag is +.Ic enable . +.It Cm monitor +Enables the monitoring facility. +See the +.Xr ntpdc 8 +program +and the +.Ic monlist +command or further information. 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 Ic logfile Ar logfile -This command specifies the location of an alternate log file -to be used instead of the default system -.Xr syslog 3 -facility. +default for this flag is +.Ic enable . +.It Cm ntp +Enables the server to adjust its local clock by means of NTP. +If disabled, the local clock free-runs at its intrinsic time and +frequency offset. +This flag is useful in case the local clock is +controlled by some other device or protocol and NTP is used only to +provide synchronization to other clients. +In this case, the local +clock driver can be used to provide this function and also certain +time variables for error estimates and leap-indicators. +See the +.Qq "Reference Clock Drivers" +page for further +information. +The default for this flag is +.Ic enable . +.It Cm stats +Enables the statistics facility. +See the +.Qq "Monitoring Options" +page for further information. +The default for this flag is +.Ic enable . +.El .It Ic logconfig Ar configkeyword -This command controls the amount and type of output -written to the system +This command controls the amount and type of output written to +the system .Xr syslog 3 facility or the alternate .Ic logfile @@ -1529,49 +1835,232 @@ log file. By default, all output is turned on. All .Ar configkeyword -keywords can be prefixed with =, + and -, -where = sets the syslogmask, -+ adds and - removes messages. +keywords can be prefixed with +.Ql = , +.Ql + +and +.Ql - , +where +.Ql = +sets the +.Xr syslog 3 +priority mask, +.Ql + +adds and +.Ql - +removes +messages. .Xr syslog 3 -messages can be controlled -in four classes (clock, peer, sys and sync). -Within these classes -four types of messages can be controlled. -Informational messages (info) control configuration information. -Event messages (events) control logging of events -(reachability, synchronization, alarm conditions). +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 +.Pq Cm info +control configuration +information. +Event messages +.Pq Cm events +control logging of +events (reachability, synchronization, alarm conditions). Statistical output is controlled with the -.Ic statistics +.Cm statistics keyword. The final message group is the status messages. -This describes mainly the synchronizations status. -.Pp -Configuration keywords are formed -by concatenating the message class with the event class. -The all prefix can be used instead of a message class. -A message class may also be followed by the all keyword -to enable/disable all messages of the respective message class. +This +describes mainly the synchronizations status. +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: -.Pp -.Dl logconfig = syncstatus +sysevents +.Bd -literal +logconfig=syncstatus +sysevents +.Ed .Pp This would just list the synchronizations state of .Xr ntpd 8 and the major system events. -For a simple reference server, -the following minimum message configuration could be useful: +For a simple reference server, the +following minimum message configuration could be useful: +.Bd -literal +logconfig=syncall +clockall +.Ed .Pp -.Dl logconfig = syncall +clockall +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 +.Xr syslog 3 +facility. +.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 +.Xr ntpq 8 +.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 step Ar step | +.Cm panic Ar panic | +.Cm dispersion Ar dispersion | +.Cm stepout Ar stepout | +.Cm minpoll Ar minpoll | +.Cm allan Ar allan | +.Cm huffpuff Ar huffpuff +.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 can't 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. .Pp -This configuration will list all clock information -and synchronization information. -All other events and messages about peers, -system events and so on is suppressed. +All arguments are in floating point seconds or seconds per +second. +The +.Ar minpoll +argument is an integer in seconds to +the power of two. +The variables operate as follows: +.Bl -tag -width indent +.It Cm step Ar step +The argument becomes the new value for the step threshold, +normally 0.128 s. +If set to zero, step adjustments will never +occur. +In general, if the intent is only to avoid step adjustments, +the step threshold should be left alone and the +.Fl x +command +line option be used instead. +.It Cm panic Ar panic +The argument becomes the new value for the panic threshold, +normally 1000 s. +If set to zero, the panic sanity check is disabled +and a clock offset of any value will be accepted. +.It Cm dispersion Ar dispersion +The argument becomes the new value for the dispersion increase +rate, normally .000015. +.It Cm stepout Ar stepout +The argument becomes the new value for the watchdog timeout, +normally 900 s. +.It Cm minpoll Ar minpoll +The argument becomes the new value for the minimum poll +interval used when configuring multicast client, manycast client +and , symmetric passive mode association. +The value defaults to 6 +(64 s) and has a lower limit of 4 (16 s). +.It Cm allan Ar allan +The argument becomes the new value for the minimum Allan +intercept, which is a parameter of the PLL/FLL clock discipline +algorithm. +The value defaults to 1024 s, which is also the lower +limit. +.It Cm huffpuff Ar huffpuff +The argument becomes the new value for the experimental +huff-n'-puff filter span, which determines the most recent interval +the algorithm will search for a minimum delay. +The lower limit is +900 s (15 m), but a more reasonable value is 7200 (2 hours). +There +is no default, since the filter is not enabled unless this command +is given. +.El +.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. +.Pp +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. .El .Sh FILES .Bl -tag -width /etc/ntp.drift -compact .It Pa /etc/ntp.conf the default name of the configuration file +.It Pa ntp.keys +private MD5 keys +.It Pa ntpkey +RSA private key +.It Pa ntpkey_ Ns Ar host +RSA public key +.It Pa ntp_dh +Diffie-Hellman agreement parameters .El .Sh SEE ALSO .Xr ntpd 8 , @@ -1589,15 +2078,14 @@ A snapshot of this documentation is available in HTML format in .%T Network Time Protocol (Version 3) .%O RFC1305 .Re -.Sh HISTORY -Written by -.An David Mills -at the University of Delaware. .Sh BUGS -.Xr ntpd 8 -has gotten rather fat. -While not huge, it has gotten larger than might -be desireable for an elevated-priority daemon running on a workstation, -particularly since many of the fancy features which consume the space -were designed more with a busy primary server, rather than a high -stratum workstation, in mind. +The syntax checking is not picky; some combinations of +ridiculous and even hilarious options and modes may not be +detected. +.Pp +The +.Pa ntpkey_ Ns Ar host +files are really digital +certificates. +These should be obtained via secure directory +services when they become universally available. diff --git a/usr.sbin/ntp/doc/ntp.keys.5 b/usr.sbin/ntp/doc/ntp.keys.5 index 897bd19..e870c50 100644 --- a/usr.sbin/ntp/doc/ntp.keys.5 +++ b/usr.sbin/ntp/doc/ntp.keys.5 @@ -35,8 +35,9 @@ may be arbitrarily set in the keys file. The key file uses the same comment conventions as the configuration file. Key entries use a fixed format of the form -.Pp -.Dl keyno type key +.Bd -ragged -offset indent +.Ar keyno Ar type Ar key +.Ed .Pp where .Ar keyno @@ -53,51 +54,41 @@ may be given in one of three different formats, controlled by the .Ar type character. -The three key types, and corresponding formats, +The four key types, and corresponding formats, are listed following. -.Bl -tag -width indent -.It S -The -.Ar key -is a 64-bit hexadecimal number in the format +.Bl -tag -width X +.It Li S +The key is a 64-bit hexadecimal number in the format specified in the DES specification; that is, the high order seven bits of each octet are used to form the 56-bit key while the low order bit of each octet is given a value such that odd parity is maintained for the octet. Leading zeroes must be specified -(i.e. the key must be exactly 16 hex digits long) +(i.e., the key must be exactly 16 hex digits long) and odd parity must be maintained. -Hence a zero -.Ar key , -in standard format, would be given as -.Li 0101010101010101 . -.It N -The -.Ar key -is a 64-bit hexadecimal number in the format +Hence a zero key, in standard format, would be given as +.Ql 0101010101010101 . +.It Li N +The key is a 64-bit hexadecimal number in the format specified in the NTP standard. This is the same as the DES format, except the bits in each octet have been rotated one bit right so that the parity bit is now the high order bit of the octet. Leading zeroes must be specified and odd parity must be maintained. -A zero -.Ar key -in NTP format would be specified as -.Li 8080808080808080 . -.It A -The -.Ar key -is a 1-to-8 character ASCII string. +A zero key in NTP format would be specified as +.Ql 8080808080808080 . +.It Li A +The key is a 1-to-8 character ASCII string. A key is formed from this by using the low order 7 bits of each ASCII character in the string, with zeroes added on the right when necessary to form a full width 56-bit key, -in the same way that encryption keys are formed from Unix passwords. -.It M -The -.Ar key -is a 1-to-8 character ASCII string, +in the same way that encryption keys are formed from +.Ux +passwords. +.It Li M +The key is a 1-to-8 character ASCII string, using the MD5 authentication scheme. Note that both the keys and the authentication schemes (DES or MD5) must be identical between a set of peers sharing the same key number. @@ -120,10 +111,6 @@ the default name of the configuration file .Xr ntpd 8 , .Xr ntpdate 8 , .Xr ntpdc 8 -.Sh HISTORY -Written by -.An David Mills -at the University of Delaware. .Sh BUGS .Xr ntpd 8 has gotten rather fat. diff --git a/usr.sbin/ntp/doc/ntpd.8 b/usr.sbin/ntp/doc/ntpd.8 index cef5366..8fe9dda 100644 --- a/usr.sbin/ntp/doc/ntpd.8 +++ b/usr.sbin/ntp/doc/ntpd.8 @@ -1,7 +1,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 10, 2000 +.Dd August 2, 2001 .Dt NTPD 8 .Os .Sh NAME @@ -9,94 +9,88 @@ .Nd Network Time Protocol (NTP) daemon .Sh SYNOPSIS .Nm -.Op Fl aAbdgmx +.Op Fl aAbdgLmnPqx .Op Fl c Ar conffile +.Op Fl D Ar level .Op Fl f Ar driftfile .Op Fl k Ar keyfile .Op Fl l Ar logfile +.Op Fl N Cm high .Op Fl p Ar pidfile .Op Fl r Ar broadcastdelay .Op Fl s Ar statsdir -.Op Fl t Ar trustedkey +.Op Fl t Ar key .Op Fl v Ar variable .Op Fl V Ar variable .Sh DESCRIPTION +The .Nm -is an operating system daemon -which sets and maintains the system time-of-day -in synchronism with Internet standard time servers. -.Nm -is a complete implementation of the Network Time Protocol (NTP) -version 4, -but also retains compatibility with version 3, -as defined by RFC 1305, -and version 1 and 2, -as defined by RFC 1059 and RFC 1119, -respectively. -.Nm -does most computations in 64-bit floating point arithmetic -and does relatively clumsy 64-bit fixed point operations -only when necessary to preserve the ultimate precision, -about 232 picoseconds. -While the ultimate precision is not achievable -with ordinary workstations and networks of today, -it may be required with future nanosecond CPU clocks and gigabit LANs. -.Pp -The daemon can operate in any of several modes, -including symmetric active/passive, -client/server broadcast/multicast and manycast. -A broadcast/multicast or manycast client can discover remote servers, -compute server-client propagation delay correction factors -and configure itself automatically. -This makes it possible to deploy a fleet of workstations -without specifying configuration details -specific to the local environment. +program is an operating system daemon which sets +and maintains the system time of day in synchronism with Internet +standard time servers. +It is a complete implementation of the +Network Time Protocol (NTP) version 4, but also retains +compatibility with version 3, as defined by RFC-1305, and version 1 +and 2, as defined by RFC-1059 and RFC-1119, respectively. +.Pp +.Nm +does most computations in 64-bit floating point +arithmetic and does relatively clumsy 64-bit fixed point operations +only when necessary to preserve the ultimate precision, about 232 +picoseconds. +While the ultimate precision, is not achievable with +ordinary workstations and networks of today, it may be required +with future gigahertz CPU clocks and gigabit LANs. .Pp Ordinarily, .Nm reads the .Xr ntp.conf 5 -configuration file at startup time -in order to determine the synchronization sources and operating modes. -It is also possible to specify a working, although limited, -configuration entirely on the command line, -obviating the need for a configuration file. -This may be particularly appropriate -when the local host is to be configured -as a broadcast/multicast client or manycast client, -with all peers being determined -by listening to broadcasts at run time. +configuration file at startup time in order to determine the +synchronization sources and operating modes. +It is also possible to +specify a working, although limited, configuration entirely on the +command line, obviating the need for a configuration file. +This may +be particularly useful when the local host is to be configured as a +broadcast/multicast client, with all peers being determined by +listening to broadcasts at run time. .Pp If NetInfo support is built into .Nm , then .Nm -will attempt to read its configuration from the NetInfo -if the default configuration file cannot be read -and no file is specified by the +will attempt to read its configuration from the +NetInfo if the default +.Xr ntp.conf 5 +file cannot be read and no file is +specified by the .Fl c option. .Pp -Various -internal +Various internal .Nm -variables can be displayed and configuration options altered -while the daemon is running -through use of the +variables can be displayed and +configuration options altered while the +.Nm +is running +using the .Xr ntpq 8 and .Xr ntpdc 8 -programs. +utility programs. .Pp When .Nm starts it looks at the value of -.Xr umask 2 -and if it is zero, +.Xr umask 2 , +and if zero .Nm -will set it to 022. +will set the +.Xr umask 2 +to 022. .Pp -The following command line options are available: +The following options are available: .Bl -tag -width indent .It Fl a Enable authentication mode (default). @@ -106,6 +100,8 @@ Disable authentication mode. Synchronize using NTP broadcast messages. .It Fl c Ar conffile Specify the name and path of the configuration file. +(Disable +netinfo?) .It Fl d Specify debugging mode. This flag may occur multiple times, @@ -115,33 +111,69 @@ Specify debugging level directly. .It Fl f Ar driftfile Specify the name and path of the drift file. .It Fl g -Normally, the daemon exits -if the offset exceeds a 1000 s sanity limit. -This option overrides this limit -and allows the time to be set to any value without restriction; -however, this can happen only once. +Normally, +.Nm +exits if the offset exceeds the sanity +limit, which is 1000 s by default. +If the sanity limit is set to +zero, no sanity checking is performed and any offset is acceptable. +This option overrides the limit and allows the time to be set to +any value without restriction; however, this can happen only once. After that, -the daemon will exit if the limit is exceeded. +.Nm +will exit if the limit is exceeded. +This +option can be used with the +.Fl q +option. .It Fl k Ar keyfile -Specify the name and path of the file -containing the NTP authentication keys. +Specify the name and path of the file containing the NTP +authentication keys. .It Fl l Ar logfile Specify the name and path of the log file. -The default is the system log facility. +The default is the +system log facility. +.It Fl L +Listen to virtual IPs. .It Fl m -Synchronize using NTP multicast messages -on the IP multicast group address 224.0.1.1 -(requires multicast kernel). +Synchronize using NTP multicast messages on the IP multicast +group address 224.0.1.1 (requires multicast kernel). +.It Fl n +Don't fork. +.It Fl N Ar priority +To the extent permitted by the operating system, run the +.Nm +at a high priority. .It Fl p Ar pidfile -Specify the name and path to record the daemon's process ID. +Specify the name and path to record the +.Nm Ns 's +process +ID. .It Fl P Override the priority limit set by the operating system. -Not recommended for sissies. +Not +recommended for sissies. +.It Fl q +Exit the +.Nm +just after the first time the clock is +set. +This behavior mimics that of the +.Xr ntpdate 8 +program, +which is to be retired. +The +.Fl g +and +.Fl x +options can +be used with this option. .It Fl r Ar broadcastdelay -Specify the default propagation delay -between the broadcast/multicast server and this computer. +Specify the default propagation delay from the +broadcast/multicast server and this computer. This is necessary -only if the delay cannot be computed automatically by the protocol. +only if the delay cannot be computed automatically by the +protocol. .It Fl s Ar statsdir Specify the directory path for files created by the statistics facility. @@ -151,53 +183,360 @@ Add a key number to the trusted key list. .It Fl V Ar variable Add a system variable listed by default. .It Fl x -Ordinarily, if the time is to be adjusted more than 128 ms, -it is stepped, not gradually slewed. -This option forces the time to be slewed in all cases. -Note: since the slew rate is limited to 0.5 ms/s, -each second of adjustment requires an amortization interval of 2000 s. -Thus, an adjustment of many seconds can take hours or days to amortize. -.El -.Ss Variables -Most variables used by the NTP protocol -can be examined with -.Xr ntpdc 8 -(mode 7 messages) and -.Xr ntpq 8 -(mode 6 messages). -Currently, very few variables can be modified via mode 6 messages. -These variables are either created with the -.Ic setvar -directive -(described in the -.Qq Miscellaneous Options -section of the -.Xr ntp.conf 5 -page) -or the leap warning bits. -The leap warning bits can be set in the -.Va leapwarning -variable up to one month ahead. -Both the -.Va leapwarning -and -.Va leapindication -variables have a slightly different encoding -than the usual leap bits interpretation: -.Pp -.Bl -tag -width indent -compact -.It 00 -The daemon passes the leap bits of its synchronization source -(usual mode of operation). -.It 01 -.It 10 -A leap second is added/deleted (operator forced leap second). -.It 11 -Leap information from the synchronizations source is ignored -(thus -.Dv LEAP_NOWARNING -is passed on). +Normally, the time is slewed if the offset is less than the +step threshold, which is 128 ms by default, and stepped if above +the threshold. +This option forces the time to be slewed in all +cases. +If the step threshold is set to zero, all offsets are +stepped, regardless of value and regardless of the +.Fl x +option. +In general, this is not a good idea, as it bypasses the +clock state machine which is designed to cope with large time and +frequency errors Note: Since the slew rate is limited to 0.5 ms/s, +each second of adjustment requires an amortization interval of 2000 +s. +Thus, an adjustment of many seconds can take hours or days to +amortize. +This option can be used with the +.Fl q +option. .El +.Ss "How NTP Operates" +The +.Nm +program operates by exchanging messages with +one or more configured servers at designated poll intervals. +When +started, whether for the first or subsequent times, the program +requires several exahanges from the majority of these servers so +the signal processing and mitigation algorithms can accumulate and +groom the data and set the clock. +In order to protect the network +from bursts, the initial poll interval for each server is delayed +an interval randomized over 0-16s. +At the default initial poll +interval of 64s, several minutes can elapse before the clock is +set. +The initial delay to set the clock can be reduced using the +.Cm iburst +keyword with the +.Ic server +configuration +command, as described in +.Xr ntp.conf 5 . +.Pp +Most operating systems and hardware of today incorporate a +time-of-year (TOY) chip to maintain the time during periods when +the power is off. +When the machine is booted, the chip is used to +initialize the operating system time. +After the machine has +synchronized to a NTP server, the operating system corrects the +chip from time to time. +In case there is no TOY chip or for some +reason its time is more than 1000s from the server time, +.Nm +assumes something must be terribly wrong and the only +reliable action is for the operator to intervene and set the clock +by hand. +This causes +.Nm +to exit with a panic message to +the system log. +The +.Fl g +option overrides this check and the +clock will be set to the server time regardless of the chip time. +However, and to protect against broken hardware, such as when the +CMOS battery fails or the clock counter becomes defective, once the +clock has been set, an error greater than 1000s will cause +.Nm +to exit anyway. +.Pp +Under ordinariy conditions, +.Nm +adjusts the clock in +small steps so that the timescale is effectively continuous and +without discontinuities. +Under conditions of extreme network +congestion, the roundtrip delay jitter can exceed three seconds and +the synchronization distance, which is equal to one-half the +roundtrip delay plus error budget terms, can become very large. +The +.Nm +algorithms discard sample offsets exceeding 128 ms, +unless the interval during which no sample offset is less than 128 +ms exceeds 900s. +The first sample after that, no matter what the +offset, steps the clock to the indicated time. +In practice this +reduces the false alarm rate where the clock is stepped in error to +a vanishingly low incidence. +.Pp +As the result of this behavior, once the clock has been set, it +very rarely strays more than 128 ms, even under extreme cases of +network path congestion and jitter. +Sometimes, in particular when +.Nm +is first started, the error might exceed 128 ms. +This +may on occasion cause the clock to be set backwards if the local +clock time is more than 128 s in the future relative to the server. +In some applications, this behavior may be unacceptable. +If the +.Fl x +option is included on the command line, the clock will +never be stepped and only slew corrections will be used. +.Pp +The issues should be carefully explored before deciding to use +the +.Fl x +option. +The maximum slew rate possible is limited +to 500 parts-per-million (PPM) as a consequence of the correctness +principles on which the NTP protocol and algorithm design are +based. +As a result, the local clock can take a long time to +converge to an acceptable offset, about 2,000 s for each second the +clock is outside the acceptable range. +During this interval the +local clock will not be consistent with any other network clock and +the system cannot be used for distributed applications that require +correctly synchronized network time. +.Pp +In spite of the above precautions, sometimes when large +frequency errors are present the resulting time offsets stray +outside the 128-ms range and an eventual step or slew time +correction is required. +If following such a correction the +frequency error is so large that the first sample is outside the +acceptable range, +.Nm +enters the same state as when the +.Pa ntp.drift +file is not present. +The intent of this behavior +is to quickly correct the frequency and restore operation to the +normal tracking mode. +In the most extreme cases +(time.ien.it comes to mind), there may be occasional +step/slew corrections and subsequent frequency corrections. +It +helps in these cases to use the +.Cm burst +keyword when +configuring the server. +.Ss "Frequency Discipline" +The +.Nm +behavior at startup depends on whether the +frequency file, usually +.Pa ntp.drift , +exists. +This file +contains the latest estimate of clock frequency error. +When the +.Nm +is started and the file does not exist, the +.Nm +enters a special mode designed to quickly adapt to +the particular system clock oscillator time and frequency error. +This takes approximately 15 minutes, after which the time and +frequency are set to nominal values and the +.Nm +enters +normal mode, where the time and frequency are continuously tracked +relative to the server. +After one hour the frequency file is +created and the current frequency offset written to it. +When the +.Nm +is started and the file does exist, the +.Nm +frequency is initialized from the file and enters normal mode +immediately. +After that the current frequency offset is written to +the file at hourly intervals. +.Ss "Operating Modes" +.Nm +can operate in any of several modes, including +symmetric active/passive, client/server broadcast/multicast and +manycast, as described in the +.Qq Association Management +page +(available as part of the HTML documentation +provided in +.Pa /usr/share/doc/ntp ) . +It normally operates continuously while +monitoring for small changes in frequency and trimming the clock +for the ultimate precision. +However, it can operate in a one-time +mode where the time is set from an external server and frequency is +set from a previously recorded frequency file. +A +broadcast/multicast or manycast client can discover remote servers, +compute server-client propagation delay correction factors and +configure itself automatically. +This makes it possible to deploy a +fleet of workstations without specifying configuration details +specific to the local environment. +.Pp +By default, +.Nm +runs in continuous mode where each of +possibly several external servers is polled at intervals determined +by an intricate state machine. +The state machine measures the +incidental roundtrip delay jitter and oscillator frequency wander +and determines the best poll interval using a heuristic algorithm. +Ordinarily, and in most operating environments, the state machine +will start with 64s intervals and eventually increase in steps to +1024s. +A small amount of random variation is introduced in order to +avoid bunching at the servers. +In addition, should a server become +unreachable for some time, the poll interval is increased in steps +to 1024s in order to reduce network overhead. +.Pp +In some cases it may not be practical for +.Nm +to run +continuously. +A common workaround has been to run the +.Xr ntpdate 8 +program from a +.Xr cron 8 +job at designated +times. +However, this program does not have the crafted signal +processing, error checking and mitigation algorithms of +.Nm . +The +.Fl q +option is intended for this purpose. +Setting this option will cause +.Nm +to exit just after +setting the clock for the first time. +The procedure for initially +setting the clock is the same as in continuous mode; most +applications will probably want to specify the +.Cm iburst +keyword with the +.Ic server +configuration command. +With this +keyword a volley of messages are exchanged to groom the data and +the clock is set in about a minute. +If nothing is heard after a +couple of minutes, the daemon times out and exits. +After a suitable +period of mourning, the +.Xr ntpdate 8 +program may be +retired. +.Pp +When kernel support is available to discipline the clock +frequency, which is the case for stock Solaris, Tru64, Linux and +.Fx , +a useful feature is available to discipline the clock +frequency. +First, +.Nm +is run in continuous mode with +selected servers in order to measure and record the intrinsic clock +frequency offset in the frequency file. +It may take some hours for +the frequency and offset to settle down. +Then the +.Nm +is +stopped and run in one-time mode as required. +At each startup, the +frequency is read from the file and initializes the kernel +frequency. +.Ss "Poll Interval Control" +This version of NTP includes an intricate state machine to +reduce the network load while maintaining a quality of +synchronization consistent with the observed jitter and wander. +There are a number of ways to tailor the operation in order enhance +accuracy by reducing the interval or to reduce network overhead by +increasing it. +However, the user is advised to carefully consider +the consequenses of changing the poll adjustment range from the +default minimum of 64 s to the default maximum of 1,024 s. +The +default minimum can be changed with the +.Ic tinker +.Cm minpoll +command to a value not less than 16 s. +This value is used for all +configured associations, unless overriden by the +.Cm minpoll +option on the configuration command. +Note that most device drivers +will not operate properly if the poll interval is less than 64 s +and that the broadcast server and manycast client associations will +also use the default, unless overriden. +.Pp +In some cases involving dial up or toll services, it may be +useful to increase the minimum interval to a few tens of minutes +and maximum interval to a day or so. +Under normal operation +conditions, once the clock discipline loop has stabilized the +interval will be increased in steps from the minumum to the +maximum. +However, this assumes the intrinsic clock frequency error +is small enough for the discipline loop correct it. +The capture +range of the loop is 500 PPM at an interval of 64s decreasing by a +factor of two for each doubling of interval. +At a minimum of 1,024 +s, for example, the capture range is only 31 PPM. +If the intrinsic +error is greater than this, the drift file +.Pa ntp.drift +will +have to be specially tailored to reduce the residual error below +this limit. +Once this is done, the drift file is automatically +updated once per hour and is available to initialize the frequency +on subsequent daemon restarts. +.Ss "The huff-n'-puff filter" +In scenarios where a considerable amount of data are to be +downloaded or uploaded over telephone modems, timekeeping quality +can be seriously degraded. +This occurs because the differential +delays on the two directions of transmission can be quite large. +In +many cases the apparent time errors are so large as to exceed the +step threshold and a step correction can occur during and after the +data transfer is in progress. +.Pp +The huff-n'-puff filter is designed to correct the apparent time +offset in these cases. +It depends on knowledge of the propagation +delay when no other traffic is present. +In common scenarios this +occurs during other than work hours. +The filter maintains a shift +register that remembers the minimum delay over the most recent +interval measured usually in hours. +Under conditions of severe +delay, the filter corrects the apparent offset using the sign of +the offset and the difference between the apparent delay and +minimum delay. +The name of the filter reflects the negative (huff) +and positive (puff) correction, which depends on the sign of the +offset. +.Pp +The filter is activated by the +.Ic tinker command and +.Cm huffpuff +keyword, as described in +.Xr ntp.conf 5 . .Sh FILES .Bl -tag -width /etc/ntp.drift -compact .It Pa /etc/ntp.conf @@ -234,18 +573,13 @@ A snapshot of this documentation is available in HTML format in .%T Network Time Protocol (Version 3) .%O RFC1305 .Re -.Sh HISTORY -Written by -.An Dennis Ferguson -at the University of Toronto. -Text amended by -.An David Mills -at the University of Delaware. .Sh BUGS .Nm has gotten rather fat. -While not huge, it has gotten larger than might -be desireable for an elevated-priority daemon running on a workstation, -particularly since many of the fancy features which consume the space -were designed more with a busy primary server, rather than a high -stratum workstation, in mind. +While not huge, it has gotten +larger than might be desirable for an elevated-priority +.Nm +running on a workstation, particularly since many of +the fancy features which consume the space were designed more with +a busy primary server, rather than a high stratum workstation in +mind. diff --git a/usr.sbin/ntp/doc/ntpdate.8 b/usr.sbin/ntp/doc/ntpdate.8 index f20ad896f..5c50590 100644 --- a/usr.sbin/ntp/doc/ntpdate.8 +++ b/usr.sbin/ntp/doc/ntpdate.8 @@ -9,163 +9,117 @@ .Nd set the date and time via NTP .Sh SYNOPSIS .Nm -.Op Fl bBdqsuv +.Op Fl bBdoqsuv .Op Fl a Ar key .Op Fl e Ar authdelay .Op Fl k Ar keyfile .Op Fl o Ar version .Op Fl p Ar samples .Op Fl t Ar timeout -.Ar server -.Op Ar ... +.Ar server ... .Sh DESCRIPTION -.Nm -sets the local date and time by polling the Network Time Protocol (NTP) -server(s) given as the -.Ar server -arguments to determine -the correct time. It must be run as root on the local host. A number -of samples are obtained from each of the servers specified -and a subset of the NTP clock filter and selection algorithms -are applied to select the best of these. -Note that the accuracy and reliability of -.Nm -depends on the number of servers, -the number of polls each time it is run -and the interval between runs. .Pp -.Nm -can be run manually as necessary to set the host clock, -or it can be run from the host startup script -to set the clock at boot time. -This is useful in some cases to set the clock initially -before starting the NTP daemon -.Xr ntpd 8 . -It is also possible to run -.Nm -from a -.Xr cron 8 -script. -However, it is important to note that -.Nm -with contrived cron scripts is no substitute for the NTP daemon, -which uses sophisticated algorithms to maximize accuracy and reliability -while minimizing resource use. -Finally, since -.Nm -does not discipline the host clock frequency as does -.Xr ntpd 8 , -the accuracy using -.Nm -is limited. -.Pp -Time adjustments are made by -.Nm -in one of two ways. If -.Nm -determines the clock is in error more than 0.5 second it will simply -step the time by calling the system -.Xr settimeofday 2 -routine. -If the error is less than 0.5 seconds, it will slew the time -by calling the system -.Xr adjtime 2 -routine. -The latter technique is less disruptive and more -accurate when the error is small, and works quite well when -.Nm -is run by -.Xr cron 8 -every hour or two. -.Pp -.Nm -will decline to set the date if an NTP server daemon -(e.g., -.Xr ntpd 8 ) -is running on the same host. -When running -.Nm -on a regular basis from -.Xr cron 8 -as an alternative to running a daemon, -doing so once every hour or two -will result in precise enough timekeeping -to avoid stepping the clock. +.Em Note : +The functionality of this program is now available +in the +.Xr ntpd 8 +program. +See the +.Fl q +command line +option in the +.Xr ntpd 8 +page. +After a suitable period of +mourning, the +.Nm +program is to be retired from this +distribution. .Pp -If NetInfo support is compiled into -.Nm , -then the server argument is optional if -.Nm -can find a time server in the NetInfo configuration for -.Xr ntpd 8 . +.Nm +sets the local date and time by polling the +Network Time Protocol (NTP) server(s) given as the +.Ar server +arguments to determine the correct time. +It must be run as root on +the local host. +A number of samples are obtained from each of the +servers specified and a subset of the NTP clock filter and +selection algorithms are applied to select the best of these. +Note +that the accuracy and reliability of +.Nm +depends on +the number of servers, the number of polls each time it is run and +the interval between runs. .Pp The following options are available: .Bl -tag -width indent .It Fl a Ar key -Enable the authentication function -and specify the key identifier to be used -for authentication as the argument -.Ar key . +Enable the authentication function and specify the key +identifier to be used for authentication as the argument +.Ar key The keys and key identifiers must match in both the client and server key files. -The default is to disable the authentication function. +The default is to disable +the authentication function. .It Fl B Force the time to always be slewed using the .Xr adjtime 2 -system call, -even if the measured offset is greater than +-128 ms. -The default is to step the time using +system +call, even if the measured offset is greater than +-128 ms. +The +default is to step the time using .Xr settimeofday 2 -if the offset is greater than +-128 ms. -Note that, -if the offset is much greater than +-128 ms in this case, -it can take a long time (hours) -to slew the clock to the correct value. -During this time, -the host should not be used to synchronize clients. +if the offset is +greater than +-128 ms. +Note that, if the offset is much greater +than +-128 ms in this case, that it can take a long time (hours) to +slew the clock to the correct value. +During this time. the host +should not be used to synchronize clients. .It Fl b Force the time to be stepped using the .Xr settimeofday 2 -system call, -rather than slewed (default) using the +system +call, rather than slewed (default) using the .Xr adjtime 2 system call. -This option should be used -when called from a startup file at boot time. +This option should be used when called from a startup file at boot +time. .It Fl d -Enable the debugging mode, -in which -.Nm -will go through all the steps, -but not adjust the local clock. -Information useful for general debugging will also be printed. +Enable the debugging mode, in which +.Nm +will go +through all the steps, but not adjust the local clock. +Information +useful for general debugging will also be printed. .It Fl e Ar authdelay -Specify the processing delay -to perform an authentication function as the value +Specify the processing delay to perform an authentication +function as the value .Ar authdelay , in seconds and fraction (see -.Xr ntpd 8 +.Xr ntpd 8 for details). -This number is usually small enough -to be negligible for most purposes, -though specifying a value -may improve timekeeping on very slow CPU's. +This number is usually small +enough to be negligible for most purposes, though specifying a +value may improve timekeeping on very slow CPU's. .It Fl k Ar keyfile -Specify the path for the authentication key file -as the string +Specify the path for the authentication key file as the string .Ar keyfile . The default is .Pa /etc/ntp.keys . -This file should be in the format described in -.Xr ntpd 8 . +This file +should be in the format described in +.Xr ntpd 8 . .It Fl o Ar version -Specify the NTP version for outgoing packets as the integer +Specify the NTP version for outgoint packets as the integer .Ar version , which can be 1 or 2. The default is 3. This allows -.Nm +.Nm to be used with older NTP versions. .It Fl p Ar samples Specify the number of samples to be acquired from each server @@ -176,37 +130,121 @@ The default is 4. .It Fl q Query only - don't set the clock. .It Fl s -Divert logging output from the standard output (default) -to the system -.Xr syslog 3 +Divert logging output from the standard output (default) to the +system +.Xr syslog 3 facility. -This is designed primarily for convenience of -.Xr cron 8 +This is designed primarily for +convenience of +.Xr cron 8 scripts. .It Fl t Ar timeout -Specify the maximum time waiting for a server response -as the value +Specify the maximum time waiting for a server response as the +value .Ar timeout , in seconds and fraction. -The value is rounded to a multiple of 0.2 seconds. -The default is 1 second, -a value suitable for polling across a LAN. +The value is is +rounded to a multiple of 0.2 seconds. +The default is 1 second, a +value suitable for polling across a LAN. .It Fl u Direct -.Nm -to use an unprivileged port for outgoing packets. -This is most useful when behind a firewall -that blocks incoming traffic to privileged ports, -and you want to synchronise with hosts beyond the firewall. +.Nm +to use an unprivileged port or outgoing +packets. +This is most useful when behind a firewall that blocks +incoming traffic to privileged ports, and you want to synchronise +with hosts beyond the firewall. Note that the -.Fl d -option always uses unprivileged ports. +.Fl d +option +always uses unprivileged ports. .It Fl v Be verbose. This option will cause .Nm Ns 's -version identification string to be logged. +version +identification string to be logged. .El +.Pp +.Nm +can be run manually as necessary to set the +host clock, or it can be run from the host startup script to set +the clock at boot time. +This is useful in some cases to set the +clock initially before starting the NTP daemon +.Xr ntpd 8 . +It is +also possible to run +.Nm +from a +.Xr cron 8 +script. +However, it is important to note that +.Nm +with +contrived +.Xr cron 8 +scripts is no substitute for the NTP +daemon, which uses sophisticated algorithms to maximize accuracy +and reliability while minimizing resource use. +Finally, since +.Nm +does not discipline the host clock frequency as +does +.Xr ntpd 8 , +the accuracy using +.Nm +is +limited. +.Pp +Time adjustments are made by +.Nm +in one of two +ways. +If +.Nm +determines the clock is in error more +than 0.5 second it will simply step the time by calling the system +.Xr settimeofday 2 +routine. +If the error is less than 0.5 +seconds, it will slew the time by calling the system +.Xr adjtime 2 +routine. +The latter technique is less disruptive +and more accurate when the error is small, and works quite well +when +.Nm +is run by +.Xr cron 8 +every hour or +two. +.Pp +.Nm +will decline to set the date if an NTP server +daemon (e.g., +.Xr ntpd 8 ) +is running on the same host. +When +running +.Nm +on a regular basis from +.Xr cron 8 +as +an alternative to running a daemon, doing so once every hour or two +will result in precise enough timekeeping to avoid stepping the +clock. +.Pp +If NetInfo support is compiled into +.Nm , +then the +.Ic server +argument is optional if +.Nm +can find a +time server in the NetInfo configuration for +.Xr ntpd 8 . .Sh FILES .Bl -tag -width /etc/ntp.keys -compact .It Pa /etc/ntp.keys @@ -215,17 +253,12 @@ contains the encryption keys used by .El .Sh SEE ALSO .Xr ntpd 8 -.Sh HISTORY -Written by -.An Dennis Ferguson -at the University of Toronto .Sh BUGS -The slew adjustment is actually 50% larger than the measured offset, -since this (it is argued) -will tend to keep a badly drifting clock more accurate. -This is probably not a good idea -and may cause a troubling hunt -for some values of the kernel variables -.Va tick +The slew adjustment is actually 50% larger than the measured +offset, since this (it is argued) will tend to keep a badly +drifting clock more accurate. +This is probably not a good idea and +may cause a troubling hunt for some values of the kernel variables +.Va kern.clockrate.tick and -.Va tickadj . +.Va kern.clockrate.tickadj . diff --git a/usr.sbin/ntp/doc/ntpdc.8 b/usr.sbin/ntp/doc/ntpdc.8 index 290252e..febd02d 100644 --- a/usr.sbin/ntp/doc/ntpdc.8 +++ b/usr.sbin/ntp/doc/ntpdc.8 @@ -16,670 +16,687 @@ .Nm is used to query the .Xr ntpd 8 -daemon about its current state and to request changes in that state. -The program may be run either in interactive mode or controlled using -command line arguments. -Extensive state and statistics information is -available through the +daemon about its +current state and to request changes in that state. +The program may +be run either in interactive mode or controlled using command line +arguments. +Extensive state and statistics information is available +through the .Nm interface. -In addition, nearly all the configuration options which can -be specified at start up using -.Xr ntpd 8 Ns 's -configuration file may also be specified at run time using +In addition, nearly all the +configuration options which can be specified at startup using +ntpd's configuration file may also be specified at run time using .Nm . .Pp -If one or more request options is included on the command line when +The following options are available: +.Bl -tag -width indent +.It Fl c Ar command +The following argument is interpreted as an interactive format +command and is added to the list of commands to be executed on the +specified host(s). +Multiple +.Fl c +options may be given. +.It Fl i +Force +.Nm +to operate in interactive mode. +Prompts +will be written to the standard output and commands read from the +standard input. +.It Fl l +Obtain a list of peers which are known to the server(s). +This +switch is equivalent to +.Ql -c listpeers . +.It Fl n +Output all host addresses in dotted-quad numeric format rather +than converting to the canonical host names. +.It Fl p +Print a list of the peers known to the server as well as a +summary of their state. +This is equivalent to +.Ql -c peers . +.It Fl s +Print a list of the peers known to the server as well as a +summary of their state, but in a slightly different format than the +.Fl p +switch. +This is equivalent to +.Ql -c dmpeers . +.El +.Pp +If one or more request options are included on the command line +when .Nm -is executed, each of the requests will be sent to the NTP servers -running on each of the hosts given as command line arguments, or on -.Dq localhost -by default. -If no request options are given, +is executed, each of the requests will be sent +to the NTP servers running on each of the hosts given as command +line arguments, or on localhost by default. +If no request options +are given, .Nm -will attempt to read commands from the standard input and execute these -on the NTP server running on the first host given on the command line, -again defaulting to -.Dq localhost +will attempt to read commands from the +standard input and execute these on the NTP server running on the +first host given on the command line, again defaulting to localhost when no other host is specified. .Nm -will prompt for commands if the standard input is a terminal device. +will prompt for +commands if the standard input is a terminal device. .Pp .Nm -uses NTP mode 7 packets to communicate with the NTP server, -and hence can be used to query any compatible server on the network -which permits it. +uses NTP mode 7 packets to communicate with the +NTP server, and hence can be used to query any compatable server on +the network which permits it. Note that since NTP is a UDP protocol -this communication will be -somewhat unreliable, especially over large distances in terms of network -topology. +this communication will be somewhat unreliable, especially over +large distances in terms of network topology. .Nm -makes no attempt to retransmit requests, and will time requests out if -the remote host is not heard from within a suitable timeout time. +makes +no attempt to retransmit requests, and will time requests out if +the remote host is not heard from within a suitable timeout +time. .Pp The operation of .Nm -is specific to the particular implementation of the +are specific to the particular +implementation of the .Xr ntpd 8 -daemon and can be expected to work only with this -and maybe some previous versions of the daemon. +daemon and can be expected to +work only with this and maybe some previous versions of the daemon. Requests from a remote .Nm -program which affect the state of the local server -must be authenticated, -which requires both the remote program -and local server -share a common key and key identifier. -.Pp +program which affect the +state of the local server must be authenticated, which requires +both the remote program and local server share a common key and key +identifier. Specifying a command line option other than .Fl i or .Fl n -will cause the specified query (queries) -to be sent to the indicated host(s) immediately. +will cause the specified query (queries) to be sent to +the indicated host(s) immediately. Otherwise, .Nm -will attempt to read interactive format commands from the standard +will +attempt to read interactive format commands from the standard input. -The following options are available: -.Bl -tag -width indent -.It Fl c Ar command -The -.Ar command -argument is interpreted as an interactive format command -and is added to the list of commands to be executed on the specified -host(s). -Multiple -.Fl c -options may be given. -.It Fl i -Force -.Nm -to operate in interactive mode. -Prompts will be written to the standard -output and commands read from the standard input. -.It Fl l -Obtain a list of peers which are known to the server(s). -This switch is equivalent to -.Dq Li -c listpeers . -.It Fl n -Output all host addresses in dotted-quad numeric format rather than -converting to the canonical host names. -.It Fl p -Print a list of the peers known to the server as well as a summary of -their state. -This is equivalent to -.Dq Li -c peers . -.It Fl s -Print a list of the peers known to the server as well as a summary of -their state, but in a slightly different format than the -.Fl p -switch. -This is equivalent to -.Dq Li -c dmpeers . -.El -.Ss Interactive Commands -Interactive format commands consist of a keyword followed by zero to -four arguments. -Only enough characters of the full keyword to uniquely -identify the command need be typed. -The output of a command is normally -sent to the standard output, but optionally the output of individual -commands may be sent to a file by appending a -.Qq > , -followed by a -file name, to the command line. +.Ss "Interactive Commands" +Interactive format commands consist of a keyword followed by zero +to four arguments. +Only enough characters of the full keyword to +uniquely identify the command need be typed. +The output of a +command is normally sent to the standard output, but optionally the +output of individual commands may be sent to a file by appending a +.Ql \&; , +followed by a file name, to the command line. .Pp -A number of interactive format commands are executed entirely within the +A number of interactive format commands are executed entirely +within the .Nm -program itself and do not result in -NTP mode 7 requests being sent to a server. -These are described following: +program itself and do not result in NTP +mode 7 requests being sent to a server. +These are described +following. .Bl -tag -width indent -.It Ic ?\& Op Ar command_keyword -.It Ic help Op Ar command_keyword +.It Ic \&? Ar command_keyword +.It Ic help Ar command_keyword A -.Ic ?\& -by itself will print a list of all the command keywords -known to this incarnation of +.Ic \&? +will print a list of all the command +keywords known to this incarnation of .Nm . A -.Ic ?\& -followed by a command keyword will print function and -usage information about the command. +.Ic \&? +followed by a command keyword will print function and usage +information about the command. This command is probably a better source of information about -.Nm -than this manual page. +.Xr ntpq 8 +than this manual +page. .It Ic delay Ar milliseconds -Specify a time interval to be added to timestamps included in requests -which require authentication. -This is used to enable (unreliable) server -reconfiguration over long delay network paths or between machines whose -clocks are unsynchronized. -Actually the server does not now require -timestamps in authenticated requests, +Specify a time interval to be added to timestamps included in +requests which require authentication. +This is used to enable +(unreliable) server reconfiguration over long delay network paths +or between machines whose clocks are unsynchronized. +Actually the +server does not now require timestamps in authenticated requests, so this command may be obsolete. .It Ic host Ar hostname Set the host to which future queries will be sent. -The -.Ar hostname -supplied -may be either a host name or a numeric -address. -.It Ic hostnames Ar yes | Ar no +Hostname may +be either a host name or a numeric address. +.It Ic hostnames Op Cm yes | Cm no If -.Ar yes -is specified, host names are printed in information -displays. +.Cm yes +is specified, host names are printed in +information displays. If -.Ar no -is given, numeric addresses are printed -instead. +.Cm no +is specified, numeric +addresses are printed instead. The default is -.Ar yes -unless modified using the command line +.Cm yes , +unless +modified using the command line .Fl n switch. .It Ic keyid Ar keyid -This command allows the specification of a key number to be used to -authenticate configuration requests. -This must correspond to a key -number the server has been configured to use for this purpose. +This command allows the specification of a key number to be +used to authenticate configuration requests. +This must correspond +to a key number the server has been configured to use for this +purpose. .It Ic quit Exit .Nm . .It Ic passwd -This command prompts you to type in a password (which will not be -echoed) which will be used to authenticate configuration requests. -The -password must correspond to the key configured for use by the NTP server -for this purpose if such requests are to be successful. +This command prompts you to type in a password (which will not +be echoed) which will be used to authenticate configuration +requests. +The password must correspond to the key configured for +use by the NTP server for this purpose if such requests are to be +successful. .It Ic timeout Ar milliseconds Specify a timeout period for responses to server queries. -The default -is about 5000 milliseconds. +The +default is about 8000 milliseconds. Note that since .Nm -retries each query once after a timeout, the total waiting time for a -timeout will be twice the timeout value set. +retries each query once after a timeout, the total waiting time for +a timeout will be twice the timeout value set. .El -.Ss Control Message Commands -Query commands result in -NTP mode 7 packets containing requests for +.Ss "Control Message Commands" +Query commands result in NTP mode 7 packets containing requests for information being sent to the server. -These are -.Qq read-only -commands in that they make no modification of the server configuration +These are read-only commands +in that they make no modification of the server configuration state. .Bl -tag -width indent .It Ic listpeers -Obtain and print a brief list of the peers for which the server is -maintaining state. -These should include all configured peer associations -as well as those peers whose stratum is such that they are considered by -the server to be possible future synchronization candidates. +Obtains and prints a brief list of the peers for which the +server is maintaining state. +These should include all configured +peer associations as well as those peers whose stratum is such that +they are considered by the server to be possible future +synchonization candidates. .It Ic peers -Obtain a list of peers for which the server is maintaining state, along -with a summary of that state. -Summary information includes the address -of the remote peer, the local interface address (0.0.0.0 if a local -address has yet to be determined), the stratum of the remote peer (a -stratum of 16 indicates the remote peer is unsynchronized), the polling -interval, in seconds, the reachability register, in octal, and the -current estimated delay, offset and dispersion of the peer, all in -seconds. -In addition, the character in the left margin indicates the -mode this peer entry is operating in. +Obtains a list of peers for which the server is maintaining +state, along with a summary of that state. +Summary information +includes the address of the remote peer, the local interface +address (0.0.0.0 if a local address has yet to be determined), the +stratum of the remote peer (a stratum of 16 indicates the remote +peer is unsynchronized), the polling interval, in seconds, the +reachability register, in octal, and the current estimated delay, +offset and dispersion of the peer, all in seconds. +.Pp +The character in the left margin indicates the mode this peer +entry is operating in. A -.Qq + -denotes symmetric -active, a -.Qq - +.Ql \&+ +denotes symmetric active, a +.Ql \&- indicates symmetric passive, a -.Qq = -means -the remote server is being polled in client mode, a -.Qq ^ +.Ql \&= +means the +remote server is being polled in client mode, a +.Ql \&^ indicates that the server is broadcasting to this address, a -.Qq ~ +.Ql \&~ denotes that the remote peer is sending broadcasts and a -.Qq * -marks the peer the server is currently synchronizing to. +.Ql \&* +marks the peer the server is currently synchonizing +to. .Pp The contents of the host field may be one of four forms. -It may be a -host name, an IP address, a reference clock implementation name with its -parameter or -.Dq Li REFCLK(<implementation number>, <parameter>) . -On hostnames no -only IP addresses will be displayed. +It may +be a host name, an IP address, a reference clock implementation +name with its parameter or +.Fn REFCLK "implementation_number" "parameter" . +On +.Ic hostnames +.Cm no +only IP-addresses +will be displayed. .It Ic dmpeers A slightly different peer summary list. -Identical to the output of the -.Em peers -command except for the character in the leftmost column. -Characters only -appear beside peers which were included in the final stage of the clock -selection algorithm. +Identical to the output +of the +.Ic peers +command, except for the character in the +leftmost column. +Characters only appear beside peers which were +included in the final stage of the clock selection algorithm. A -.Qq \&. -indicates that this peer was cast off -in the falseticker detection, while a -.Qq + -indicates that the -peer made it through. +.Ql \&. +indicates that this peer was cast off in the falseticker +detection, while a +.Ql \&+ +indicates that the peer made it +through. A -.Qq * -denotes the peer the server is -currently synchronizing with. -.It Xo Ic showpeer -.Ar peer_address -.Op Ar ... -.Xc -Show a detailed display of the current peer variables for one or more -peers. -Most of these values are described in the -NTP Version 2 specification. -.It Xo Ic pstats -.Ar peer_address -.Op Ar ... -.Xc -Show per-peer statistic counters associated with the specified peer(s). -.It Xo Ic clockinfo -.Ar clock_peer_address -.Op Ar ... -.Xc +.Ql \&* +denotes the peer the server is currently +synchronizing with. +.It Ic showpeer Ar peer_address ... +Shows a detailed display of the current peer variables for one +or more peers. +Most of these values are described in the NTP +Version 2 specification. +.It Ic pstats Ar peer_address ... +Show per-peer statistic counters associated with the specified +peer(s). +.It Ic clockinfo Ar clock_peer_address ... Obtain and print information concerning a peer clock. -The values -obtained provide information on the setting of fudge factors and other -clock performance information. +The +values obtained provide information on the setting of fudge factors +and other clock performance information. .It Ic kerninfo Obtain and print kernel phase-lock loop operating parameters. -This information is available -only if the kernel has been specially modified -for a precision timekeeping function. -.It Ic loopinfo Op Ar oneline | Ar multiline +This information is available only if the kernel has been specially +modified for a precision timekeeping function. +.It Ic loopinfo Op Cm oneline | Cm multiline Print the values of selected loop filter variables. -The loop filter is -the part of -NTP which deals with adjusting the local system clock. +The loop +filter is the part of NTP which deals with adjusting the local +system clock. The -.Qq offset -is the last offset given to the loop filter by the -packet processing code. +.Sq offset +is the last offset given to the +loop filter by the packet processing code. The -.Qq frequency -is the frequency error -of the local clock in parts-per-million (ppm). +.Sq frequency +is the frequency error of the local clock in parts-per-million +(ppm). The -.Qq time_const -controls the -.Qq stiffness -of the phase-lock loop and thus the speed at -which it can adapt to oscillator drift. +.Sq time_const +controls the stiffness of the +phase-lock loop and thus the speed at which it can adapt to +oscillator drift. The -.Qq watchdog timer -value is the number of seconds which have elapsed since the last sample -offset was given to the loop filter. +.Sq watchdog timer +value is the number +of seconds which have elapsed since the last sample offset was +given to the loop filter. The -.Ar oneline +.Cm oneline and -.Ar multiline -options specify the format in which this information -is to be printed, with -.Ar multiline -as the default. +.Cm multiline +options specify the format in which this +information is to be printed, with +.Cm multiline +as the +default. .It Ic sysinfo -Print a variety of system state variables, i.e. state related to the -local server. -All except the last four lines are described in the -NTP Version 3 specification, RFC 1305. +Print a variety of system state variables, i.e., state related +to the local server. +All except the last four lines are described +in the NTP Version 3 specification, RFC-1305. +.Pp The -.Qq system flags -show various system flags, some of which can be set and cleared by the +.Sq system flags +show various system flags, some of +which can be set and cleared by the .Ic enable and .Ic disable -configuration commands, -respectively. -These are the auth, bclient, monitor, pll, pps and stats flags, -as described below under the -.Ic enable -command in the -.Sx Runtime Configuration Requests -section. -There are two additional flags which are read only, -the kernel_pll and kernel_pps. -These flags indicate the synchronization status -when the precision time kernel modifications are in use. -The kernel_pll indicates -that the local clock is being disciplined by the kernel, -while the kernel_pps indicates -the kernel discipline is provided by the PPS signal. +configuration commands, respectively. +These are +the +.Cm auth , +.Cm bclient , +.Cm monitor , +.Cm pll , +.Cm pps +and +.Cm stats +flags. +See the +.Xr ntpd 8 +documentation for the meaning of these flags. +There +are two additional flags which are read only, the +.Cm kernel_pll +and +.Cm kernel_pps . +These flags indicate +the synchronization status when the precision time kernel +modifications are in use. +The +.Sq kernel_pll +indicates that +the local clock is being disciplined by the kernel, while the +.Sq kernel_pps +indicates the kernel discipline is provided by the PPS +signal. .Pp The -.Qq stability -is the residual frequency error -remaining after the system frequency correction is applied and is -intended for maintenance and debugging. -In most architectures, this -value will initially decrease from as high as 500 ppm to a nominal value -in the range .01 to 0.1 ppm. +.Sq stability +is the residual frequency error remaining +afterthe system frequency correction is applied and is intended for +maintenance and debugging. +In most architectures, this value will +initially decrease from as high as 500 ppm to a nominal value in +the range .01 to 0.1 ppm. If it remains high for some time after -starting the daemon, something may be wrong with the local clock, or the -value of the kernel variable -.Qq tick -may be incorrect. +starting the daemon, something may be wrong with the local clock, +or the value of the kernel variable +.Va kern.clockrate.tick +may be +incorrect. .Pp The -.Qq broadcastdelay -shows the default broadcast delay, as set by -the -.Qq broadcastdelay -configuration option, while the -.Qq authdelay -shows the default authentication delay, as set by -the -.Qq authdelay -configuration option. +.Ic broadcastdelay +shows the default broadcast delay, +as set by the +.Ic broadcastdelay +configuration command. +.Pp +The +.Sq authdelay +shows the default authentication delay, +as set by the +.Ic authdelay +configuration command. .It Ic sysstats -Print statistics counters maintained in the protocol module. +Print statistics counters maintained in the protocol +module. .It Ic memstats Print statistics counters related to memory allocation code. .It Ic iostats -Print statistics counters maintained in the input-output module. +Print statistics counters maintained in the input-output +module. .It Ic timerstats -Print statistics counters maintained in the timer/event queue support -code. +Print statistics counters maintained in the timer/event queue +support code. .It Ic reslist Obtain and print the server's restriction list. -This list is (usually) -printed in sorted order and may help to understand how the restrictions -are applied. +This list is +(usually) printed in sorted order and may help to understand how +the restrictions are applied. .It Ic monlist Op Ar version -Obtain and print traffic counts collected and maintained by the monitor -facility. -The version number should not normally need to be specified. -.It Xo Ic clkbug -.Ar clock_peer_address -.Op Ar ... -.Xc +Obtain and print traffic counts collected and maintained by the +monitor facility. +The version number should not normally need to be +specified. +.It Ic clkbug clock_peer_address ... Obtain debugging information for a reference clock driver. -This information is provided only by some clock drivers and is mostly +This +information is provided only by some clock drivers and is mostly undecodable without a copy of the driver source in hand. .El -.Ss Runtime Configuration Requests -All requests which cause state changes in the server are authenticated -by the server using a configured -NTP key (the facility can also be -disabled by the server by not configuring a key). -The key number and the -corresponding key must also be made known to +.Ss "Runtime Configuration Requests" +All requests which cause state changes in the server are +authenticated by the server using a configured NTP key (the +facility can also be disabled by the server by not configuring a +key). +The key number and the corresponding key must also be made +known to .Nm . This can be done using the .Ic keyid and .Ic passwd -commands, the latter of which will prompt at the terminal for a password -to use as the encryption key. -You will also be prompted automatically -for both the key number and password the first time a command which -would result in an authenticated request to the server is given. -Authentication not only provides verification that the requester has -permission to make such changes, but also gives an extra degree of -protection again transmission errors. +commands, the latter of which will prompt at the terminal for a +password to use as the encryption key. +You will also be prompted +automatically for both the key number and password the first time a +command which would result in an authenticated request to the +server is given. +Authentication not only provides verification that +the requester has permission to make such changes, but also gives +an extra degree of protection again transmission errors. .Pp -Authenticated requests always include a timestamp in the packet data, -which is included in the computation of the authentication code. -This timestamp is compared by the server to its receive time stamp. -If they differ by more than a small amount the request is rejected. +Authenticated requests always include a timestamp in the packet +data, which is included in the computation of the authentication +code. +This timestamp is compared by the server to its receive time +stamp. +If they differ by more than a small amount the request is +rejected. This is done for two reasons. -First, it makes simple replay attacks on the server, by -someone who might be able to overhear traffic on your LAN, much more -difficult. -Second, it makes it more difficult to request configuration -changes to your server from topologically remote hosts. -While the -reconfiguration facility will work well with a server on the local host, -and may work adequately between time-synchronized hosts on the same -LAN, it will work very poorly for more distant hosts. -As such, if -reasonable passwords are chosen, care is taken in the distribution and +First, it makes simple +replay attacks on the server, by someone who might be able to +overhear traffic on your LAN, much more difficult. +Second, it makes +it more difficult to request configuration changes to your server +from topologically remote hosts. +While the reconfiguration facility +will work well with a server on the local host, and may work +adequately between time-synchronized hosts on the same LAN, it will +work very poorly for more distant hosts. +As such, if reasonable +passwords are chosen, care is taken in the distribution and protection of keys and appropriate source address restrictions are applied, the run time reconfiguration facility should provide an adequate level of security. .Pp The following commands all make authenticated requests. .Bl -tag -width indent -.It Xo Ic addpeer -.Ar peer_address +.It Xo Ic addpeer Ar peer_address .Op Ar keyid .Op Ar version -.Op Ar prefer +.Op Cm prefer .Xc -Add a configured peer association at the given address and operating in -symmetric active mode. -Note that an existing association with the same -peer may be deleted when this command is executed, or may simply be -converted to conform to the new configuration, as appropriate. -If the -optional +Add a configured peer association at the given address and +operating in symmetric active mode. +Note that an existing +association with the same peer may be deleted when this command is +executed, or may simply be converted to conform to the new +configuration, as appropriate. +If the optional .Ar keyid -is a nonzero integer, all outgoing packets to -the remote server will have an authentication field attached encrypted -with this key. -If the value is 0 (or not given) no authentication will -be done. +is a +nonzero integer, all outgoing packets to the remote server will +have an authentication field attached encrypted with this key. +If +the value is 0 (or not given) no authentication will be done. The .Ar version can be 1, 2 or 3 and defaults to 3. The -.Ar prefer -keyword indicates a preferred peer (and thus will be -used primarily for clock synchronisation if possible). -The preferred -peer also determines the validity of the PPS signal - if the preferred -peer is suitable for synchronisation so is the PPS signal. -.It Xo Ic addserver -.Ar peer_address +.Cm prefer +keyword indicates a preferred peer (and thus will +be used primarily for clock synchronisation if possible). +The +preferred peer also determines the validity of the PPS signal - if +the preferred peer is suitable for synchronisation so is the PPS +signal. +.It Xo Ic addserver Ar peer_address .Op Ar keyid .Op Ar version -.Op Ar prefer +.Op Cm prefer .Xc -Identical to the -.Ic addpeer -command, except that the operating mode is client. -.It Xo Ic broadcast -.Ar peer_address +Identical to the addpeer command, except that the operating +mode is client. +.It Xo Ic broadcast Ar peer_address .Op Ar keyid .Op Ar version +.Op Cm prefer .Xc -Identical to the -.Ic addpeer -command, except that the operating mode is broadcast. -In this case a valid key identifier and key are required. +Identical to the addpeer command, except that the operating +mode is broadcast. +In this case a valid key identifier and key are +required. The .Ar peer_address -parameter can be the broadcast address of the local network or a -multicast group address assigned to -NTP. -If a multicast address, a -multicast-capable kernel is required. -.It Xo Ic unconfig -.Ar peer_address -.Op Ar ... -.Xc -This command causes the configured bit to be removed from the specified -peer(s). -In many cases this will cause the peer association to be deleted. -When appropriate, however, the association may persist in an -unconfigured mode if the remote peer is willing to continue on in this -fashion. -.It Xo Ic fudge -.Ar peer_address -.Op Ar time1 -.Op Ar time2 +parameter can be the broadcast +address of the local network or a multicast group address assigned +to NTP. +If a multicast address, a multicast-capable kernel is +required. +.It Ic unconfig Ar peer_address ... +This command causes the configured bit to be removed from the +specified peer(s). +In many cases this will cause the peer +association to be deleted. +When appropriate, however, the +association may persist in an unconfigured mode if the remote peer +is willing to continue on in this fashion. +.It Xo Ic fudge Ar peer_address +.Op Cm time1 +.Op Cm time2 .Op Ar stratum .Op Ar refid .Xc -This command provides a way to set certain data for a reference clock. +This command provides a way to set certain data for a reference +clock. See the source listing for further information. -.It Xo Ic enable -.Ar flag -.Op Ar ... -.Xc -.It Xo Ic disable -.Ar flag -.Op Ar ... -.Xc +.It enable Ar flag ... +.It disable Ar flag ... These commands operate in the same way as the -.Qq enable +.Ic enable and -.Qq disable +.Ic disable configuration file commands of -.Xr ntpd 8 . +.Xr ntpd 8 . Following is a description of the flags. -Note that only the auth, bclient, monitor, pll, pps and stats flags -can be set by +Note that only the +.Cm auth , +.Cm bclient , +.Cm monitor , +.Cm pll , +.Cm pps +and +.Cm stats +flags can be set by .Nm ; -the pll_kernel and pps_kernel flags are read-only. +the +.Cm pll_kernel +and +.Cm pps_kernel +flags are +read-only. .Bl -tag -width indent -.It auth -Enables the server to synchronize -with unconfigured peers only if the peer has been correctly -authenticated using a trusted key and key identifier. +.It Cm auth +Enables the server to synchronize with unconfigured peers only +if the peer has been correctly authenticated using a trusted key +and key identifier. The default for this flag is enable. -.It bclient -Enables the server -to listen for a message from a broadcast or multicast server, -as in the -.Qq mutlicastclient -configuration option with default address. +.It Cm bclient +Enables the server to listen for a message from a broadcast or +multicast server, as in the +.Ic multicastclient +command with +default address. The default for this flag is disable. -.It monitor -Enables the monitoring facility for the +.It Cm monitor +Enables the monitoring facility. +See the .Ic monlist -command. -The default for this flag is enable. -.It pll +command for further information. +The +default for this flag is enable. +.It Cm pll Enables the server to adjust its local clock by means of NTP. -If disabled, -the local clock free-runs at its intrinsic time and frequency offset. -This flag is useful -in case the local clock is controlled -by some other device or protocol -and NTP is used only to provide synchronization to other clients. -In this case, the local clock driver is used. +If disabled, the local clock free-runs at its intrinsic time and +frequency offset. +This flag is useful in case the local clock is +controlled by some other device or protocol and NTP is used only to +provide synchronization to other clients. +In this case, the local +clock driver is used. See the -.Qo -Reference Clock Drivers -.Qc +.Qq "Reference Clock Drivers" page (available as part of the HTML documentation provided in .Pa /usr/share/doc/ntp ) -for further information. -The default for this flag is enable. -.It pps -Enables the pulse-per-second (PPS) signal -when frequency and time is disciplined -by the precision time kernel modifications. -See the -.Qo -A Kernel Model for Precision Timekeeping -.Qc -page -for further information. -The default for this flag is disable. -.It stats +page for further information. +The default for +this flag is enable. +.It Cm pps +Enables the pulse-per-second (PPS) signal when frequency and +time is disciplined by the precision time kernel modifications. +See +the +.Qq "A Kernel Model for Precision Timekeeping" +page for further information. +The default for this flag is +disable. +.It Cm stats Enables the statistics facility. See the -.Qq Monitoring Support -section of the +.Sx Monitoring Options +section +of the .Xr ntp.conf 5 -page -for further information. +page for further information. The default for this flag is enable. -.It pll_kernel +.It Cm pll_kernel When the precision time kernel modifications are installed, -this indicates the kernel controls the clock discipline; -otherwise, the daemon controls the clock discipline. -.It pps_kernel -When the precision time kernel modifications are installed -and a pulse-per-second (PPS) signal is available, -this indicates the PPS signal controls the clock discipline; -otherwise, the daemon or kernel controls the clock discipline, -as indicated by the pll_kernel flag. +this indicates the kernel controls the clock discipline; otherwise, +the daemon controls the clock discipline. +.It Cm pps_kernel +When the precision time kernel modifications are installed and +a pulse-per-second (PPS) signal is available, this indicates the +PPS signal controls the clock discipline; otherwise, the daemon or +kernel controls the clock discipline, as indicated by the +.Cm pll_kernel +flag. .El -.It Xo Ic restrict -.Ar address -.Ar mask -.Ar flag -.Op Ar flag +.It Xo Ic restrict Ar address Ar mask +.Ar flag ... .Xc -This command operates in the same was as the -.Qq restrict -configuration option of -.Xr ntpd 8 . -.It Xo Ic unrestrict -.Ar address -.Ar mask -.Ar flag -.Op Ar flag +This command operates in the same way as the +.Ic restrict +configuration file commands of +.Xr ntpd 8 . +.It Xo Ic unrestrict Ar address Ar mask +.Ar flag ... .Xc Unrestrict the matching entry from the restrict list. -.It Xo Ic delrestrict -.Ar address -.Ar mask -.Op Ar ntpport +.It Xo Ic delrestrict Ar address Ar mask +.Op Cm ntpport .Xc Delete the matching entry from the restrict list. .It Ic readkeys -Cause the current set of authentication keys to be purged and a new set -to be obtained by rereading the keys file (which must have been -specified in the +Causes the current set of authentication keys to be purged and +a new set to be obtained by rereading the keys file (which must +have been specified in the .Xr ntpd 8 configuration file). -This allows encryption keys to be changed without -restarting the server. -.It Xo Ic trustkey -.Ar keyid -.Op Ar ... -.Xc -.It Xo Ic untrustkey -.Ar keyid -.Op Ar ... -.Xc +This +allows encryption keys to be changed without restarting the +server. +.It Ic trustedkey Ar keyid ... +.It Ic untrustedkey Ar keyid ... These commands operate in the same way as the -.Qq trustedkey +.Ic trustedkey and -.Qq untrustkey -configuration options of -.Xr ntpd 8 . +.Ic untrustedkey +configuration file +commands of +.Xr ntpd 8 . .It Ic authinfo -Returns information concerning the authentication module, including -known keys and counts of encryptions and decryptions which have been -done. +Returns information concerning the authentication module, +including known keys and counts of encryptions and decryptions +which have been done. .It Ic traps Display the traps set in the server. -See the source listing for further information. -.It Xo Ic addtrap -.Ar address +See the source listing for +further information. +.It Xo Ic addtrap Ar address .Op Ar port .Op Ar interface .Xc Set a trap for asynchronous messages. -See the source listing for further information. -.It Xo Ic clrtrap -.Ar address +See the source listing +for further information. +.It Xo Ic clrtrap Ar address .Op Ar port .Op Ar interface .Xc Clear a trap for asynchronous messages. -See the source listing for further information. -.It reset Ar counter Op Ar ... +See the source listing +for further information. +.It Ic reset Clear the statistics counters in various modules of the server. See the source listing for further information. .El @@ -691,16 +708,13 @@ See the source listing for further information. .%T Network Time Protocol (Version 3) .%O RFC1305 .Re -.Sh HISTORY -Written by -.An Dennis Ferguson -at the University of Toronto. .Sh BUGS .Nm is a crude hack. -Much of the information it shows is deadly boring -and could only be loved by its implementer. -The program was designed so that new (and temporary) features -were easy to hack in, -at great expense to the program's ease of use. -Despite this, the program is occasionally useful. +Much of the information it shows is +deadly boring and could only be loved by its implementer. +The +program was designed so that new (and temporary) features were easy +to hack in, at great expense to the program's ease of use. +Despite +this, the program is occasionally useful. diff --git a/usr.sbin/ntp/doc/ntpq.8 b/usr.sbin/ntp/doc/ntpq.8 index d2f8998..717a8e2 100644 --- a/usr.sbin/ntp/doc/ntpq.8 +++ b/usr.sbin/ntp/doc/ntpq.8 @@ -13,66 +13,65 @@ .Op Fl c Ar command .Op Ar host ... .Sh DESCRIPTION +The .Nm -is used to query NTP servers which implement the recommended NTP mode 6 -control message format about current state and to request changes in -that state. -The program may be run either in interactive mode or -controlled using command line arguments. -Requests to read and write -arbitrary variables can be assembled, with raw and pretty-printed -output options being available. +utility program is used to query NTP servers +which implement the recommended NTP mode 6 control message format +about current state and to request changes in that state. +The +program may be run either in interactive mode or controlled using +command line arguments. +Requests to read and write arbitrary +variables can be assembled, with raw and pretty-printed output +options being available. .Nm -can also obtain and print a list of peers in a common format by sending -multiple queries to the server. +can also obtain and print a +list of peers in a common format by sending multiple queries to the +server. .Pp -If one or more request options is included on the command line when +If one or more request options is included on the command line +when .Nm -is executed, each of the requests will be sent to the NTP servers -running on each of the hosts given as command line arguments, or on -.Dq localhost -by default. -If no request options are given, +is executed, each of the requests will be sent +to the NTP servers running on each of the hosts given as command +line arguments, or on localhost by default. +If no request options +are given, .Nm -will attempt to read commands from the standard input and execute these -on the NTP server running on the first host given on the command line, -again -defaulting to -.Dq localhost +will attempt to read commands from the +standard input and execute these on the NTP server running on the +first host given on the command line, again defaulting to localhost when no other host is specified. .Nm -will prompt for commands if the standard input is a terminal device. +will prompt for +commands if the standard input is a terminal device. .Pp .Nm -uses NTP mode 6 packets to communicate with the NTP server, and hence -can be used to query any compatible server on the network which permits -it. -Note that since NTP is a UDP protocol this communication will be -somewhat unreliable, especially over large distances in terms of network -topology. +uses NTP mode 6 packets to communicate with the +NTP server, and hence can be used to query any compatible server on +the network which permits it. +Note that since NTP is a UDP protocol +this communication will be somewhat unreliable, especially over +large distances in terms of network topology. .Nm -makes one attempt to retransmit requests, and will time requests out if -the remote host is not heard from within a suitable timeout time. +makes +one attempt to retransmit requests, and will time requests out if +the remote host is not heard from within a suitable timeout +time. +.Pp +For examples and usage, see the +.Qq "NTP Debugging Techniques" +page +(available as part of the HTML documentation +provided in +.Pa /usr/share/doc/ntp ) . .Pp -Command line options are described following. -Specifying a command line -option other than -.Fl i -or -.Fl n -will cause the specified query (queries) to be sent to the indicated -host(s) immediately. -Otherwise, -.Nm -will attempt to read interactive format commands from the standard -input. The following options are available: .Bl -tag -width indent -.It Fl c Ar command -The following argument is interpreted -as an interactive format command -and is added to the list of commands to be executed on the specified -host(s). +.It Fl c +The following argument is interpreted as an interactive format +command and is added to the list of commands to be executed on the +specified host(s). Multiple .Fl c options may be given. @@ -80,72 +79,78 @@ options may be given. Force .Nm to operate in interactive mode. -Prompts will be written to the standard -output and commands read from the standard input. +Prompts +will be written to the standard output and commands read from the +standard input. .It Fl n -Output all host addresses in dotted-quad numeric format rather than -converting to the canonical host names. +Output all host addresses in dotted-quad numeric format rather +than converting to the canonical host names. .It Fl p -Print a list of the peers known to the server as well as a summary of -their state. +Print a list of the peers known to the server as well as a +summary of their state. This is equivalent to the .Ic peers interactive command. .El -.Ss Internal Commands -Interactive format commands consist of a keyword followed by zero to -four arguments. -Only enough characters of the full keyword to uniquely -identify the command need be typed. -The output of a command is normally -sent to the standard output, but optionally the output of individual -commands may be sent to a file by appending a -.Qq > , +.Pp +Specifying a +command line option other than +.Fl i +or +.Fl n +will +cause the specified query (queries) to be sent to the indicated +host(s) immediately. +Otherwise, +.Nm +will attempt to read +interactive format commands from the standard input. +.Ss "Internal Commands" +Interactive format commands consist of a keyword followed by zero +to four arguments. +Only enough characters of the full keyword to +uniquely identify the command need be typed. +The output of a +command is normally sent to the standard output, but optionally the +output of individual commands may be sent to a file by appending a +.Ql \&< , followed by a file name, to the command line. -A number of interactive format commands are executed entirely within the +A +number of interactive format commands are executed entirely within +the .Nm -program itself and do not result in NTP mode 6 requests being sent to a -server. +program itself and do not result in NTP mode 6 +requests being sent to a server. These are described following. .Bl -tag -width indent -.It Ic ?\& Op Ar command_keyword +.It Ic \&? Op Ar command_keyword .It Ic help Op Ar command_keyword A -.Ic ?\& -by itself will print a list of all the command keywords -known to this incarnation of +.Ql \&? +by itself will print a list of all the command +keywords known to this incarnation of .Nm . A -.Ic ?\& -followed by a command keyword will print function and -usage information about the command. +.Ql \&? +followed by a command keyword will print function and usage +information about the command. This command is probably a better source of information about .Nm -than this manual page. -.\" -.\" XXX Both variable_name and value below should be arguments, -.\" not angle-quoted text. -.\" +than this manual +page. .It Xo Ic addvars -.Aq variable_name Ns -.Op = Ns Aq value Ns -.Op ,... -.Xc -.It Xo Ic rmvars -.Aq variable_name Ns -.Op ,... +.Ar variable_name Ns Op = Ns Ar value ... .Xc +.It Ic rmvars Ar variable_name ... .It Ic clearvars -The data carried by NTP mode 6 messages consists of a list of items of -the form -.Sm off -.Ao variable_name Ac = Aq value -.Sm on +The data carried by NTP mode 6 messages consists of a list of +items of the form +.Ql variable_name=value , where the -.Qq = Ns Aq value -is ignored, and can be omitted, in requests -to the server to read variables. +.Ql =value +is ignored, and can be omitted, +in requests to the server to read variables. .Nm maintains an internal list in which data to be included in control messages can be assembled, and sent using the @@ -155,244 +160,250 @@ and commands described below. The .Ic addvars -command allows variables and their optional values to be added to the -list. -If more than one variable is to be added, the list should be -comma-separated and not contain white space. +command allows variables and their optional values to be added to +the list. +If more than one variable is to be added, the list should +be comma-separated and not contain white space. The .Ic rmvars -command can be used to remove individual variables from the list, while -the -.Ic clearvars -command removes all variables from the list. -.It Ic authenticate Ar yes | Ar no +command can be used to remove individual variables from the list, +while the +.Ic clearlist +command removes all variables from the +list. +.It Ic authenticate Cm yes | Cm no Normally .Nm -does not authenticate requests unless they are write requests. +does not authenticate requests unless +they are write requests. The command -.Dq Li authenticate yes +.Ql authenticate yes causes .Nm -to send authentication with all requests it makes. -Authenticated requests cause some servers -to handle requests slightly differently, -and can occasionally melt the CPU in fuzzballs if you turn -authentication on before doing a peer display. +to send authentication with all requests it +makes. +Authenticated requests causes some servers to handle +requests slightly differently, and can occasionally melt the CPU in +fuzzballs if you turn authentication on before doing a +.Ic peer +display. .It Ic cooked -Causes output from query commands to be -.Qq cooked Ns . -Variables -which are recognized by the server will have their values reformatted -for human consumption. +Causes output from query commands to be "cooked", so that +variables which are recognized by +.Nm +will have their +values reformatted for human consumption. Variables which .Nm -thinks should have a decodeable value but didn't are marked with a -trailing -.Qq ? Ns . -.It Ic debug Xo -.Ar more | Ar less | Ar off +thinks should have a decodable value but didn't are +marked with a trailing +.Ql \&? . +.It Xo Ic debug +.Cm more | +.Cm less | +.Cm off .Xc -Turn internal query program debugging on and off. +Turns internal query program debugging on and off. .It Ic delay Ar milliseconds -Specify a time interval to be added to timestamps included in requests -which require authentication. -This is used to enable (unreliable) server -reconfiguration over long delay network paths or between machines whose -clocks are unsynchronized. -Actually the server does not now require -timestamps in authenticated requests, +Specify a time interval to be added to timestamps included in +requests which require authentication. +This is used to enable +(unreliable) server reconfiguration over long delay network paths +or between machines whose clocks are unsynchronized. +Actually the +server does not now require timestamps in authenticated requests, so this command may be obsolete. .It Ic host Ar hostname Set the host to which future queries will be sent. -The -.Ar hostname -supplied -may be either a host name or a numeric -address. -.It Ic hostnames Ar yes | Ar no +Hostname may +be either a host name or a numeric address. +.It Ic hostnames Cm yes | Cm no If -.Ar yes -is specified, host names are printed in information -displays. +.Cm yes +is specified, host names are printed in +information displays. If -.Ar no -is given, numeric addresses are printed -instead. +.Cm no +is specified, numeric +addresses are printed instead. The default is -.Ar yes -unless modified using the command line +.Cm yes , +unless +modified using the command line .Fl n switch. .It Ic keyid Ar keyid -This command allows the specification of a key number to be used to -authenticate configuration requests. -This must correspond to a key -number the server has been configured to use for this purpose. -.It Ic ntpversion Xo -.Ar 1 | Ar 2 | -.Ar 3 | Ar 4 +This command allows the specification of a key number to be +used to authenticate configuration requests. +This must correspond +to a key number the server has been configured to use for this +purpose. +.It Xo Ic ntpversion +.Cm 1 | +.Cm 2 | +.Cm 3 | +.Cm 4 .Xc -Set the NTP version number which +Sets the NTP version number which .Nm -claims in packets. -Defaults to 3. -Note that mode 6 control messages -(and modes, for that matter) -didn't exist in NTP version 1. -There appear to be no servers left which demand version 1. +claims in +packets. +Defaults to 3, Note that mode 6 control messages (and +modes, for that matter) didn't exist in NTP version 1. +There appear +to be no servers left which demand version 1. .It Ic quit Exit .Nm . .It Ic passwd -This command prompts you to type in a password (which will not be -echoed) which will be used to authenticate configuration requests. -The -password must correspond to the key configured for use by the NTP server -for this purpose if such requests are to be successful. +This command prompts you to type in a password (which will not +be echoed) which will be used to authenticate configuration +requests. +The password must correspond to the key configured for +use by the NTP server for this purpose if such requests are to be +successful. .It Ic raw -Cause all output from query commands -to be printed as received from the remote server. -The only formatting and intepretation done on the data is to -transform non-ASCII data into a printable (but barely understandable) -form. +Causes all output from query commands is printed as received +from the remote server. +The only formating/interpretation done on +the data is to transform nonascii data into a printable (but barely +understandable) form. .It Ic timeout Ar milliseconds Specify a timeout period for responses to server queries. -The default -is about 5000 milliseconds. +The +default is about 5000 milliseconds. Note that since .Nm -retries each query once after a timeout, the total waiting time for a -timeout will be twice the timeout value set. +retries each query once after a timeout, the total waiting time for +a timeout will be twice the timeout value set. .El .Ss Control Message Commands -Each peer known to an NTP server has a 16 bit integer -association identifier -assigned to it. -NTP control messages which carry peer variables must -identify the peer the values correspond to by including its association -ID. -An association ID of 0 is special, and indicates the variables are -system variables, whose names are drawn from a separate name space. +Each peer known to an NTP server has a 16 bit integer association +identifier assigned to it. +NTP control messages which carry peer +variables must identify the peer the values correspond to by +including its association ID. +An association ID of 0 is special, +and indicates the variables are system variables, whose names are +drawn from a separate name space. .Pp -Control message commands result in one or more NTP mode 6 messages being -sent to the server, and cause the data returned to be printed in some -format. -Most commands currently implemented send a single message and -expect a single response. -The current exceptions are the -.Ic peers -command, -which will send a preprogrammed series of messages to obtain -the data it needs, and the -.Ic mreadlist -and -.Ic mreadvar -commands, which will iterate over a range of associations. +Control message commands result in one or more NTP mode 6 +messages being sent to the server, and cause the data returned to +be printed in some format. +Most commands currently implemented send +a single message and expect a single response. +The current +exceptions are the peers command, which will send a preprogrammed +series of messages to obtain the data it needs, and the mreadlist +and mreadvar commands, which will iterate over a range of +associations. .Bl -tag -width indent .It Ic associations -Obtains and prints a list of association identifiers and peer statuses -for in-spec peers of the server being queried. -The list is printed in columns. -The first of these is an index numbering the associations from -1 for internal use, the second the actual association identifier -returned by the server and the third the status word for the peer. +Obtains and prints a list of association identifiers and peer +statuses for in-spec peers of the server being queried. +The list is +printed in columns. +The first of these is an index numbering the +associations from 1 for internal use, the second the actual +association identifier returned by the server and the third the +status word for the peer. This is followed by a number of columns containing data decoded from the status word. -Note that the data returned by the +See the peers command +for a decode of the +.Sq condition +field. +Note that the data +returned by the .Ic associations -command is cached internally in -.Nm . -The index is then of use when dealing with stupid servers which use -association identifiers which are hard for humans to type, in that for -any subsequent commands which require an association identifier as an -argument, the form -.Dq Li &index -may be used as an alternative. -.\" -.\" XXX Both variable_name and value below should be arguments, -.\" not angle-quoted text. -.\" -.It Xo Ic clockvar -.Op Ar assocID Ns -.Pf [ Aq variable_name Ns -.Op = Ns Aq value Ns -.Op ,...] +command is cached internally +in +.Xr ntpq 8 . +The index is then of use when dealing with stupid +servers which use association identifiers which are hard for humans +to type, in that for any subsequent commands which require an +association identifier as an argument, the form and index may be +used as an alternative. +.It Xo Ic clockvar Op Ar assocID +.Oo +.Ar variable_name Ns Op = Ns Ar value ... +.Oc +.Ar ... .Xc -.It Xo Ic cv -.Op Ar assocID Ns -.Pf [ Aq variable_name Ns -.Op = Ns Aq value Ns -.Op ,...] +.It Xo Ic cv Op Ar assocID +.Oo +.Ar variable_name Ns Op = Ns Ar value ... +.Oc +.Ar ... .Xc Requests that a list of the server's clock variables be sent. -Servers which have a radio clock -or other external synchronization will respond positively to this. -If the association identifier is omitted or zero the -request is for the variables of the -.Qq system clock -and will -generally get a positive response from all servers with a clock. +Servers which have a radio clock or other external synchronization +will respond positively to this. +If the association identifier is +omitted or zero the request is for the variables of the +.Sq system clock +and will generally get a positive response from all +servers with a clock. If the server treats clocks as pseudo-peers, and hence can possibly have more than one clock connected at once, -referencing the appropriate peer association ID -will show the variables of a particular clock. -Omitting the variable list -will cause the server to return a default variable display. +referencing the appropriate peer association ID will show the +variables of a particular clock. +Omitting the variable list will +cause the server to return a default variable display. .It Ic lassociations -Obtains and prints a list of association identifiers and peer statuses -for all associations for which the server is maintaining state. +Obtains and prints a list of association identifiers and peer +statuses for all associations for which the server is maintaining +state. This command differs from the .Ic associations -command only for servers -which retain state for out-of-spec client associations -(i.e. fuzzballs). -Such associations are normally omitted from the display when -the +command +only for servers which retain state for out-of-spec client +associations (i.e., fuzzballs). +Such associations are normally +omitted from the display when the .Ic associations -command is used, but are included in the -output of -.Ic lassociations Ns . +command is +used, but are included in the output of +.Ic lassociations . .It Ic lpassociations Print data for all associations, including out-of-spec client associations, from the internally cached list of associations. -This command differs from +This +command differs from .Ic passociations -only when dealing with fuzzballs. +only when dealing with +fuzzballs. .It Ic lpeers -Like -.Ic peers , -except a summary of all associations for which the server is maintaining -state is printed. -This can produce a much longer list of peers from -fuzzball servers. -.It Ic mreadlist Ar assocID assocID -.It Ic mrl Ar assocID assocID +Like R peers, except a summary of all associations for which +the server is maintaining state is printed. +This can produce a much +longer list of peers from fuzzball servers. +.It Ic mreadlist Ar assocID Ar assocID +.It Ic mrl Ar assocID Ar assocID Like the .Ic readlist -command except the query is done for each of a range of (nonzero) -association IDs. -This range is determined from the association list -cached by the most recent +command, except the query is done +for each of a range of (nonzero) association IDs. +This range is +determined from the association list cached by the most recent .Ic associations command. -.It Xo Ic mreadvar -.Ar assocID assocID Oo -.Aq variable_name Ns -.Op = Ns Aq value Ns -.Op ,... Oc +.It Xo Ic mreadvar Ar assocID Ar assocID +.Oo +.Ar variable_name Ns Op = Ns Ar value ... +.Oc .Xc -.It Xo Ic mrv -.Ar assocID assocID Oo -.Aq variable_name Ns -.Op = Ns Aq value Ns -.Op ,... Oc +.It Xo Ic mrv Ar assocID Ar assocID +.Oo +.Ar variable_name Ns Op = Ns Ar value ... +.Oc .Xc Like the .Ic readvar -command except the query is done for each of a range of (nonzero) -association IDs. -This range is determined from the association list -cached by the most recent +command, except the query is done for +each of a range of (nonzero) association IDs. +This range is +determined from the association list cached by the most recent .Ic associations command. .It Ic opeers @@ -400,203 +411,334 @@ An old form of the .Ic peers command with the reference ID replaced by the local interface address. -.It Ic passociations -Print association data concerning in-spec peers from the internally -cached list of associations. -This command performs identically to the +.It Ic passocations +Displays association data concerning in-spec peers from the +internally cached list of associations. +This command performs +identically to the .Ic associations -except that it displays the internally stored -data rather than making a new query. +except that it displays +the internally stored data rather than making a new query. .It Ic peers -Obtains a list of in-spec peers of the server, along with a summary of -each peer's state. -Summary information includes the address of the -remote peer, the reference ID (0.0.0.0 if this is unknown), the -stratum of the remote peer, the type of the peer (local, unicast, -multicast or broadcast), when the last packet was received, the polling -interval, in seconds, the reachability register, in octal, and the -current estimated delay, offset and dispersion of the peer, all in -milliseconds. -.Pp -The character in the left margin indicates the fate of this peer in the -clock selection process. -Following is a list of these characters, -the pidgeon used in the +Obtains a current list peers of the server, along with a +summary of each peer's state. +Summary information includes the +address of the remote peer, the reference ID (0.0.0.0 if this is +unknown), the stratum of the remote peer, the type of the peer +(local, unicast, multicast or broadcast), when the last packet was +received, the polling interval, in seconds, the reachability +register, in octal, and the current estimated delay, offset and +dispersion of the peer, all in milliseconds. +The character in the left margin indicates the fate of this +peer in the clock selection process. +Following is a list of these +characters, the pigeon used in the .Ic rv -command, -and a short explanation of the condition revealed. +command, and a short +explanation of the condition revealed. .Bl -tag -width indent .It space .Pq reject -The peer is discarded as unreachable, -synchronized to this server (synch loop) -or outrageous synchronization distance. +The peer is discarded as unreachable, synchronized to this +server (synch loop) or outrageous synchronization distance. .It x .Pq falsetick -The peer is discarded by the intersection algorithm -as a falseticker. -.It . +The peer is discarded by the intersection algorithm as a +falseticker. +.It \&. .Pq excess -The peer is discarded as not among the first ten peers -sorted by synchronization distance -and so is probably a poor candidate for further consideration. -.It - +The peer is discarded as not among the first ten peers sorted +by synchronization distance and so is probably a poor candidate for +further consideration. +.It \&- .Pq outlyer -The peer is discarded by the clustering algorithm as an outlyer. -.It + -.Pq candidate -The peer is a survivor and a candidate for the combining algorithm. -.It # +The peer is discarded by the clustering algorithm as an +outlyer. +.It \&+ +.Pq candidat +The peer is a survivor and a candidate for the combining +algorithm. +.It \&# .Pq selected -The peer is a survivor, -but not among the first six peers sorted by synchronization distance. -If the association is ephemeral, +The peer is a survivor, but not among the first six peers +sorted by synchronization distance. +If the assocation is ephemeral, it may be demobilized to conserve resources. -.It * -.Pq sys.peer -The peer has been declared the system peer -and lends its variables to the system variables. +.It \&* +.Pq peer +The peer has been declared the system peer and lends its +variables to the system variables. .It o -.Pq pps.peer -The peer has been declared the system peer -and lends its variables to the system variables. -However, the actual system synchronization -is derived from a pulse-per-second (PPS) signal, -either indirectly via the PPS reference clock driver -or directly via kernel interface. +.Pq (pps.peer) +The peer has been declared the system peer and lends its +variables to thesystem variables. +However, the actual system +synchronization is derived from a pulse-per-second (PPS) signal, +either indirectly via the PPS reference clock driver or directly +via kernel interface. +.El .El .Pp -The flash variable is not defined in the NTP specification, -but is included as a valuable debugging aid. -It displays the results of the packet sanity checks -defined in the NTP specification TEST1 through TEST9. -The bits for each test read in increasing sequency -from the least significant bit -and are defined as follows. +The +.Va flash +variable is a valuable debugging aid. +It +displays the results of the original sanity checks defined in the +NTP specification RFC-1305 and additional ones added in NTP Version +4. +There are eleven tests called +.Sy TEST1 +through +.Sy TEST11 . +The tests are performed in a certain order +designed to gain maximum diagnostic information while protecting +against accidental or malicious errors. +The +.Va flash +variable +is first initialized to zero. +If after each set of tests one or +more bits are set, the packet is discarded. +.Pp +Tests +.Sy TEST4 +and +.Sy TEST5 +check the access +permissions and cryptographic message digest. +If any bits are set +after that, the packet is discarded. +Tests +.Sy TEST10 +and +.Sy TEST11 +check the authentication state using Autokey +public-key cryptography, as described in the +.Sx Authentication Options +section of +.Xr ntp.conf 5 . +If any bits are set +and the association has previously been marked reachable, the +packet is discarded; otherwise, the originate and receive +timestamps are saved, as required by the NTP protocol, and +processing continues. .Pp -The following TEST1 through TEST4 enumerate procedure errors. -The packet timestamps may or may not be believed, -but the remaining header data are ignored. +Tests +.Sy TEST1 +through +.Sy TEST3 +check the packet +timestamps from which the offset and delay are calculated. +If any +bits are set, the packet is discarded; otherwise, the packet header +variables are saved. +Tests +.Sy TEST6 +through +.Sy TEST8 +check the health of the server. +If any bits are set, the packet is +discarded; otherwise, the offset and delay relative to the server +are calculated and saved. +Test +.Sy TEST9 +checks the health of +the association itself. +If any bits are set, the packet is +discarded; otherwise, the saved variables are passed to the clock +filter and mitigation algorithms. +.Pp +The +.Va flash +bits for each test read in increasing order +from the least significant bit are defined as follows. .Bl -tag -width indent -.It TEST1 +.It Sy TEST1 Duplicate packet. -A copy from somewhere. -.It TEST2 +The packet is at best a casual retransmission +and at worst a malicious replay. +.It Sy TEST2 Bogus packet. -It is not a reply to a message previously sent. -This can happen when the NTP daemon is restarted -and before a peer notices. -.It TEST3 +The packet is not a reply to a message previously +sent. +This can happen when the NTP daemon is restarted and before +somebody else notices. +.It Sy TEST3 Unsynchronized. -One or more timestamp fields are missing. -This normally happens when the first packet from a peer is received. -.It TEST4 -Either peer delay or peer dispersion is greater than one second. -You must be joking. -.El -.Pp -The following TEST5 through TEST10 -enumerate errors in the packet header. -The packet is discarded without inspecting its contents. -.Bl -tag -width indent -.It TEST5 -Cryptographic authentication fails. +One or more timestamp fields are invalid. +This +normally happens when the first packet from a peer is +received. +.It Sy TEST4 +Access is denied. See the -.Qq Authentication Support -section of the -.Xr ntp.conf 5 +.Qq "Access Control" page. -.It TEST6 -Peer is unsynchronized. +.It Sy TEST5 +Cryptographic authentication fails. +See the +.Sx Authentication Options +section of +.Xr ntp.conf 5 . +.It Sy TEST6 +The server is unsynchronized. Wind up its clock first. -.It TEST7 -Peer stratum is greater than 15. -The peer is probably unsynchronized. -.It TEST8 -Either root delay or root dispersion is greater than one second. -Too far from home. -.It TEST9 -Peer cryptographic authentication fails. -Either the key identifier or key is wrong -or somebody trashed our packet. -.It TEST10 -Access is denied. +.It Sy TEST7 +The server stratum is at the maximum than 15. +It is probably +unsynchronized and its clock needs to be wound up. +.It Sy TEST8 +Either the root delay or dispersion is greater than one second, +which is highly unlikely unless the peer is synchronized to +Mars. +.It Sy TEST9 +Either the peer delay or dispersion is greater than one second, +which is higly unlikely unless the peer is on Mars. +.It Sy TEST10 +The autokey protocol has detected an authentication failure. See the -.Qq Access Control Support -section of the -.Xr ntp.conf 5 -page. +.Sx Authentication Options +section of +.Xr ntp.conf 5 . +.It Sy TEST11 +The autokey protocol has not verified the server or peer is +authentic and has valid public key credentials. +See the +.Sx Authentication Options +section of +.Xr ntp.conf 5 . +.El +.Pp +Additional system variables used by the NTP Version 4 Autokey +support include the following: +.Bl -tag -width indent +.It Ic certificate Ar filestamp +Shows the NTP seconds when the certificate file was +created. +.It Ic hostname Ar host +Shows the name of the host as returned by the Unix +.Xr gethostname 3 +library function. +.It Ic flags Ar hex +Shows the current flag bits, where the +.Ar hex +bits +are interpreted as follows: +.Bl -tag -width indent +.It 0x01 +autokey enabled +.It 0x02 +RSA public/private key files present +.It 0x04 +PKI certificate file present +.It 0x08 +Diffie-Hellman parameters file present +.It 0x10 +NIST leapseconds table file present .El +.It Ic leapseconds Ar filestamp +Shows the NTP seconds when the NIST leapseconds table file was +created. +.It Ic params Ar filestamp +Shows the NTP seconds when the Diffie-Hellman agreement +parameter file was created. +.It Ic publickey Ar filestamp +Shows the NTP seconds when the RSA public/private key files +were created. +.It Ic refresh Ar filestamp +Shows the NTP seconds when the public cryptographic values were +refreshed and signed. +.It Ic tai Ar offset +Shows the TAI-UTC offset in seconds obtained from the NIST +leapseconds table. +.El +.Pp +Additional peer variables used by the NTP Version 4 Autokey +support include the following: +.Bl -tag -width indent +.It Ic certificate Ar filestamp +Shows the NTP seconds when the certificate file was +created. +.It Ic flags Ar hex +Shows the current flag bits, where the +.Ar hex +bits are +interpreted as in the system variable of the same name. +The bits +are set in the first autokey message received from the server and +then reset as the associated data are obtained from the server and +stored. +.It Ic hcookie Ar hex +Shows the host cookie used in the key agreement algorithm. +.It Ic initkey Ar key +Shows the initial key used by the key list generator in the +autokey protocol. +.It Ic initsequence Ar index +Shows the initial index used by the key list generator in the +autokey protocol. +.It Ic pcookie Ar hex +Specifies the peer cookie used in the key agreement +algorithm. +.It Ic timestamp Ar time +Shows the NTP seconds when the last autokey key list was +generated and signed. .It Ic pstatus Ar assocID -Send a read status request to the server for the given association. -The names and values of the peer variables returned will be printed. -Note that the status word from the header is displayed preceding the -variables, both in hexadecimal and in pidgeon English. -.It Ic readlist Op Ar assocID -.It Ic rl Op Ar assocID -Requests that the values of the variables in the internal variable list -be returned by the server. -If the association ID is omitted or is 0 -the variables are assumed to be system variables. +Sends a read status request to the server for the given +association. +The names and values of the peer variables returned +will be printed. +Note that the status word from the header is +displayed preceding the variables, both in hexidecimal and in +pidgeon English. +.It Ic readlist Ar assocID +.It Ic rl Ar assocID +Requests that the values of the variables in the internal +variable list be returned by the server. +If the association ID is +omitted or is 0 the variables are assumed to be system variables. Otherwise they are treated as peer variables. -If the internal variable list is empty a request is -sent without data, which should induce the remote server to return a -default display. -.\" -.\" XXX Both variable_name and value below should be arguments, -.\" not angle-quoted text. -.\" -.It Xo Ic readvar -.Op Ar assocID Ns -.Pf [ Aq variable_name Ns -.Op = Ns Aq value Ns -.Op ,...] +If the internal +variable list is empty a request is sent without data, which should +induce the remote server to return a default display. +.It Xo Ic readvar Ar assocID +.Ar variable_name Ns Op = Ns Ar value +.Ar ... .Xc -.It Xo Ic rv -.Op Ar assocID Ns -.Pf [ Aq variable_name Ns -.Op = Ns Aq value Ns -.Op ,...] +.It Xo Ic rv Ar assocID +.Ar variable_name Ns Op = Ns Ar value +.Ar ... .Xc -Requests that the values of the specified variables be returned by the -server by sending a read variables request. -If the association ID is -omitted or is given as zero the variables are system variables, -otherwise they are peer variables and the values returned will be those -of the corresponding peer. -Omitting the variable list will send a -request with no data which should induce the server to return a default -display. -.It Xo Ic writevar -.Ar assocID -.Aq variable_name Ns -.Pf = Ns Aq value Ns -.Op ,... +Requests that the values of the specified variables be returned +by the server by sending a read variables request. +If the +association ID is omitted or is given as zero the variables are +system variables, otherwise they are peer variables and the values +returned will be those of the corresponding peer. +Omitting the +variable list will send a request with no data which should induce +the server to return a default display. +.It Xo Ic writevar Ar assocID +.Ar variable_name Ns Op = Ns Ar value +.Ar ... .Xc -Like the -.Ic readvar -request, except the specified variables are written instead of read. +Like the readvar request, except the specified variables are +written instead of read. .It Ic writelist Op Ar assocID -Like the -.Ic readlist -request, except the internal list variables are written instead of read. +Like the readlist request, except the internal list variables +are written instead of read. .El .Sh SEE ALSO .Xr ntp.conf 5 , .Xr ntpd 8 , .Xr ntpdc 8 -.Sh HISTORY -Written by -.An Dennis Ferguson -at the University of Toronto. .Sh BUGS The .Ic peers -command is non-atomic and may occasionally result in spurious error -messages about invalid associations occurring and terminating the -command. -The timeout time is a fixed constant, which means you wait a long time -for timeouts since it assumes sort of a worst case. -The program should -improve the timeout estimate as it sends queries to a particular host, -but doesn't. +command is non-atomic and may occasionally result in +spurious error messages about invalid associations occurring and +terminating the command. +The timeout time is a fixed constant, +which means you wait a long time for timeouts since it assumes sort +of a worst case. +The program should improve the timeout estimate as +it sends queries to a particular host, but doesn't. |