components/ntp/manpages/ntpq.1m
changeset 172 093198acf7d4
child 181 87e11e685b1f
equal deleted inserted replaced
171:dbff1afe6b31 172:093198acf7d4
       
     1 '\" te
       
     2 .\" CDDL HEADER START
       
     3 .\"
       
     4 .\" The contents of this file are subject to the terms of the
       
     5 .\" Common Development and Distribution License (the "License").
       
     6 .\" You may not use this file except in compliance with the License.
       
     7 .\"
       
     8 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
       
     9 .\" or http://www.opensolaris.org/os/licensing.
       
    10 .\" See the License for the specific language governing permissions
       
    11 .\" and limitations under the License.
       
    12 .\"
       
    13 .\" When distributing Covered Code, include this CDDL HEADER in each
       
    14 .\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
       
    15 .\" If applicable, add the following below this CDDL HEADER, with the
       
    16 .\" fields enclosed by brackets "[]" replaced with your own identifying
       
    17 .\" information: Portions Copyright [yyyy] [name of copyright owner]
       
    18 .\"
       
    19 .\" CDDL HEADER END
       
    20 .\"
       
    21 .\" Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
       
    22 .\"
       
    23 .TH "ntpq" "1M" "" "" "System Administration Commands"
       
    24 .SH NAME
       
    25 ntpq \- Network Time Protocol query program
       
    26 .SH SYNOPSIS
       
    27 .LP
       
    28 .n
       
    29 \fB/usr/sbin/ntpq\fR [\fB-46dpinv?!\fR] [\fB-c\fR \fIcommand\fR]
       
    30     [\fB-D\fR \fIdebuglvl\fR] [\fB-<\fR \fIoptfile\fR] [\fB->\fR \fIoptfile\fR]  [\fIhost\fR] [...]
       
    31 .fi
       
    32 .SH "DESCRIPTION"
       
    33 .LP
       
    34 The \fBntpq\fR utility program is used to monitor NTP daemon \fBntpd\fR operations and determine performance. It uses the standard NTP mode 6 control message formats defined in Appendix B of the NTPv3 specification RFC1305. The same formats are used in NTPv4, although some
       
    35 of the variables have changed and new ones added. The description on this page is for the NTPv4 variables.
       
    36 .LP
       
    37 The program can 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. The \fBntpq\fR utility can also obtain and print a list of peers in a common format by sending multiple queries to the server.
       
    38 .LP
       
    39 If one or more request options are included on the command line when \fBntpq\fR is executed, each of the requests will be sent to the NTP
       
    40 servers running on each of the hosts given as command line arguments, or on the localhost by default. If no request options are given, \fBntpq\fR 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. \fBntpq\fR will prompt for commands if the standard input is a terminal device.
       
    41 .LP
       
    42 The \fBntpq\fR utility 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. The \fBntpq\fR program makes one attempt to retransmit requests, and will time requests out if the remote host is not heard from within a suitable timeout time.
       
    43 .LP
       
    44 In contexts where a host name is expected, a \fB-4\fR qualifier preceding the host name forces DNS resolution to the IPv4 namespace, while a \fB-6\fR qualifier forces DNS resolution to the IPv6 namespace. On the command line, only one of the two  can be given.
       
    45 .LP
       
    46 For examples of usage of \fBntpq\fR, see the NTP Debugging Techniques page at file:///usr/share/doc/ntp/debug.html.
       
    47 .SH OPTIONS
       
    48 Specifying a command line option other than \fB-i\fR or \fB-n\fR
       
    49 will
       
    50 cause the specified query (queries) to be sent to the indicated
       
    51 host(s) immediately.
       
    52 Otherwise,
       
    53 \fBntpq\fR  
       
    54 will attempt to read
       
    55 interactive format commands from the standard input.
       
    56 .TP
       
    57 .BR \-4 ", " \-\-ipv4
       
    58 Force DNS resolution of following host names on the command line
       
    59 to the IPv4 namespace. Cannot be used with the \fB--ipv6\fR option.
       
    60 .TP
       
    61 .BR \-6 ", " \-\-ipv6
       
    62 Force DNS resolution of following host names on the command line
       
    63 to the IPv6 namespace. Cannot be used with the \fB--ipv4\fR option.
       
    64 .TP
       
    65 .BR \-c " \fIcmd\fP, " \-\-command "=" \fIcmd\fP
       
    66 The following argument is interpreted as an interactive format command
       
    67 and is added to the list of commands to be executed on the specified
       
    68 host(s).
       
    69 This option may appear an unlimited number of times. After all such 
       
    70 commands are executed against all listed hosts, the program exits.
       
    71 .TP
       
    72 .BR \-d ", " \-\-debug-level
       
    73 Increase output debug message level.
       
    74 This option may appear an unlimited number of times.
       
    75 .TP
       
    76 .BR \-D " \fInumber\fP, " \-\-set-debug-level "=" \fIstring\fP
       
    77 Set the output debug message level.
       
    78 This option may appear an unlimited number of times, but only the last
       
    79 one will be used.
       
    80 .TP
       
    81 .BR \-p ", " \-\-peers
       
    82 Print a list of the peers known to the server as well as a summary
       
    83 of their state. This is equivalent to the 'peers' interactive command.
       
    84 .TP
       
    85 .BR \-i ", " \-\-interactive
       
    86 Force ntpq to operate in interactive mode.  Prompts will be written
       
    87 to the standard output and commands read from the standard input.
       
    88 This option must not appear in combination with either the \fB--command\fR or 
       
    89 \fB--peers\fR options.
       
    90 .TP
       
    91 .BR \-n ", " \-\-numeric
       
    92 Output all host addresses in numeric format rather than
       
    93 converting to the host names. 
       
    94 .TP
       
    95 .BR \-? , " \-\-help"
       
    96 Display usage information and exit.
       
    97 .TP
       
    98 .BR \-! , " \-\-more-help"
       
    99 Extended usage information passed thru a pager.
       
   100 .TP
       
   101 .BR \-> " \fIrcfile\fP," " \-\-save-opts" "=\fIrcfile\fP"
       
   102 Save the option state to \fIrcfile\fP. 
       
   103 .TP
       
   104 .BR \-< " \fIrcfile\fP," " \-\-load-opts" "=\fIrcfile\fP," " \-\-no-load-opts"
       
   105 Load options from \fIrcfile\fP.
       
   106 The \fIno-load-opts\fP form will disable the loading
       
   107 of earlier RC/INI files.  \fI--no-load-opts\fP is handled early,
       
   108 out of order.
       
   109 .TP
       
   110 .BR \-v ", " \-\-version
       
   111 Output version of program and exit.
       
   112 .SS OPTION PRESETS
       
   113 Most options may be preset by loading values from configuration file(s) and values from
       
   114 environment variables named:
       
   115 .nf
       
   116   \fBNTPQ_<option-name>\fP or \fBNTPQ\fP
       
   117 .fi
       
   118 .aj
       
   119 The environmental presets take precedence (are processed later than)
       
   120 the configuration files. The option-name should be in all capital letters.
       
   121 For example, to set the --command option, you would set the NTPQ_COMMAND environment
       
   122 variable.
       
   123 The users home directory and the current directory are searched for a file named .ntprc.
       
   124 .SH USAGE
       
   125 Interactive format commands consist of a keyword followed by zero
       
   126 to four arguments.
       
   127 Only enough characters of the full keyword to uniquely identify the command need be typed.  
       
   128 The output of a command is normally sent to the standard output, but optionally the output of 
       
   129 individual commands may be sent to a file by appending a \fB>\fR, followed by a file name, to the command line.
       
   130 .SS "Internal Commands"
       
   131 A number of interactive commands are executed entirely within
       
   132 the \fBntpq\fR
       
   133 utility itself and do not result in requests being sent to a server. These commands are as follows:
       
   134 
       
   135 
       
   136                                                                     
       
   137                                                                     
       
   138                                                                     
       
   139 cl                                                                  
       
   140                                                                     
       
   141 clocklist                                                           
       
   142                                                    timeout          
       
   143                                                    version          
       
   144                                   poll                              
       
   145                                                                     
       
   146                                                    
       
   147                                            
       
   148 
       
   149 
       
   150 .TP
       
   151 .BR ? " [\fIcommand_keyword\fP]," "  help "[\fIcommand_keyword\fP]
       
   152 Prints a list of all the command keywords known to \fBntpq\fR. Followed by a command keyword will print function and usage
       
   153 information about the command.
       
   154 .TP 
       
   155 .BR addvars " \fIvariable_name\fP[=\fIvalue\fP]" "  ...
       
   156 .TP 
       
   157 .BR "rmvars \fIvariable_name\fP ..."
       
   158 .TP 
       
   159 .BR showvars
       
   160 .TP
       
   161 .BR "clearvars"
       
   162 The data carried by NTP mode 6 messages consists of a list of
       
   163 items of the form \fIvariable_name=value\fP. In requests to read variable, the \fI=value\fP is ignored, and can be omitted.
       
   164 The \fBntpq\fR utility maintains an internal list in which data to be included in control
       
   165 messages can be assembled, and sent using the \fBreadlist\fP and \fBwritelist\fP
       
   166 commands described below.
       
   167 The \fBaddvars\fP command allows variables and their optional values to be added to
       
   168 the list.
       
   169 If more than one variable is to be added, the list should
       
   170 be comma-separated and not contain white space. The \fBshowvars\fP command lists the
       
   171 current variable list.
       
   172 The \fBrmvars\fP command can be used to remove individual variables from the list,
       
   173 while the \fBclearlist\fP command removes all variables from the
       
   174 list.
       
   175 .TP 
       
   176 .BR "authenticate [ yes | no ]"
       
   177 Normally
       
   178 \fBntpq\fR
       
   179 only sends authentication with  write requests.
       
   180 The command \fBauthenticate yes\fP causes
       
   181 \fBntpq\fR
       
   182 to send authentication with all requests it
       
   183 makes.  The command \fBauthenticate\fP with no keyword
       
   184 causes
       
   185 \fBntpq\fR
       
   186 to display whether or not
       
   187 \fBntpq\fR
       
   188 is currently authenticating requests.
       
   189 .TP
       
   190 .BR ":config \fIconfig_command\fP"
       
   191 Sends the entire line after \fB:config\fP to the \fBntpd\fP daemon to be interpreted as a configuration file 
       
   192 command. Multiple commands may be separated by semi-colons.
       
   193 .TP
       
   194 .BR "config-from-file \fIconfig_file\fP"
       
   195 Sends the entire file \fIconfig_file\fP to the \fBntpd\fP daemon to be interpreted as configuration file 
       
   196 commands.
       
   197 .TP
       
   198 .BR cooked
       
   199 Causes output from query commands to be "cooked", so that
       
   200 variables which are recognized by
       
   201 \fBntpq\fR
       
   202 will have their
       
   203 values reformatted for human consumption.
       
   204 Variables which
       
   205 \fBntpq\fR
       
   206 thinks should have a decodable value but didn't are
       
   207 marked with a trailing ?.
       
   208 .TP
       
   209 .BR "debug [ more | less | off ]"
       
   210 With no argument, displays the current debug level.
       
   211 Otherwise, the debug level is changed by the indicated amount.
       
   212 .TP
       
   213 .BR delay " \fImilliseconds\fP"
       
   214 Specify a time interval to be added to timestamps included in
       
   215 requests which require authentication.
       
   216 This is used to enable
       
   217 (unreliable) server reconfiguration over long delay network paths
       
   218 or between machines whose clocks are unsynchronized.
       
   219 Actually the
       
   220 server does not now require timestamps in authenticated requests,
       
   221 so this command may be obsolete.
       
   222 .TP
       
   223 .BR "host [ [ -4 | -6 ] \fIhostname\fP ]"
       
   224 Set the host to which future queries will be sent.
       
   225 The hostname may
       
   226 be either a host name or a numeric address. With no argument, prints the 
       
   227 current host.
       
   228 .TP
       
   229 .BR "hostnames [ yes | no ]"
       
   230 If yes is specified, host names are printed in
       
   231 information displays.  If no is specified, numeric
       
   232 addresses are printed instead. With no argument, prints the current
       
   233 setting.  The default is yes, unless modified using the command line
       
   234 \-n switch.
       
   235 .TP
       
   236 .BR "keyid [ \fIkeyid#\fP ]"
       
   237 This command specifies the key number to be
       
   238 used to authenticate configuration requests.  This must correspond
       
   239 to a key number the server has been configured to use for this
       
   240 purpose.
       
   241 .TP
       
   242 .BR "keytype [ md5 ]"
       
   243 Prints or sets the type of key used for authentication. Currently
       
   244 only \fBmd5\fP is accepted.
       
   245 .TP
       
   246 .BR "ntpversion [ 1 | 2 | 3 | 4 ]"
       
   247 Sets the NTP version number which
       
   248 \fBntpq\fR
       
   249 claims in packets.
       
   250 Defaults to 2. Note that mode 6 control messages 
       
   251 didn't exist in NTP version 1.
       
   252 Luckily there appear
       
   253 to be no servers left which demand version 1.
       
   254 With no argument, displays the current NTP version that will be used
       
   255 when communicating with servers.
       
   256 .TP
       
   257 .BR "passwd"
       
   258 This command prompts you to type in a password (which will not
       
   259 be echoed) which will be used to authenticate configuration
       
   260 requests.
       
   261 The password must correspond to the key configured for
       
   262 use by the NTP server for this purpose.
       
   263 .TP
       
   264 .BR "quit"
       
   265 Exit
       
   266 \fBntpq\fR .
       
   267 .TP
       
   268 .BR "raw"
       
   269 Causes all output from query commands is printed as received
       
   270 from the remote server.
       
   271 The only formating/interpretation done on
       
   272 the data is to transform nonascii data into a printable (but barely
       
   273 understandable) form.
       
   274 .TP
       
   275 .BR "timeout \fImilliseconds\fP"
       
   276 Specify a timeout period for responses to server queries.
       
   277 The default is about 5000 milliseconds.
       
   278 Note that since
       
   279 \fBntpq\fR
       
   280 retries each query once after a timeout, the total waiting time for
       
   281 a timeout will be twice the timeout value set.
       
   282 .SS "Control Message Commands"
       
   283 Each association known to an NTP server has a 16 bit integer association identifier. 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.
       
   284 .LP
       
   285 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.
       
   286 .TP
       
   287 .BR associations
       
   288 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. See the peers command for a decode of the \fBcondition\fR field. The data returned by the \fBassociations\fR command is cached internally in \fBntpq\fR and used in subsequent commands.  After the first \fBassociations\fP command the index can be used in place of the association identifier by specifing the identifier in the form &\fIindex\fP.
       
   289 .TP
       
   290 .BR "clocklist [\fIassocID\fP]"
       
   291 .TP
       
   292 .BR "cl  [\fIassocID\fP]"
       
   293 Read the values of the clock variables included in the variable list
       
   294 .TP
       
   295 .BR "clockvar [\fIassocID\fP] [\fIvariable_name\fP [ = \fIvalue\fP [...]] [...]"
       
   296 .TP
       
   297 .BR "cv [\fIassocID\fP] [\fIvariable_name\fP [ = \fIvalue\fP [...] ][...]"
       
   298 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 \fBsystem clock\fR 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.
       
   299 .TP
       
   300 .BR lassociations
       
   301 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 \fBassociations\fR 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 \fBassociations\fR command is used, but are included in the output of \fBlassociations\fR. When used with the \fBntpd\fP in this distribution, this command is idenitical to \fBassociations\fP. 
       
   302 .TP
       
   303 .BR lpassociations
       
   304 Print data for all associations, including out-of-spec client associations, from the internally cached list of associations.
       
   305 .TP
       
   306 .BR lopeers
       
   307 Same as \fBopeers\fP but from the internally cached data.
       
   308 .TP
       
   309 .BR lpeers
       
   310 Like \fBpeers\fP, 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, but for most servers this is identical with \fBpeers\fP.
       
   311 .TP
       
   312 .BR "mreadlist \fIassocID\fP \fIassocID\fP"
       
   313 .TP
       
   314 .BR "mrl \fIassocID\fP \fIassocID\fP"
       
   315 Like the \fBreadlist\fR 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 \fBassociations\fR command. An \fIassocID\fPs may be either an association identify or the equivilant &\fIindex\fP form.
       
   316 .TP
       
   317 .BR "mreadvar \fIassocID\fP \fIassocID\fP [ \fIvariable_name\fP [ = \fIvalue\fP[ ... ]"
       
   318 .TP
       
   319 .BR "mrv \fIassocID\fP \fIassocID\fP [ \fIvariable_name\fP [ = \fIvalue\fP[ ... ]"
       
   320 Like the \fBreadvar\fR 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 \fBassociations\fR command.
       
   321 .TP
       
   322 .BR opeers
       
   323 An old form of the \fBpeers\fR command with the reference ID replaced by the local interface address.
       
   324 .TP
       
   325 .BR passociations
       
   326 Displays association data concerning in-spec peers from the internally cached list of associations. This command performs identically to the \fBassociations\fR except that it displays the internally stored data rather than making a new query.
       
   327 .TP
       
   328 .BR peers
       
   329 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 at the left margin of each line shows the synchronization status of the association and is a valuable diagnostic tool. The encoding and meaning of this character, called the tally code, is given later in this page.
       
   330 .TP
       
   331 .BR "pstatus \fIassocID\fP"
       
   332 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 hexadecimal and in pidgeon English.
       
   333 .TP
       
   334 .BR "readlist [ \fIassocID\fP ]
       
   335 .TP
       
   336 .BR "rl [ \fIassocID\fP ]"
       
   337 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.
       
   338 .TP
       
   339 .BR "readvar \fIassocID\fP \fIvariable_name\fP [ = \fIvalue\fP ] [ ...]"
       
   340 .TP
       
   341 .BR "rv \fIassocID\fP [ \fIvariable_name\fP [ = \fIvalue\fP ] [...]"
       
   342 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. The encoding and meaning of the variables derived from NTPv3 is given in RFC-1305; the encoding and meaning of the additional NTPv4 variables are given later in this page.
       
   343 .TP
       
   344 .BR "writevar \fIassocID\fP \fIvariable_name\fP [ = \fIvalue\fP [ ...]"
       
   345 Like the readvar request, except the specified variables are written instead of read.
       
   346 .TP
       
   347 .BR "writelist [ \fIassocID\fP ]"
       
   348 Like the readlist request, except the internal list variables are written instead of read.
       
   349 .SS "Tally Codes"
       
   350 .LP
       
   351 The character in the left margin in the \fBpeers\fR billboard, called the tally code, shows the fate of each association in the clock selection process. Following is a list of these characters, the pidgeon used in the \fBrv\fR command, and a short explanation of the condition revealed.
       
   352 .TP
       
   353 .BR "space \fRreject\fP"
       
   354 The peer is discarded as unreachable, synchronized to this server (synch loop) or outrageous synchronization distance.
       
   355 .TP
       
   356 .BR "x \fRfalseticker\fP"
       
   357 The peer is discarded by the intersection algorithm as a falseticker.
       
   358 .TP
       
   359 .BR ". \fRexcess\fP"
       
   360 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.
       
   361 .TP
       
   362 .BR "- \fRoutlyer\fP"
       
   363 The peer is discarded by the clustering algorithm as an outlyer.
       
   364 .TP
       
   365 .BR "+ \fRcandidate\fP"
       
   366 The peer is a survivor and a candidate for the combining algorithm.
       
   367 .TP
       
   368 .BR "# \fRselected\fP"
       
   369 The peer is a survivor, but not among the first six peers sorted by synchronization distance. If the association is ephemeral, it may be demobilized to conserve resources.
       
   370 .TP
       
   371 .BR "* \fRsys.peer\fP"
       
   372 The peer has been declared the system peer and lends its variables to the system variables.
       
   373 .TP
       
   374 .BR "o \fRpps.peer\fP"
       
   375 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.
       
   376 .SS "System Variables"
       
   377 .LP
       
   378 The \fBstatus, leap, stratum, precision, rootdelay, rootdispersion, refid, reftime, poll, offset, and frequency\fR variables are described in RFC-1305 specification. Additional NTPv4 system variables include the following:
       
   379 .TP
       
   380 .BR "version"
       
   381 Everything you might need to know about the software version and generation time.
       
   382 .TP
       
   383 .BR "processor"
       
   384 The processor and kernel identification string.
       
   385 .TP
       
   386 .BR "system"
       
   387 The operating system version and release identifier.
       
   388 .TP
       
   389 .BR "state"
       
   390 The state of the clock discipline state machine. The values are described in the architecture briefing on the NTP Project page linked from www.ntp.org.
       
   391 .TP
       
   392 .BR "peer"
       
   393 The internal integer used to identify the association currently designated the system peer.
       
   394 .TP
       
   395 .BR "jitter"
       
   396 The estimated time error of the system clock measured as an exponential average of RMS time differences.
       
   397 .TP
       
   398 .BR "stability"
       
   399 The estimated frequency stability of the system clock measured as an exponential average of RMS frequency differences.
       
   400 .LP
       
   401 In addition, some or all of the following system variables related to the crypto authentication are displayed, depending on the state of the particular crypto dance in use:
       
   402 .TP
       
   403 .BR "hostname"
       
   404 The name of the host as returned by the Unix \fBgethostname()\fR library function.
       
   405 .TP
       
   406 .BR "hostkey"
       
   407 The NTP filestamp of the host key file.
       
   408 .TP
       
   409 .BR "flags"
       
   410 The current flags word bits and message digest algorithm identifier (NID) in hex format. The high order 16 bits of the four-byte word contain the NID from the OpenSSL ligrary, while the low-order bits are interpreted as follows:
       
   411 0x01: autokey enabled, 0x02: NIST leapseconds file loaded, 0x10: PC identity scheme, 0x20: IFF identity scheme, 0x40: GQ identity scheme. 
       
   412 .TP
       
   413 .BR "cert"
       
   414 A list of certificates held by the host. Each entry includes the subject, issuer, flags and NTP filestamp in order. The bits are interpreted as follows:
       
   415 0x01: signed by the server, 0x02: trusted, 0x04: private, 0x08: contains errors and is not trusted.
       
   416 .TP
       
   417 .BR "leapseconds"
       
   418 The NTP filestamp of the NIST leapseconds file.
       
   419 .TP
       
   420 .BR "refresh"
       
   421 The NTP timestamp when the host public cryptographic values were refreshed and signed.
       
   422 .TP
       
   423 .BR "signature"
       
   424 The host digest/signature scheme name from the OpenSSL library.
       
   425 .TP
       
   426 .BR "tai"
       
   427 The TAI-UTC offset in seconds obtained from the NIST leapseconds table.
       
   428 .SS "Peer Variables"
       
   429 .LP
       
   430 The \fBstatus, srcadr, srcport, dstadr, dstport, leap, stratum, precision, rootdelay, rootdispersion, readh, hmode, pmode, hpoll, ppoll, offset, delay, dspersion, reftime\fR variables are described in the RFC-1305 specification, as are the timestamps \fBorg, rec and xmt\fR. Additional NTPv4 system variables include the following.
       
   431 .TP
       
   432 .BR "flash"
       
   433 The flash code for the most recent packet received. The encoding and meaning of these codes is given later in this page.
       
   434 .TP
       
   435 .BR "jitter"
       
   436 The estimated time error of the peer clock measured as an exponential average of RMS time differences.
       
   437 .TP
       
   438 .BR "unreach"
       
   439 The value of the counter which records the number of poll intervals since the last valid packet was received.
       
   440 .LP
       
   441 In addition, some or all of the following  peer variables are displayed related to the crypto auithentication:
       
   442 .TP
       
   443 .BR "flags"
       
   444 The current flag bits. This word is the server host status word with additional bits used by the Autokey state machine. See the source code for the bit encoding.
       
   445 .TP
       
   446 .BR "hostname"
       
   447 The server host name.
       
   448 .TP
       
   449 .BR "initkey \fIkey\fP"
       
   450 The initial key used by the key list generator in the Autokey protocol.
       
   451 .TP
       
   452 .BR "initsequence \fIindex\fP"
       
   453 The initial index used by the key list generator in the Autokey protocol.
       
   454 .TP
       
   455 .BR "signature"
       
   456 The server message digest/signature scheme name from the OpenSSL software library.
       
   457 .TP
       
   458 .BR "timestamp \fItime\fP"
       
   459 The NTP timestamp when the last Autokey key list was generated and signed.
       
   460 .SS "Flash Codes"
       
   461 .LP
       
   462 The \fBflash\fR code is a valuable debugging aid displayed in the peer variables list. It shows the results of the original sanity checks defined in the NTP specification RFC-1305 and additional ones added in NTPv4. There are 12 tests designated \fBTEST1\fR through \fBTEST12\fR. The tests are performed in a certain order designed to gain maximum diagnostic information while protecting against accidental or malicious errors. The \fBflash\fR variable is initialized to zero as each packet is received. If after each set of tests one or more bits are set, the packet is discarded.
       
   463 .LP
       
   464 Tests \fBTEST1\fR through \fBTEST3\fR 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. \fBTEST4\fR and \fBTEST5\fR are associated with access control and cryptographic authentication. If any bits are set, the packet is discarded immediately with nothing changed.
       
   465 .LP
       
   466 Tests \fBTEST6\fR through \fBTEST8\fR 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. \fBTEST9\fR 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.
       
   467 .LP
       
   468 Tests \fBTEST10\fR through \fBTEST12\fR check the authentication state using Autokey public-key cryptography, as described in the Authentication Options page at file:///usr/share/doc/ntp/authopt.html. 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.
       
   469 .LP
       
   470 The \fBflash\fR bits for each test are defined as follows.
       
   471 .TP
       
   472 .BR "0x001 TEST1"
       
   473 Duplicate packet. The packet is at best a casual retransmission and at worst a malicious replay.
       
   474 .TP
       
   475 .BR "0x002 TEST2"
       
   476 Bogus packet. 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.
       
   477 .TP
       
   478 .BR "0x004 TEST3"
       
   479 Unsynchronized. One or more timestamp fields are invalid. This normally happens when the first packet from a peer is received.
       
   480 .TP
       
   481 .BR "0x008 TEST4"
       
   482 Access is denied. See the Access Control Options page at file:///usr/share/doc/ntp/accopt.html.
       
   483 .TP
       
   484 .BR "0x010 TEST5"
       
   485 Cryptographic authentication fails. See the Authentication Options page referenced above.
       
   486 .TP
       
   487 .BR "0x020TEST6"
       
   488 The server is unsynchronized. Wind up its clock first.
       
   489 .TP
       
   490 .BR "0x040 TEST7"
       
   491 The server stratum is at the maximum of 15. It is probably unsynchronized and its clock needs to be wound up.
       
   492 .TP
       
   493 .BR "0x080 TEST8"
       
   494 Either the root delay or dispersion is greater than one second, which is highly unlikely unless the peer is unsynchronized to Mars.
       
   495 .TP
       
   496 .BR "0x100 TEST9"
       
   497 Either the peer delay or dispersion is greater than one second, which is higly unlikely unless the peer is on Mars.
       
   498 .TP
       
   499 .BR "0x200 TEST10"
       
   500 The autokey protocol has detected an authentication failure. See the Authentication Options page.
       
   501 .TP
       
   502 .BR "0x400 TEST11"
       
   503 The autokey protocol has not verified the server or peer is proventic and has valid public key credentials. See the Authentication Options page.
       
   504 .TP
       
   505 .BR "0x800 TEST12"
       
   506 A protocol or configuration error has occurred in the public key algorithms or a possible intrusion event has been detected. See the Authentication Options page.
       
   507 .SH NOTES
       
   508 .LP
       
   509 Source for \fBntpq\fR is available on http://src.opensolaris.org.
       
   510 .LP
       
   511 The documentation available at /usr/share/doc/ntp is provided as is from the
       
   512 \fBNTP\fR distribution and may contain information that is not applicable to
       
   513 the software as provided in this partIcular distribution.
       
   514 .LP
       
   515 The output of the \fBntpq\P in version 4 differs from that in version 3 by the 
       
   516 replacement of the \fBdispersion\fP value with the \fBjitter\fP value in the
       
   517 \fBpeers\fP output.
       
   518 .SH ATTRIBUTES
       
   519 See
       
   520 .BR attributes (5)
       
   521 for descriptions of the following attributes:
       
   522 .sp
       
   523 .TS
       
   524 tab() box;
       
   525 cw(2.75i) |cw(2.75i)
       
   526 lw(2.75i) |lw(2.75i)
       
   527 .
       
   528 ATTRIBUTE TYPEATTRIBUTE VALUE
       
   529 _
       
   530 Availabilityservice/network/ntp
       
   531 =
       
   532 Interface StabilityUncommitted
       
   533 .TE
       
   534 .PP
       
   535 .SH SEE ALSO
       
   536 .LP
       
   537 \fBntpd\fR(1M), \fBntpdc\fR(1M), \fBntprc\fR(4), \fBattributes\fR(5)