]> CyberLeo.Net >> Repos - FreeBSD/releng/10.3.git/blob - contrib/ntp/ntpq/invoke-ntpq.texi
Fix multiple vulnerabilities in ntp. [SA-18:02.ntp]
[FreeBSD/releng/10.3.git] / contrib / ntp / ntpq / invoke-ntpq.texi
1 @node ntpq Invocation
2 @section Invoking ntpq
3 @pindex ntpq
4 @cindex standard NTP query program
5 @ignore
6 #
7 # EDIT THIS FILE WITH CAUTION  (invoke-ntpq.texi)
8 #
9 # It has been AutoGen-ed  February 27, 2018 at 05:15:26 PM by AutoGen 5.18.5
10 # From the definitions    ntpq-opts.def
11 # and the template file   agtexi-cmd.tpl
12 @end ignore
13
14
15 The
16 @code{ntpq}
17 utility program is used to query NTP servers to monitor NTP operations
18 and performance, requesting
19 information about current state and/or changes in that state.
20 The program may be run either in interactive mode or controlled using
21 command line arguments.
22 Requests to read and write arbitrary
23 variables can be assembled, with raw and pretty-printed output
24 options being available.
25 The
26 @code{ntpq}
27 utility can also obtain and print a
28 list of peers in a common format by sending multiple queries to the
29 server.
30
31 If one or more request options is included on the command line
32 when
33 @code{ntpq}
34 is executed, each of the requests will be sent
35 to the NTP servers running on each of the hosts given as command
36 line arguments, or on localhost by default.
37 If no request options
38 are given,
39 @code{ntpq}
40 will attempt to read commands from the
41 standard input and execute these on the NTP server running on the
42 first host given on the command line, again defaulting to localhost
43 when no other host is specified.
44 The
45 @code{ntpq}
46 utility will prompt for
47 commands if the standard input is a terminal device.
48
49 @code{ntpq}
50 uses NTP mode 6 packets to communicate with the
51 NTP server, and hence can be used to query any compatible server on
52 the network which permits it.
53 Note that since NTP is a UDP protocol
54 this communication will be somewhat unreliable, especially over
55 large distances in terms of network topology.
56 The
57 @code{ntpq}
58 utility makes
59 one attempt to retransmit requests, and will time requests out if
60 the remote host is not heard from within a suitable timeout
61 time.
62
63 Note that in contexts where a host name is expected, a
64 @code{-4}
65 qualifier preceding the host name forces resolution to the IPv4
66 namespace, while a
67 @code{-6}
68 qualifier forces resolution to the IPv6 namespace.
69 For examples and usage, see the
70 @quotedblleft{}NTP Debugging Techniques@quotedblright{}
71 page.
72
73 Specifying a
74 command line option other than
75 @code{-i}
76 or
77 @code{-n}
78 will
79 cause the specified query (queries) to be sent to the indicated
80 host(s) immediately.
81 Otherwise,
82 @code{ntpq}
83 will attempt to read
84 interactive format commands from the standard input.
85
86 @subsubsection Internal Commands
87
88 Interactive format commands consist of a keyword followed by zero
89 to four arguments.
90 Only enough characters of the full keyword to
91 uniquely identify the command need be typed.
92
93 A
94 number of interactive format commands are executed entirely within
95 the
96 @code{ntpq}
97 utility itself and do not result in NTP
98 requests being sent to a server.
99 These are described following.
100 @table @asis
101 @item @code{?} @code{[@kbd{command}]}
102 @item @code{help} @code{[@kbd{command}]}
103 A
104 @quoteleft{}?@quoteright{}
105 by itself will print a list of all the commands
106 known to
107 @code{ntpq}
108 A
109 @quoteleft{}?@quoteright{}
110 followed by a command name will print function and usage
111 information about the command.
112 @item @code{addvars} @kbd{name}@code{[=@kbd{value}]}@code{[,...]}
113 @item @code{rmvars} @kbd{name}@code{[,...]}
114 @item @code{clearvars}
115 @item @code{showvars}
116 The arguments to this command consist of a list of
117 items of the form
118 @kbd{name}@code{[=@kbd{value}]},
119 where the
120 .No = Ns Ar value
121 is ignored, and can be omitted,
122 in requests to the server to read variables.
123 The
124 @code{ntpq}
125 utility maintains an internal list in which data to be included in
126 messages can be assembled, and displayed or set using the
127 @code{readlist}
128 and
129 @code{writelist}
130 commands described below.
131 The
132 @code{addvars}
133 command allows variables and their optional values to be added to
134 the list.
135 If more than one variable is to be added, the list should
136 be comma-separated and not contain white space.
137 The
138 @code{rmvars}
139 command can be used to remove individual variables from the list,
140 while the
141 @code{clearvars}
142 command removes all variables from the
143 list.
144 The
145 @code{showvars}
146 command displays the current list of optional variables.
147 @item @code{authenticate} @code{[@code{yes}|@code{no}]}
148 Normally
149 @code{ntpq}
150 does not authenticate requests unless
151 they are write requests.
152 The command
153 @code{authenticate} @code{yes}
154 causes
155 @code{ntpq}
156 to send authentication with all requests it
157 makes.
158 Authenticated requests causes some servers to handle
159 requests slightly differently.
160 The command
161 @code{authenticate}
162 causes
163 @code{ntpq}
164 to display whether or not
165 it is currently authenticating requests.
166 @item @code{cooked}
167 Causes output from query commands to be "cooked", so that
168 variables which are recognized by
169 @code{ntpq}
170 will have their
171 values reformatted for human consumption.
172 Variables which
173 @code{ntpq}
174 could not decode completely are
175 marked with a trailing
176 @quoteleft{}?@quoteright{}.
177 @item @code{debug} @code{[@code{more}|@code{less}|@code{off}]}
178 With no argument, displays the current debug level.
179 Otherwise, the debugging level is changed as indicated.
180 @item @code{delay} @code{[@kbd{milliseconds}]}
181 Specify a time interval to be added to timestamps included in
182 requests which require authentication.
183 This is used to enable
184 (unreliable) server reconfiguration over long delay network paths
185 or between machines whose clocks are unsynchronized.
186 Actually the
187 server does not now require timestamps in authenticated requests,
188 so this command may be obsolete.
189 Without any arguments, displays the current delay.
190 @item @code{drefid} @code{[@code{hash}|@code{ipv4}]}
191 Display refids as IPv4 or hash.
192 Without any arguments, displays whether refids are shown as IPv4
193 addresses or hashes.
194 @item @code{exit}
195 Exit
196 @code{ntpq}
197 @item @code{host} @code{[@kbd{name}]}
198 Set the host to which future queries will be sent.
199 The
200 @kbd{name}
201 may be either a host name or a numeric address.
202 Without any arguments, displays the current host.
203 @item @code{hostnames} @code{[@code{yes}|@code{no}]}
204 If
205 @code{yes}
206 is specified, host names are printed in
207 information displays.
208 If
209 @code{no}
210 is specified, numeric
211 addresses are printed instead.
212 The default is
213 @code{yes},
214 unless
215 modified using the command line
216 @code{-n}
217 switch.
218 Without any arguments, displays whether host names or numeric addresses
219 are shown.
220 @item @code{keyid} @code{[@kbd{keyid}]}
221 This command allows the specification of a key number to be
222 used to authenticate configuration requests.
223 This must correspond
224 to the
225 @code{controlkey}
226 key number the server has been configured to use for this
227 purpose.
228 Without any arguments, displays the current
229 @kbd{keyid}.
230 @item @code{keytype} @code{[@kbd{digest}]}
231 Specify the digest algorithm to use for authenticating requests, with default
232 @code{MD5}.
233 If
234 @code{ntpq}
235 was built with OpenSSL support, and OpenSSL is installed,
236 @kbd{digest}
237 can be any message digest algorithm supported by OpenSSL.
238 If no argument is given, the current
239 @code{keytype} @kbd{digest}
240 algorithm used is displayed.
241 @item @code{ntpversion} @code{[@code{1}|@code{2}|@code{3}|@code{4}]}
242 Sets the NTP version number which
243 @code{ntpq}
244 claims in
245 packets.
246 Defaults to 3, and note that mode 6 control messages (and
247 modes, for that matter) didn't exist in NTP version 1.
248 There appear
249 to be no servers left which demand version 1.
250 With no argument, displays the current NTP version that will be used
251 when communicating with servers.
252 @item @code{passwd}
253 This command prompts you to type in a password (which will not
254 be echoed) which will be used to authenticate configuration
255 requests.
256 The password must correspond to the key configured for
257 use by the NTP server for this purpose if such requests are to be
258 successful.
259 @item @code{poll} @code{[@kbd{n}]} @code{[@code{verbose}]}
260 Poll an NTP server in client mode
261 @kbd{n}
262 times.
263 Poll not implemented yet.
264 @item @code{quit}
265 Exit
266 @code{ntpq}
267 @item @code{raw}
268 Causes all output from query commands is printed as received
269 from the remote server.
270 The only formating/interpretation done on
271 the data is to transform nonascii data into a printable (but barely
272 understandable) form.
273 @item @code{timeout} @code{[@kbd{milliseconds}]}
274 Specify a timeout period for responses to server queries.
275 The
276 default is about 5000 milliseconds.
277 Without any arguments, displays the current timeout period.
278 Note that since
279 @code{ntpq}
280 retries each query once after a timeout, the total waiting time for
281 a timeout will be twice the timeout value set.
282 @item @code{version}
283 Display the version of the
284 @code{ntpq}
285 program.
286 @end table
287
288 @subsubsection Control Message Commands
289 Association ids are used to identify system, peer and clock variables.
290 System variables are assigned an association id of zero and system name
291 space, while each association is assigned a nonzero association id and
292 peer namespace.
293 Most control commands send a single message to the server and expect a
294 single response message.
295 The exceptions are the
296 @code{peers}
297 command, which sends a series of messages,
298 and the
299 @code{mreadlist}
300 and
301 @code{mreadvar}
302 commands, which iterate over a range of associations.
303 @table @asis
304 @item @code{apeers}
305 Display a list of peers in the form:
306 @example
307 [tally]remote refid assid st t when pool reach delay offset jitter
308 @end example
309 where the output is just like the
310 @code{peers}
311 command except that the
312 @code{refid}
313 is displayed in hex format and the association number is also displayed.
314 @item @code{associations}
315 Display a list of mobilized associations in the form:
316 @example
317 ind assid status conf reach auth condition last_event cnt
318 @end example
319 @table @asis
320 @item Sy Variable Ta Sy Description
321 @item @code{ind} @code{Ta} @code{index} @code{on} @code{this} @code{list}
322 @item @code{assid} @code{Ta} @code{association} @code{id}
323 @item @code{status} @code{Ta} @code{peer} @code{status} @code{word}
324 @item @code{conf} @code{Ta} @code{yes}: @code{No} @code{persistent,} @code{no}: @code{No} @code{ephemeral}
325 @item @code{reach} @code{Ta} @code{yes}: @code{No} @code{reachable,} @code{no}: @code{No} @code{unreachable}
326 @item @code{auth} @code{Ta} @code{ok}, @code{yes}, @code{bad} @code{No} @code{and} @code{none}
327 @item @code{condition} @code{Ta} @code{selection} @code{status} @code{(see} @code{the} @code{select} @code{No} @code{field} @code{of} @code{the} @code{peer} @code{status} @code{word)}
328 @item @code{last_event} @code{Ta} @code{event} @code{report} @code{(see} @code{the} @code{event} @code{No} @code{field} @code{of} @code{the} @code{peer} @code{status} @code{word)}
329 @item @code{cnt} @code{Ta} @code{event} @code{count} @code{(see} @code{the} @code{count} @code{No} @code{field} @code{of} @code{the} @code{peer} @code{status} @code{word)}
330 @end table
331 @item @code{authinfo}
332 Display the authentication statistics counters:
333 time since reset, stored keys, free keys, key lookups, keys not found,
334 uncached keys, expired keys, encryptions, decryptions.
335 @item @code{clocklist} @code{[@kbd{associd}]}
336 @item @code{cl} @code{[@kbd{associd}]}
337 Display all clock variables in the variable list for those associations
338 supporting a reference clock.
339 @item @code{clockvar} @code{[@kbd{associd}]} @code{[@kbd{name}@code{[=@kbd{value}]}]}@code{[,...]}
340 @item @code{cv} @code{[@kbd{associd}]} @code{[@kbd{name}@code{[=@kbd{value}]}]}@code{[,...]}
341 Display a list of clock variables for those associations supporting a
342 reference clock.
343 @item @code{:config} @kbd{configuration command line}
344 Send the remainder of the command line, including whitespace, to the
345 server as a run-time configuration command in the same format as a line
346 in the configuration file.
347 This command is experimental until further notice and clarification.
348 Authentication is of course required.
349 @item @code{config-from-file} @kbd{filename}
350 Send each line of
351 @kbd{filename}
352 to the server as run-time configuration commands in the same format as
353 lines in the configuration file.
354 This command is experimental until further notice and clarification.
355 Authentication is required.
356 @item @code{ifstats}
357 Display status and statistics counters for each local network interface address:
358 interface number, interface name and address or broadcast, drop, flag,
359 ttl, mc, received, sent, send failed, peers, uptime.
360 Authentication is required.
361 @item @code{iostats}
362 Display network and reference clock I/O statistics:
363 time since reset, receive buffers, free receive buffers, used receive buffers,
364 low water refills, dropped packets, ignored packets, received packets,
365 packets sent, packet send failures, input wakeups, useful input wakeups.
366 @item @code{kerninfo}
367 Display kernel loop and PPS statistics:
368 associd, status, pll offset, pll frequency, maximum error,
369 estimated error, kernel status, pll time constant, precision,
370 frequency tolerance, pps frequency, pps stability, pps jitter,
371 calibration interval, calibration cycles, jitter exceeded,
372 stability exceeded, calibration errors.
373 As with other ntpq output, times are in milliseconds; very small values
374 may be shown as exponentials.
375 The precision value displayed is in milliseconds as well, unlike the
376 precision system variable.
377 @item @code{lassociations}
378 Perform the same function as the associations command, except display
379 mobilized and unmobilized associations, including all clients.
380 @item @code{lopeers} @code{[@code{-4}|@code{-6}]}
381 Display a list of all peers and clients showing
382 @code{dstadr}
383 (associated with the given IP version).
384 @item @code{lpassociations}
385 Display the last obtained list of associations, including all clients.
386 @item @code{lpeers} @code{[@code{-4}|@code{-6}]}
387 Display a list of all peers and clients (associated with the given IP version).
388 @item @code{monstats}
389 Display monitor facility status, statistics, and limits:
390 enabled, addresses, peak addresses, maximum addresses,
391 reclaim above count, reclaim older than, kilobytes, maximum kilobytes.
392 @item @code{mreadlist} @kbd{associdlo} @kbd{associdhi}
393 @item @code{mrl} @kbd{associdlo} @kbd{associdhi}
394 Perform the same function as the
395 @code{readlist}
396 command for a range of association ids.
397 @item @code{mreadvar} @kbd{associdlo} @kbd{associdhi} @code{[@kbd{name}]}@code{[,...]}
398 This range may be determined from the list displayed by any
399 command showing associations.
400 @item @code{mrv} @kbd{associdlo} @kbd{associdhi} @code{[@kbd{name}]}@code{[,...]}
401 Perform the same function as the
402 @code{readvar}
403 command for a range of association ids.
404 This range may be determined from the list displayed by any
405 command showing associations.
406 @item @code{mrulist} @code{[@code{limited} | @code{kod} | @code{mincount}=@kbd{count} | @code{laddr}=@kbd{localaddr} | @code{sort}=@code{[-]}@kbd{sortorder} | @code{resany}=@kbd{hexmask} | @code{resall}=@kbd{hexmask}]}
407 Display traffic counts of the most recently seen source addresses
408 collected and maintained by the monitor facility.
409 With the exception of
410 @code{sort}=@code{[-]}@kbd{sortorder},
411 the options filter the list returned by
412 @code{ntpd(8)}.
413 The
414 @code{limited}
415 and
416 @code{kod}
417 options return only entries representing client addresses from which the
418 last packet received triggered either discarding or a KoD response.
419 The
420 @code{mincount}=@kbd{count}
421 option filters entries representing less than
422 @kbd{count}
423 packets.
424 The
425 @code{laddr}=@kbd{localaddr}
426 option filters entries for packets received on any local address other than
427 @kbd{localaddr}.
428 @code{resany}=@kbd{hexmask}
429 and
430 @code{resall}=@kbd{hexmask}
431 filter entries containing none or less than all, respectively, of the bits in
432 @kbd{hexmask},
433 which must begin with
434 @code{0x}.
435 The
436 @kbd{sortorder}
437 defaults to
438 @code{lstint}
439 and may be 
440 @code{addr},
441 @code{avgint},
442 @code{count},
443 @code{lstint},
444 or any of those preceded by
445 @quoteleft{}-@quoteright{}
446 to reverse the sort order.
447 The output columns are:
448 @table @asis
449 @item Column
450 Description
451 @item @code{lstint}
452 Interval in seconds between the receipt of the most recent packet from
453 this address and the completion of the retrieval of the MRU list by
454 @code{ntpq}
455 @item @code{avgint}
456 Average interval in s between packets from this address.
457 @item @code{rstr}
458 Restriction flags associated with this address.
459 Most are copied unchanged from the matching
460 @code{restrict}
461 command, however 0x400 (kod) and 0x20 (limited) flags are cleared unless
462 the last packet from this address triggered a rate control response.
463 @item @code{r}
464 Rate control indicator, either
465 a period,
466 @code{L}
467 or
468 @code{K}
469 for no rate control response,
470 rate limiting by discarding, or rate limiting with a KoD response, respectively.
471 @item @code{m}
472 Packet mode.
473 @item @code{v}
474 Packet version number.
475 @item @code{count}
476 Packets received from this address.
477 @item @code{rport}
478 Source port of last packet from this address.
479 @item @code{remote} @code{address}
480 host or DNS name, numeric address, or address followed by
481 claimed DNS name which could not be verified in parentheses.
482 @end table
483 @item @code{opeers} @code{[@code{-4} | @code{-6}]}
484 Obtain and print the old-style list of all peers and clients showing
485 @code{dstadr}
486 (associated with the given IP version),
487 rather than the
488 @code{refid}.
489 @item @code{passociations}
490 Perform the same function as the
491 @code{associations}
492 command,
493 except that it uses previously stored data rather than making a new query.
494 @item @code{peers}
495 Display a list of peers in the form:
496 @example
497 [tally]remote refid st t when pool reach delay offset jitter
498 @end example
499 @table @asis
500 @item Variable
501 Description
502 @item @code{[tally]}
503 single-character code indicating current value of the
504 @code{select}
505 field of the
506 .Lk decode.html#peer "peer status word"
507 @item @code{remote}
508 host name (or IP number) of peer.
509 The value displayed will be truncated to 15 characters unless the
510 @code{ntpq}
511 @code{-w}
512 option is given, in which case the full value will be displayed
513 on the first line, and if too long,
514 the remaining data will be displayed on the next line.
515 @item @code{refid}
516 source IP address or
517 .Lk decode.html#kiss "'kiss code"
518 @item @code{st}
519 stratum: 0 for local reference clocks, 1 for servers with local
520 reference clocks, ..., 16 for unsynchronized server clocks
521 @item @code{t}
522 @code{u}:
523 unicast or manycast client,
524 @code{b}:
525 broadcast or multicast client,
526 @code{p}:
527 pool source,
528 @code{l}:
529 local (reference clock),
530 @code{s}:
531 symmetric (peer),
532 @code{A}:
533 manycast server,
534 @code{B}:
535 broadcast server,
536 @code{M}:
537 multicast server
538 @item @code{when}
539 time in seconds, minutes, hours, or days since the last packet
540 was received, or
541 @quoteleft{}-@quoteright{}
542 if a packet has never been received
543 @item @code{poll}
544 poll interval (s)
545 @item @code{reach}
546 reach shift register (octal)
547 @item @code{delay}
548 roundtrip delay
549 @item @code{offset}
550 offset of server relative to this host
551 @item @code{jitter}
552 offset RMS error estimate.
553 @end table
554 @item @code{pstats} @kbd{associd}
555 Display the statistics for the peer with the given
556 @kbd{associd}:
557 associd, status, remote host, local address, time last received,
558 time until next send, reachability change, packets sent,
559 packets received, bad authentication, bogus origin, duplicate,
560 bad dispersion, bad reference time, candidate order.
561 @item @code{readlist} @code{[@kbd{associd}]}
562 @item @code{rl} @code{[@kbd{associd}]}
563 Display all system or peer variables.
564 If the
565 @kbd{associd}
566 is omitted, it is assumed to be zero.
567 @item @code{readvar} @code{[@kbd{associd} @kbd{name}@code{[=@kbd{value}]} @code{[, ...]}]}
568 @item @code{rv} @code{[@kbd{associd} @kbd{name}@code{[=@kbd{value}]} @code{[, ...]}]}
569 Display the specified system or peer variables.
570 If
571 @kbd{associd}
572 is zero, the variables are from the
573 @ref{System Variables}
574 name space, otherwise they are from the
575 @ref{Peer Variables}
576 name space.
577 The
578 @kbd{associd}
579 is required, as the same name can occur in both spaces.
580 If no
581 @kbd{name}
582 is included, all operative variables in the name space are displayed.
583 In this case only, if the
584 @kbd{associd}
585 is omitted, it is assumed to be zero.
586 Multiple names are specified with comma separators and without whitespace.
587 Note that time values are represented in milliseconds
588 and frequency values in parts-per-million (PPM).
589 Some NTP timestamps are represented in the format
590 @kbd{YYYY}@kbd{MM} @kbd{DD} @kbd{TTTT},
591 where
592 @kbd{YYYY}
593 is the year,
594 @kbd{MM}
595 the month of year,
596 @kbd{DD}
597 the day of month and
598 @kbd{TTTT}
599 the time of day.
600 @item @code{reslist}
601 Display the access control (restrict) list for
602 @code{ntpq}
603 Authentication is required.
604 @item @code{saveconfig} @kbd{filename}
605 Save the current configuration,
606 including any runtime modifications made by
607 @code{:config}
608 or
609 @code{config-from-file},
610 to the NTP server host file
611 @kbd{filename}.
612 This command will be rejected by the server unless
613 .Lk miscopt.html#saveconfigdir "saveconfigdir"
614 appears in the
615 @code{ntpd(8)}
616 configuration file.
617 @kbd{filename}
618 can use
619 @code{date(1)}
620 format specifiers to substitute the current date and time, for
621 example,
622 @example
623 @code{saveconfig} @file{ntp-%Y%m%d-%H%M%S.conf}. 
624 @end example
625 The filename used is stored in system variable
626 @code{savedconfig}.
627 Authentication is required.
628 @item @code{sysinfo}
629 Display system operational summary:
630 associd, status, system peer, system peer mode, leap indicator,
631 stratum, log2 precision, root delay, root dispersion,
632 reference id, reference time, system jitter, clock jitter,
633 clock wander, broadcast delay, symm. auth. delay.
634 @item @code{sysstats}
635 Display system uptime and packet counts maintained in the
636 protocol module:
637 uptime, sysstats reset, packets received, current version,
638 older version, bad length or format, authentication failed,
639 declined, restricted, rate limited, KoD responses,
640 processed for time.
641 @item @code{timerstats}
642 Display interval timer counters:
643 time since reset, timer overruns, calls to transmit.
644 @item @code{writelist} @kbd{associd}
645 Set all system or peer variables included in the variable list.
646 @item @code{writevar} @kbd{associd} @kbd{name}=@kbd{value} @code{[, ...]}
647 Set the specified variables in the variable list.
648 If the
649 @kbd{associd}
650 is zero, the variables are from the
651 @ref{System Variables}
652 name space, otherwise they are from the
653 @ref{Peer Variables}
654 name space.
655 The
656 @kbd{associd}
657 is required, as the same name can occur in both spaces.
658 Authentication is required.
659 @end table
660
661 @subsubsection Status Words and Kiss Codes
662 The current state of the operating program is shown
663 in a set of status words
664 maintained by the system.
665 Status information is also available on a per-association basis.
666 These words are displayed by the
667 @code{readlist}
668 and
669 @code{associations}
670 commands both in hexadecimal and in decoded short tip strings.
671 The codes, tips and short explanations are documented on the
672 .Lk decode.html "Event Messages and Status Words"
673 page.
674 The page also includes a list of system and peer messages,
675 the code for the latest of which is included in the status word.
676
677 Information resulting from protocol machine state transitions
678 is displayed using an informal set of ASCII strings called
679 .Lk decode.html#kiss "kiss codes" .
680 The original purpose was for kiss-o'-death (KoD) packets
681 sent by the server to advise the client of an unusual condition.
682 They are now displayed, when appropriate,
683 in the reference identifier field in various billboards.
684
685 @subsubsection System Variables
686 The following system variables appear in the
687 @code{readlist}
688 billboard.
689 Not all variables are displayed in some configurations.
690
691 @table @asis
692 @item Variable
693 Description
694 @item @code{status}
695 .Lk decode.html#sys "system status word"
696 @item @code{version}
697 NTP software version and build time
698 @item @code{processor}
699 hardware platform and version
700 @item @code{system}
701 operating system and version
702 @item @code{leap}
703 leap warning indicator (0-3)
704 @item @code{stratum}
705 stratum (1-15)
706 @item @code{precision}
707 precision (log2 s)
708 @item @code{rootdelay}
709 total roundtrip delay to the primary reference clock
710 @item @code{rootdisp}
711 total dispersion to the primary reference clock
712 @item @code{refid}
713 reference id or
714 .Lk decode.html#kiss "kiss code"
715 @item @code{reftime}
716 reference time
717 @item @code{clock}
718 date and time of day
719 @item @code{peer}
720 system peer association id
721 @item @code{tc}
722 time constant and poll exponent (log2 s) (3-17)
723 @item @code{mintc}
724 minimum time constant (log2 s) (3-10)
725 @item @code{offset}
726 combined offset of server relative to this host
727 @item @code{frequency}
728 frequency drift (PPM) relative to hardware clock
729 @item @code{sys_jitter}
730 combined system jitter
731 @item @code{clk_wander}
732 clock frequency wander (PPM)
733 @item @code{clk_jitter}
734 clock jitter
735 @item @code{tai}
736 TAI-UTC offset (s)
737 @item @code{leapsec}
738 NTP seconds when the next leap second is/was inserted
739 @item @code{expire}
740 NTP seconds when the NIST leapseconds file expires
741 @end table
742 The jitter and wander statistics are exponentially-weighted RMS averages.
743 The system jitter is defined in the NTPv4 specification;
744 the clock jitter statistic is computed by the clock discipline module.
745
746 When the NTPv4 daemon is compiled with the OpenSSL software library,
747 additional system variables are displayed,
748 including some or all of the following,
749 depending on the particular Autokey dance:
750 @table @asis
751 @item Variable
752 Description
753 @item @code{host}
754 Autokey host name for this host
755 @item @code{ident}
756 Autokey group name for this host
757 @item @code{flags}
758 host flags  (see Autokey specification)
759 @item @code{digest}
760 OpenSSL message digest algorithm
761 @item @code{signature}
762 OpenSSL digest/signature scheme
763 @item @code{update}
764 NTP seconds at last signature update
765 @item @code{cert}
766 certificate subject, issuer and certificate flags
767 @item @code{until}
768 NTP seconds when the certificate expires
769 @end table
770 @subsubsection Peer Variables
771 The following peer variables appear in the
772 @code{readlist}
773 billboard for each association.
774 Not all variables are displayed in some configurations.
775
776 @table @asis
777 @item Variable
778 Description
779 @item @code{associd}
780 association id
781 @item @code{status}
782 .Lk decode.html#peer "peer status word"
783 @item @code{srcadr}
784 source (remote) IP address
785 @item @code{srcport}
786 source (remote) port
787 @item @code{dstadr}
788 destination (local) IP address
789 @item @code{dstport}
790 destination (local) port
791 @item @code{leap}
792 leap indicator (0-3)
793 @item @code{stratum}
794 stratum (0-15)
795 @item @code{precision}
796 precision (log2 s)
797 @item @code{rootdelay}
798 total roundtrip delay to the primary reference clock
799 @item @code{rootdisp}
800 total root dispersion to the primary reference clock
801 @item @code{refid}
802 reference id or
803 .Lk decode.html#kiss "kiss code"
804 @item @code{reftime}
805 reference time
806 @item @code{rec}
807 last packet received time
808 @item @code{reach}
809 reach register (octal)
810 @item @code{unreach}
811 unreach counter
812 @item @code{hmode}
813 host mode (1-6)
814 @item @code{pmode}
815 peer mode (1-5)
816 @item @code{hpoll}
817 host poll exponent (log2 s) (3-17)
818 @item @code{ppoll}
819 peer poll exponent (log2 s) (3-17)
820 @item @code{headway}
821 headway (see
822 .Lk rate.html "Rate Management and the Kiss-o'-Death Packet" )
823 @item @code{flash}
824 .Lk decode.html#flash "flash status word"
825 @item @code{keyid}
826 symmetric key id
827 @item @code{offset}
828 filter offset
829 @item @code{delay}
830 filter delay
831 @item @code{dispersion}
832 filter dispersion
833 @item @code{jitter}
834 filter jitter
835 @item @code{bias}
836 unicast/broadcast bias
837 @item @code{xleave}
838 interleave delay (see
839 .Lk xleave.html "NTP Interleaved Modes" )
840 @end table
841 The
842 @code{bias}
843 variable is calculated when the first broadcast packet is received
844 after the calibration volley.
845 It represents the offset of the broadcast subgraph relative to the
846 unicast subgraph.
847 The
848 @code{xleave}
849 variable appears only for the interleaved symmetric and interleaved modes.
850 It represents the internal queuing, buffering and transmission delays
851 for the preceding packet.
852
853 When the NTPv4 daemon is compiled with the OpenSSL software library,
854 additional peer variables are displayed, including the following:
855 @table @asis
856 @item Variable
857 Description
858 @item @code{flags}
859 peer flags (see Autokey specification)
860 @item @code{host}
861 Autokey server name
862 @item @code{flags}
863 peer flags (see Autokey specification)
864 @item @code{signature}
865 OpenSSL digest/signature scheme
866 @item @code{initsequence}
867 initial key id
868 @item @code{initkey}
869 initial key index
870 @item @code{timestamp}
871 Autokey signature timestamp
872 @item @code{ident}
873 Autokey group name for this association
874 @end table
875
876 @subsubsection Clock Variables
877 The following clock variables appear in the
878 @code{clocklist}
879 billboard for each association with a reference clock.
880 Not all variables are displayed in some configurations.
881 @table @asis
882 @item Variable
883 Description
884 @item @code{associd}
885 association id
886 @item @code{status}
887 .Lk decode.html#clock "clock status word"
888 @item @code{device}
889 device description
890 @item @code{timecode}
891 ASCII time code string (specific to device)
892 @item @code{poll}
893 poll messages sent
894 @item @code{noreply}
895 no reply
896 @item @code{badformat}
897 bad format
898 @item @code{baddata}
899 bad date or time
900 @item @code{fudgetime1}
901 fudge time 1
902 @item @code{fudgetime2}
903 fudge time 2
904 @item @code{stratum}
905 driver stratum
906 @item @code{refid}
907 driver reference id
908 @item @code{flags}
909 driver flags
910 @end table
911
912 This section was generated by @strong{AutoGen},
913 using the @code{agtexi-cmd} template and the option descriptions for the @code{ntpq} program.
914 This software is released under the NTP license, <http://ntp.org/license>.
915
916 @menu
917 * ntpq usage::                  ntpq help/usage (@option{--help})
918 * ntpq ipv4::                   ipv4 option (-4)
919 * ntpq ipv6::                   ipv6 option (-6)
920 * ntpq command::                command option (-c)
921 * ntpq interactive::            interactive option (-i)
922 * ntpq numeric::                numeric option (-n)
923 * ntpq old-rv::                 old-rv option
924 * ntpq peers::                  peers option (-p)
925 * ntpq refid::                  refid option (-r)
926 * ntpq wide::                   wide option (-w)
927 * ntpq config::                 presetting/configuring ntpq
928 * ntpq exit status::            exit status
929 @end menu
930
931 @node ntpq usage
932 @subsection ntpq help/usage (@option{--help})
933 @cindex ntpq help
934
935 This is the automatically generated usage text for ntpq.
936
937 The text printed is the same whether selected with the @code{help} option
938 (@option{--help}) or the @code{more-help} option (@option{--more-help}).  @code{more-help} will print
939 the usage text by passing it through a pager program.
940 @code{more-help} is disabled on platforms without a working
941 @code{fork(2)} function.  The @code{PAGER} environment variable is
942 used to select the program, defaulting to @file{more}.  Both will exit
943 with a status code of 0.
944
945 @exampleindent 0
946 @example
947 ntpq - standard NTP query program - Ver. 4.2.8p11
948 Usage:  ntpq [ -<flag> [<val>] | --<name>[@{=| @}<val>] ]... [ host ...]
949   Flg Arg Option-Name    Description
950    -4 no  ipv4           Force IPv4 name resolution
951                                 - prohibits the option 'ipv6'
952    -6 no  ipv6           Force IPv6 name resolution
953                                 - prohibits the option 'ipv4'
954    -c Str command        run a command and exit
955                                 - may appear multiple times
956    -d no  debug-level    Increase debug verbosity level
957                                 - may appear multiple times
958    -D Num set-debug-level Set the debug verbosity level
959                                 - may appear multiple times
960    -i no  interactive    Force ntpq to operate in interactive mode
961                                 - prohibits these options:
962                                 command
963                                 peers
964    -n no  numeric        numeric host addresses
965       no  old-rv         Always output status line with readvar
966    -p no  peers          Print a list of the peers
967                                 - prohibits the option 'interactive'
968    -r KWd refid          Set default display type for S2+ refids
969    -w no  wide           Display the full 'remote' value
970       opt version        output version information and exit
971    -? no  help           display extended usage information and exit
972    -! no  more-help      extended usage information passed thru pager
973    -> opt save-opts      save the option state to a config file
974    -< Str load-opts      load options from a config file
975                                 - disabled as '--no-load-opts'
976                                 - may appear multiple times
977
978 Options are specified by doubled hyphens and their name or by a single
979 hyphen and the flag character.
980
981 The following option preset mechanisms are supported:
982  - reading file $HOME/.ntprc
983  - reading file ./.ntprc
984  - examining environment variables named NTPQ_*
985
986 The valid "refid" option keywords are:
987   hash ipv4
988   or an integer from 0 through 1
989
990 Please send bug reports to:  <http://bugs.ntp.org, bugs@@ntp.org>
991 @end example
992 @exampleindent 4
993
994 @node ntpq ipv4
995 @subsection ipv4 option (-4)
996 @cindex ntpq-ipv4
997
998 This is the ``force ipv4 name resolution'' option.
999
1000 @noindent
1001 This option has some usage constraints.  It:
1002 @itemize @bullet
1003 @item
1004 must not appear in combination with any of the following options:
1005 ipv6.
1006 @end itemize
1007
1008 Force resolution of following host names on the command line
1009 to the IPv4 namespace.
1010 @node ntpq ipv6
1011 @subsection ipv6 option (-6)
1012 @cindex ntpq-ipv6
1013
1014 This is the ``force ipv6 name resolution'' option.
1015
1016 @noindent
1017 This option has some usage constraints.  It:
1018 @itemize @bullet
1019 @item
1020 must not appear in combination with any of the following options:
1021 ipv4.
1022 @end itemize
1023
1024 Force resolution of following host names on the command line
1025 to the IPv6 namespace.
1026 @node ntpq command
1027 @subsection command option (-c)
1028 @cindex ntpq-command
1029
1030 This is the ``run a command and exit'' option.
1031 This option takes a string argument @file{cmd}.
1032
1033 @noindent
1034 This option has some usage constraints.  It:
1035 @itemize @bullet
1036 @item
1037 may appear an unlimited number of times.
1038 @end itemize
1039
1040 The following argument is interpreted as an interactive format command
1041 and is added to the list of commands to be executed on the specified
1042 host(s).
1043 @node ntpq interactive
1044 @subsection interactive option (-i)
1045 @cindex ntpq-interactive
1046
1047 This is the ``force ntpq to operate in interactive mode'' option.
1048
1049 @noindent
1050 This option has some usage constraints.  It:
1051 @itemize @bullet
1052 @item
1053 must not appear in combination with any of the following options:
1054 command, peers.
1055 @end itemize
1056
1057 Force @code{ntpq} to operate in interactive mode.
1058 Prompts will be written to the standard output and
1059 commands read from the standard input.
1060 @node ntpq numeric
1061 @subsection numeric option (-n)
1062 @cindex ntpq-numeric
1063
1064 This is the ``numeric host addresses'' option.
1065 Output all host addresses in dotted-quad numeric format rather than
1066 converting to the canonical host names.
1067 @node ntpq old-rv
1068 @subsection old-rv option
1069 @cindex ntpq-old-rv
1070
1071 This is the ``always output status line with readvar'' option.
1072 By default, @code{ntpq} now suppresses the @code{associd=...}
1073 line that precedes the output of @code{readvar}
1074 (alias @code{rv}) when a single variable is requested, such as
1075 @code{ntpq -c "rv 0 offset"}.
1076 This option causes @code{ntpq} to include both lines of output
1077 for a single-variable @code{readvar}.
1078 Using an environment variable to
1079 preset this option in a script will enable both older and
1080 newer @code{ntpq} to behave identically in this regard.
1081 @node ntpq peers
1082 @subsection peers option (-p)
1083 @cindex ntpq-peers
1084
1085 This is the ``print a list of the peers'' option.
1086
1087 @noindent
1088 This option has some usage constraints.  It:
1089 @itemize @bullet
1090 @item
1091 must not appear in combination with any of the following options:
1092 interactive.
1093 @end itemize
1094
1095 Print a list of the peers known to the server as well as a summary
1096 of their state. This is equivalent to the 'peers' interactive command.
1097 @node ntpq refid
1098 @subsection refid option (-r)
1099 @cindex ntpq-refid
1100
1101 This is the ``set default display type for s2+ refids'' option.
1102 This option takes a keyword argument.
1103
1104 @noindent
1105 This option has some usage constraints.  It:
1106 @itemize @bullet
1107 @item
1108 This option takes a keyword as its argument.
1109 The argument sets an enumeration value that can be tested by comparing the option value macro (OPT_VALUE_REFID).
1110 The available keywords are:
1111 @example
1112     hash ipv4
1113 @end example
1114
1115 or their numeric equivalent.@end itemize
1116
1117 Set the default display format for S2+ refids.
1118 @node ntpq wide
1119 @subsection wide option (-w)
1120 @cindex ntpq-wide
1121
1122 This is the ``display the full 'remote' value'' option.
1123 Display the full value of the 'remote' value.  If this requires
1124 more than 15 characters, display the full value, emit a newline,
1125 and continue the data display properly indented on the next line.
1126
1127
1128 @node ntpq config
1129 @subsection presetting/configuring ntpq
1130
1131 Any option that is not marked as @i{not presettable} may be preset by
1132 loading values from configuration ("rc" or "ini") files, and values from environment variables named @code{NTPQ} and @code{NTPQ_<OPTION_NAME>}.  @code{<OPTION_NAME>} must be one of
1133 the options listed above in upper case and segmented with underscores.
1134 The @code{NTPQ} variable will be tokenized and parsed like
1135 the command line.  The remaining variables are tested for existence and their
1136 values are treated like option arguments.
1137
1138
1139 @noindent
1140 @code{libopts} will search in 2 places for configuration files:
1141 @itemize @bullet
1142 @item
1143 $HOME
1144 @item
1145 $PWD
1146 @end itemize
1147 The environment variables @code{HOME}, and @code{PWD}
1148 are expanded and replaced when @file{ntpq} runs.
1149 For any of these that are plain files, they are simply processed.
1150 For any that are directories, then a file named @file{.ntprc} is searched for
1151 within that directory and processed.
1152
1153 Configuration files may be in a wide variety of formats.
1154 The basic format is an option name followed by a value (argument) on the
1155 same line.  Values may be separated from the option name with a colon,
1156 equal sign or simply white space.  Values may be continued across multiple
1157 lines by escaping the newline with a backslash.
1158
1159 Multiple programs may also share the same initialization file.
1160 Common options are collected at the top, followed by program specific
1161 segments.  The segments are separated by lines like:
1162 @example
1163 [NTPQ]
1164 @end example
1165 @noindent
1166 or by
1167 @example
1168 <?program ntpq>
1169 @end example
1170 @noindent
1171 Do not mix these styles within one configuration file.
1172
1173 Compound values and carefully constructed string values may also be
1174 specified using XML syntax:
1175 @example
1176 <option-name>
1177    <sub-opt>...&lt;...&gt;...</sub-opt>
1178 </option-name>
1179 @end example
1180 @noindent
1181 yielding an @code{option-name.sub-opt} string value of
1182 @example
1183 "...<...>..."
1184 @end example
1185 @code{AutoOpts} does not track suboptions.  You simply note that it is a
1186 hierarchicly valued option.  @code{AutoOpts} does provide a means for searching
1187 the associated name/value pair list (see: optionFindValue).
1188
1189 The command line options relating to configuration and/or usage help are:
1190
1191 @subsubheading version (-)
1192
1193 Print the program version to standard out, optionally with licensing
1194 information, then exit 0.  The optional argument specifies how much licensing
1195 detail to provide.  The default is to print just the version.  The licensing infomation may be selected with an option argument.
1196 Only the first letter of the argument is examined:
1197
1198 @table @samp
1199 @item version
1200 Only print the version.  This is the default.
1201 @item copyright
1202 Name the copyright usage licensing terms.
1203 @item verbose
1204 Print the full copyright usage licensing terms.
1205 @end table
1206
1207 @node ntpq exit status
1208 @subsection ntpq exit status
1209
1210 One of the following exit values will be returned:
1211 @table @samp
1212 @item 0 (EXIT_SUCCESS)
1213 Successful program execution.
1214 @item 1 (EXIT_FAILURE)
1215 The operation failed or the command syntax was not valid.
1216 @item 66 (EX_NOINPUT)
1217 A specified configuration file could not be loaded.
1218 @item 70 (EX_SOFTWARE)
1219 libopts had an internal operational error.  Please report
1220 it to autogen-users@@lists.sourceforge.net.  Thank you.
1221 @end table