]> CyberLeo.Net >> Repos - FreeBSD/releng/9.3.git/blob - contrib/ntp/ntpq/ntpq.html
o Fix invalid TCP checksums with pf(4). [EN-16:02.pf]
[FreeBSD/releng/9.3.git] / contrib / ntp / ntpq / ntpq.html
1 <html lang="en">
2 <head>
3 <title>ntpq: Network Time Protocol Query User's Manual</title>
4 <meta http-equiv="Content-Type" content="text/html">
5 <meta name="description" content="ntpq: Network Time Protocol Query User's Manual">
6 <meta name="generator" content="makeinfo 4.7">
7 <link title="Top" rel="top" href="#Top">
8 <link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
9 <meta http-equiv="Content-Style-Type" content="text/css">
10 <style type="text/css"><!--
11   pre.display { font-family:inherit }
12   pre.format  { font-family:inherit }
13   pre.smalldisplay { font-family:inherit; font-size:smaller }
14   pre.smallformat  { font-family:inherit; font-size:smaller }
15   pre.smallexample { font-size:smaller }
16   pre.smalllisp    { font-size:smaller }
17   span.sc { font-variant:small-caps }
18   span.roman { font-family: serif; font-weight: normal; } 
19 --></style>
20 </head>
21 <body>
22 <h1 class="settitle">ntpq: Network Time Protocol Query User's Manual</h1>
23   <div class="shortcontents">
24 <h2>Short Contents</h2>
25 <ul>
26 <a href="#Top">ntpq: Network Time Protocol Query User Manual</a>
27 </ul>
28 </div>
29
30
31
32 <div class="node">
33 <p><hr>
34 <a name="Top"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#ntpq-Description">ntpq Description</a>,
35 Previous:&nbsp;<a rel="previous" accesskey="p" href="#dir">(dir)</a>,
36 Up:&nbsp;<a rel="up" accesskey="u" href="#dir">(dir)</a>
37 <br>
38 </div>
39
40 <h2 class="unnumbered">ntpq: Network Time Protocol Query User Manual</h2>
41
42 <p>The <code>ntpq</code> utility program is used to
43 monitor the operational status
44 and determine the performance of
45 <code>ntpd</code>, the NTP daemon.
46
47   <p>This document applies to version 4.2.8p5 of <code>ntpq</code>.
48
49 <ul class="menu">
50 <li><a accesskey="1" href="#ntpq-Description">ntpq Description</a>
51 <li><a accesskey="2" href="#ntpq-Invocation">ntpq Invocation</a>:              Invoking ntpq
52 <li><a accesskey="3" href="#Usage">Usage</a>
53 <li><a accesskey="4" href="#Internal-Commands">Internal Commands</a>
54 <li><a accesskey="5" href="#Control-Message-Commands">Control Message Commands</a>
55 <li><a accesskey="6" href="#Status-Words-and-Kiss-Codes">Status Words and Kiss Codes</a>
56 <li><a accesskey="7" href="#System-Variables">System Variables</a>
57 <li><a accesskey="8" href="#Peer-Variables">Peer Variables</a>
58 <li><a accesskey="9" href="#Clock-Variables">Clock Variables</a>
59 </ul>
60
61 <div class="node">
62 <p><hr>
63 <a name="ntpq-Description"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#Usage">Usage</a>,
64 Previous:&nbsp;<a rel="previous" accesskey="p" href="#Top">Top</a>,
65 Up:&nbsp;<a rel="up" accesskey="u" href="#Top">Top</a>
66 <br>
67 </div>
68
69 <!-- node-name,  next,  previous,  up -->
70 <h3 class="section">Description</h3>
71
72 <p>The <code>ntpq</code> utility program is used to monitor NTP daemon <code>ntpd</code> operations and determine performance. 
73 It uses the standard NTP mode 6 control message formats defined in
74 Appendix B of the NTPv3 specification RFC1305. 
75 The same formats are used in NTPv4, although some of the variable names have changed and new ones added. 
76 The description on this page is for the NTPv4 variables.
77
78   <p>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 <code>ntpq</code> can also obtain and print a list of peers in a common format by sending multiple queries to the server.
79
80   <p>If one or more request options is included on the command line when <code>ntpq</code> 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, <code>ntpq</code> 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.  <code>ntpq</code> will prompt for commands if the standard input is a terminal device.
81
82   <p><code>ntpq</code> 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.  <code>ntpq</code> makes one attempt to retransmit requests, and will time requests out if the remote host is not heard from within a suitable timeout time.
83
84   <p>Note that in contexts where a host name is expected, a <code>-4</code> qualifier preceding the host name forces DNS resolution to the IPv4 namespace, while a <code>-6</code> qualifier forces DNS resolution to the IPv6 namespace.
85
86   <p>For examples and usage, see the <a href="debug.html">NTP Debugging Techniques</a> page.
87
88 <div class="node">
89 <p><hr>
90 <a name="ntpq-Invocation"></a>
91 <br>
92 </div>
93
94 <h3 class="section">Invoking ntpq</h3>
95
96 <p><a name="index-ntpq-1"></a><a name="index-standard-NTP-query-program-2"></a>
97
98   <p>The
99 <code>ntpq</code>
100 utility program is used to query NTP servers which
101 implement the standard NTP mode 6 control message formats defined
102 in Appendix B of the NTPv3 specification RFC1305, requesting
103 information about current state and/or changes in that state. 
104 The same formats are used in NTPv4, although some of the
105 variables have changed and new ones added. The description on this
106 page is for the NTPv4 variables. 
107 The program may be run either in interactive mode or controlled using
108 command line arguments. 
109 Requests to read and write arbitrary
110 variables can be assembled, with raw and pretty-printed output
111 options being available. 
112 The
113 <code>ntpq</code>
114 utility can also obtain and print a
115 list of peers in a common format by sending multiple queries to the
116 server.
117
118   <p>If one or more request options is included on the command line
119 when
120 <code>ntpq</code>
121 is executed, each of the requests will be sent
122 to the NTP servers running on each of the hosts given as command
123 line arguments, or on localhost by default. 
124 If no request options
125 are given,
126 <code>ntpq</code>
127 will attempt to read commands from the
128 standard input and execute these on the NTP server running on the
129 first host given on the command line, again defaulting to localhost
130 when no other host is specified. 
131 The
132 <code>ntpq</code>
133 utility will prompt for
134 commands if the standard input is a terminal device.
135
136   <p><code>ntpq</code>
137 uses NTP mode 6 packets to communicate with the
138 NTP server, and hence can be used to query any compatible server on
139 the network which permits it. 
140 Note that since NTP is a UDP protocol
141 this communication will be somewhat unreliable, especially over
142 large distances in terms of network topology. 
143 The
144 <code>ntpq</code>
145 utility makes
146 one attempt to retransmit requests, and will time requests out if
147 the remote host is not heard from within a suitable timeout
148 time.
149
150   <p>Specifying a
151 command line option other than
152 <code>-i</code>
153 or
154 <code>-n</code>
155 will
156 cause the specified query (queries) to be sent to the indicated
157 host(s) immediately. 
158 Otherwise,
159 <code>ntpq</code>
160 will attempt to read
161 interactive format commands from the standard input.
162
163 <h5 class="subsubsection">Internal Commands</h5>
164
165 <p>Interactive format commands consist of a keyword followed by zero
166 to four arguments. 
167 Only enough characters of the full keyword to
168 uniquely identify the command need be typed.
169
170   <p>A
171 number of interactive format commands are executed entirely within
172 the
173 <code>ntpq</code>
174 utility itself and do not result in NTP mode 6
175 requests being sent to a server. 
176 These are described following.
177      <dl>
178 <dt><code>?</code> <code>[</code><kbd>command_keyword</kbd><code>]</code><br><dt><code>help</code> <code>[</code><kbd>command_keyword</kbd><code>]</code><dd>A
179
180 by itself will print a list of all the command
181 keywords known to this incarnation of
182 <code>ntpq</code>
183 A
184
185 followed by a command keyword will print function and usage
186 information about the command. 
187 This command is probably a better
188 source of information about
189 <code>ntpq</code>
190 than this manual
191 page. 
192 <br><dt><code>addvars</code> <kbd>variable_name</kbd><code>[=value]</code> <code>...</code><br><dt><code>rmvars</code> <kbd>variable_name</kbd> <code>...</code><br><dt><code>clearvars</code><br><dt><code>showvars</code><dd>The data carried by NTP mode 6 messages consists of a list of
193 items of the form
194 variable_name=value,
195 where the
196 =value
197 is ignored, and can be omitted,
198 in requests to the server to read variables. 
199 The
200 <code>ntpq</code>
201 utility maintains an internal list in which data to be included in control
202 messages can be assembled, and sent using the
203 <code>readlist</code>
204 and
205 <code>writelist</code>
206 commands described below. 
207 The
208 <code>addvars</code>
209 command allows variables and their optional values to be added to
210 the list. 
211 If more than one variable is to be added, the list should
212 be comma-separated and not contain white space. 
213 The
214 <code>rmvars</code>
215 command can be used to remove individual variables from the list,
216 while the
217 <code>clearlist</code>
218 command removes all variables from the
219 list. 
220 The
221 <code>showvars</code>
222 command displays the current list of optional variables. 
223 <br><dt><code>authenticate</code> <code>[yes | no]</code><dd>Normally
224 <code>ntpq</code>
225 does not authenticate requests unless
226 they are write requests. 
227 The command
228 authenticate yes
229 causes
230 <code>ntpq</code>
231 to send authentication with all requests it
232 makes. 
233 Authenticated requests causes some servers to handle
234 requests slightly differently, and can occasionally melt the CPU in
235 fuzzballs if you turn authentication on before doing a
236 <code>peer</code>
237 display. 
238 The command
239 authenticate
240 causes
241 <code>ntpq</code>
242 to display whether or not
243 <code>ntpq</code>
244 is currently autheinticating requests. 
245 <br><dt><code>cooked</code><dd>Causes output from query commands to be "cooked", so that
246 variables which are recognized by
247 <code>ntpq</code>
248 will have their
249 values reformatted for human consumption. 
250 Variables which
251 <code>ntpq</code>
252 thinks should have a decodable value but didn't are
253 marked with a trailing
254 ?. 
255 <br><dt><code>debug</code> <code>[more | less | off]</code><dd>With no argument, displays the current debug level. 
256 Otherwise, the debug level is changed to the indicated level. 
257 <br><dt><code>delay</code> <kbd>milliseconds</kbd><dd>Specify a time interval to be added to timestamps included in
258 requests which require authentication. 
259 This is used to enable
260 (unreliable) server reconfiguration over long delay network paths
261 or between machines whose clocks are unsynchronized. 
262 Actually the
263 server does not now require timestamps in authenticated requests,
264 so this command may be obsolete. 
265 <br><dt><code>exit</code><dd>Exit
266 <code>ntpq</code>
267 <br><dt><code>host</code> <kbd>hostname</kbd><dd>Set the host to which future queries will be sent. 
268 <kbd>hostname</kbd>
269 may be either a host name or a numeric address. 
270 <br><dt><code>hostnames</code> <code>[yes | no]</code><dd>If
271 <code>yes</code>
272 is specified, host names are printed in
273 information displays. 
274 If
275 <code>no</code>
276 is specified, numeric
277 addresses are printed instead. 
278 The default is
279 <code>yes</code>,
280 unless
281 modified using the command line
282 <code>-n</code>
283 switch. 
284 <br><dt><code>keyid</code> <kbd>keyid</kbd><dd>This command allows the specification of a key number to be
285 used to authenticate configuration requests. 
286 This must correspond
287 to the
288 <code>controlkey</code>
289 key number the server has been configured to use for this
290 purpose. 
291 <br><dt><code>keytype</code> <code>[md5 | OpenSSLDigestType]</code><dd>Specify the type of key to use for authenticating requests. 
292 <code>md5</code>
293 is alway supported. 
294 If
295 <code>ntpq</code>
296 was built with OpenSSL support,
297 any digest type supported by OpenSSL can also be provided. 
298 If no argument is given, the current
299 <code>keytype</code>
300 is displayed. 
301 <br><dt><code>ntpversion</code> <code>[1 | 2 | 3 | 4]</code><dd>Sets the NTP version number which
302 <code>ntpq</code>
303 claims in
304 packets. 
305 Defaults to 3, and note that mode 6 control messages (and
306 modes, for that matter) didn't exist in NTP version 1. 
307 There appear
308 to be no servers left which demand version 1. 
309 With no argument, displays the current NTP version that will be used
310 when communicating with servers. 
311 <br><dt><code>passwd</code><dd>This command prompts you to type in a password (which will not
312 be echoed) which will be used to authenticate configuration
313 requests. 
314 The password must correspond to the key configured for
315 use by the NTP server for this purpose if such requests are to be
316 successful. 
317 <code>poll</code>
318 <kbd>n</kbd>
319 <code>verbose</code>
320 <br><dt><code>quit</code><dd>Exit
321 <code>ntpq</code>
322 <br><dt><code>raw</code><dd>Causes all output from query commands is printed as received
323 from the remote server. 
324 The only formating/interpretation done on
325 the data is to transform nonascii data into a printable (but barely
326 understandable) form. 
327 <br><dt><code>timeout</code> <kbd>milliseconds</kbd><dd>Specify a timeout period for responses to server queries. 
328 The
329 default is about 5000 milliseconds. 
330 Note that since
331 <code>ntpq</code>
332 retries each query once after a timeout, the total waiting time for
333 a timeout will be twice the timeout value set. 
334 <br><dt><code>version</code><dd>Print the version of the
335 <code>ntpq</code>
336 program. 
337 </dl>
338
339 <h5 class="subsubsection">Control Message Commands</h5>
340
341 <p>Association IDs are used to identify system, peer and clock variables. 
342 System variables are assigned an association ID of zero and system name space, while each association is assigned a nonzero association ID and peer namespace. 
343 Most control commands send a single mode-6 message to the server and expect a single response message. 
344 The exceptions are the
345 <code>peers</code>
346 command, which sends a series of messages,
347 and the
348 <code>mreadlist</code>
349 and
350 <code>mreadvar</code>
351 commands, which iterate over a range of associations.
352      <dl>
353 <dt><code>associations</code><dd>Display a list of mobilized associations in the form:
354      <pre class="example">          ind assid status conf reach auth condition last_event cnt
355      </pre>
356           <dl>
357 <dt>Sy String Ta Sy Description<br><dt><code>ind</code> <code>Ta</code> <code>index</code> <code>on</code> <code>this</code> <code>list</code><br><dt><code>assid</code> <code>Ta</code> <code>association</code> <code>ID</code><br><dt><code>status</code> <code>Ta</code> <code>peer</code> <code>status</code> <code>word</code><br><dt><code>conf</code> <code>Ta</code> <code>yes</code>: <code>persistent,</code> <code>no</code>: <code>ephemeral</code><br><dt><code>reach</code> <code>Ta</code> <code>yes</code>: <code>reachable,</code> <code>no</code>: <code>unreachable</code><br><dt><code>auth</code> <code>Ta</code> <code>ok</code>, <code>yes</code>, <code>bad</code> <code>and</code> <code>none</code><br><dt><code>condition</code> <code>Ta</code> <code>selection</code> <code>status</code> <code>(see</code> <code>the</code> <code>select</code> <code>field</code> <code>of</code> <code>the</code> <code>peer</code> <code>status</code> <code>word)</code><br><dt><code>last_event</code> <code>Ta</code> <code>event</code> <code>report</code> <code>(see</code> <code>the</code> <code>event</code> <code>field</code> <code>of</code> <code>the</code> <code>peer</code> <code>status</code> <code>word)</code><br><dt><code>cnt</code> <code>Ta</code> <code>event</code> <code>count</code> <code>(see</code> <code>the</code> <code>count</code> <code>field</code> <code>of</code> <code>the</code> <code>peer</code> <code>status</code> <code>word)</code><dd></dl>
358      <br><dt><code>authinfo</code><dd>Display the authentication statistics. 
359 <br><dt><code>clockvar</code> <kbd>assocID</kbd> <code>[</code><kbd>name</kbd><code>[=</code><kbd>value</kbd><code>]]</code> <code>[...]</code><br><dt><code>cv</code> <kbd>assocID</kbd> <code>[</code><kbd>name</kbd><code>[=</code><kbd>value</kbd><code>]]</code> <code>[...]</code><dd>Display a list of clock variables for those associations supporting a reference clock. 
360 <br><dt><code>:config</code> <code>[...]</code><dd>Send the remainder of the command line, including whitespace, to the server as a run-time configuration command in the same format as a line in the configuration file. This command is experimental until further notice and clarification. Authentication is of course required. 
361 <br><dt><code>config-from-file</code> <kbd>filename</kbd><dd>Send the each line of
362 <kbd>filename</kbd>
363 to the server as run-time configuration commands in the same format as a line in the configuration file. This command is experimental until further notice and clarification. Authentication is required. 
364 <br><dt><code>ifstats</code><dd>Display statistics for each local network address. Authentication is required. 
365 <br><dt><code>iostats</code><dd>Display network and reference clock I/O statistics. 
366 <br><dt><code>kerninfo</code><dd>Display kernel loop and PPS statistics. As with other ntpq output, times are in milliseconds. The precision value displayed is in milliseconds as well, unlike the precision system variable. 
367 <br><dt><code>lassociations</code><dd>Perform the same function as the associations command, except display mobilized and unmobilized associations. 
368 <br><dt><code>lopeers</code> <code>[-4 | -6]</code><dd>Obtain and print a list of all peers and clients showing
369 <kbd>dstadr</kbd>
370 (associated with any given IP version). 
371 <br><dt><code>lpeers</code> <code>[-4 | -6]</code><dd>Print a peer spreadsheet for the appropriate IP version(s). 
372 <kbd>dstadr</kbd>
373 (associated with any given IP version). 
374 <br><dt><code>monstats</code><dd>Display monitor facility statistics. 
375 <br><dt><code>mrulist</code> <code>[limited | kod | mincount=</code><kbd>count</kbd><code> | laddr=</code><kbd>localaddr</kbd><code> | sort=</code><kbd>sortorder</kbd><code> | resany=</code><kbd>hexmask</kbd><code> | resall=</code><kbd>hexmask</kbd><code>]</code><dd>Obtain and print traffic counts collected and maintained by the monitor facility. 
376 With the exception of
377 <code>sort</code>=<kbd>sortorder</kbd>,
378 the options filter the list returned by
379 <code>ntpd.</code>
380 The
381 <code>limited</code>
382 and
383 <code>kod</code>
384 options return only entries representing client addresses from which the last packet received triggered either discarding or a KoD response. 
385 The
386 <code>mincount</code>=<kbd>count</kbd>
387 option filters entries representing less than
388 <kbd>count</kbd>
389 packets. 
390 The
391 <code>laddr</code>=<kbd>localaddr</kbd>
392 option filters entries for packets received on any local address other than
393 <kbd>localaddr</kbd>. 
394 <code>resany</code>=<kbd>hexmask</kbd>
395 and
396 <code>resall</code>=<kbd>hexmask</kbd>
397 filter entries containing none or less than all, respectively, of the bits in
398 <kbd>hexmask</kbd>,
399 which must begin with
400 <code>0x</code>. 
401 The
402 <kbd>sortorder</kbd>
403 defaults to
404 <code>lstint</code>
405 and may be any of
406 <code>addr</code>,
407 <code>count</code>,
408 <code>avgint</code>,
409 <code>lstint</code>,
410 or any of those preceded by a minus sign (hyphen) to reverse the sort order. 
411 The output columns are:
412           <dl>
413 <dt>Column<dd>Description
414 <br><dt><code>lstint</code><dd>Interval in s between the receipt of the most recent packet from this address and the completion of the retrieval of the MRU list by
415 <code>ntpq</code>
416 <br><dt><code>avgint</code><dd>Average interval in s between packets from this address. 
417 <br><dt><code>rstr</code><dd>Restriction flags associated with this address. 
418 Most are copied unchanged from the matching
419 <code>restrict</code>
420 command, however 0x400 (kod) and 0x20 (limited) flags are cleared unless the last packet from this address triggered a rate control response. 
421 <br><dt><code>r</code><dd>Rate control indicator, either
422 a period,
423 <code>L</code>
424 or
425 <code>K</code>
426 for no rate control response,
427 rate limiting by discarding, or rate limiting with a KoD response, respectively. 
428 <br><dt><code>m</code><dd>Packet mode. 
429 <br><dt><code>v</code><dd>Packet version number. 
430 <br><dt><code>count</code><dd>Packets received from this address. 
431 <br><dt><code>rport</code><dd>Source port of last packet from this address. 
432 <br><dt><code>remote</code> <code>address</code><dd>DNS name, numeric address, or address followed by
433 claimed DNS name which could not be verified in parentheses. 
434 </dl>
435      <br><dt><code>mreadvar</code> <code>assocID</code> <code>assocID</code> <code>[</code><kbd>variable_name</kbd><code>[=</code><kbd>value</kbd><code>] ...]</code><br><dt><code>mrv</code> <code>assocID</code> <code>assocID</code> <code>[</code><kbd>variable_name</kbd><code>[=</code><kbd>value</kbd><code>] ...]</code><dd>Perform the same function as the
436 <code>readvar</code>
437 command, except for a range of association IDs. 
438 This range is determined from the association list cached by the most recent
439 <code>associations</code>
440 command. 
441 <br><dt><code>opeers</code> <code>[-4 | -6]</code><dd>Obtain and print the old-style list of all peers and clients showing
442 <kbd>dstadr</kbd>
443 (associated with any given IP version),
444 rather than the
445 <kbd>refid</kbd>. 
446 <br><dt><code>passociations</code><dd>Perform the same function as the
447 <code>associations</code>
448 command,
449 except that it uses previously stored data rather than making a new query. 
450 <br><dt><code>peers</code><dd>Display a list of peers in the form:
451      <pre class="example">          [tally]remote refid st t when pool reach delay offset jitter
452      </pre>
453           <dl>
454 <dt>Variable<dd>Description
455 <br><dt><code>[tally]</code><dd>single-character code indicating current value of the
456 <code>select</code>
457 field of the
458 .Lk decode.html#peer "peer status word"
459 <br><dt><code>remote</code><dd>host name (or IP number) of peer. 
460 The value displayed will be truncated to 15 characters  unless the
461 <code>-w</code>
462 flag is given, in which case the full value will be displayed
463 on the first line,
464 and the remaining data is displayed on the next line. 
465 <br><dt><code>refid</code><dd>association ID or
466 .Lk decode.html#kiss "'kiss code"
467 <br><dt><code>st</code><dd>stratum
468 <br><dt><code>t</code><dd><code>u</code>:
469 unicast or manycast client,
470 <code>b</code>:
471 broadcast or multicast client,
472 <code>l</code>:
473 local (reference clock),
474 <code>s</code>:
475 symmetric (peer),
476 <code>A</code>:
477 manycast server,
478 <code>B</code>:
479 broadcast server,
480 <code>M</code>:
481 multicast server
482 <br><dt><code>when</code><dd>sec/min/hr since last received packet
483 <br><dt><code>poll</code><dd>poll interval (log2 s)
484 <br><dt><code>reach</code><dd>reach shift register (octal)
485 <br><dt><code>delay</code><dd>roundtrip delay
486 <br><dt><code>offset</code><dd>offset of server relative to this host
487 <br><dt><code>jitter</code><dd>jitter
488 </dl>
489      <br><dt><code>apeers</code><dd>Display a list of peers in the form:
490      <pre class="example">          [tally]remote refid assid st t when pool reach delay offset jitter
491      </pre>
492      <p>where the output is just like the
493 <code>peers</code>
494 command except that the
495 <code>refid</code>
496 is displayed in hex format and the association number is also displayed. 
497 <br><dt><code>pstats</code> <kbd>assocID</kbd><dd>Show the statistics for the peer with the given
498 <kbd>assocID</kbd>. 
499 <br><dt><code>readlist</code> <kbd>assocID</kbd><br><dt><code>rl</code> <kbd>assocID</kbd><dd>Read the system or peer variables included in the variable list. 
500 <br><dt><code>readvar</code> <kbd>assocID</kbd> <kbd>name</kbd><code>[=</code><kbd>value</kbd><code>]</code> <code>[, ...]</code><br><dt><code>rv</code> <kbd>assocID</kbd> <kbd>name</kbd><code>[=</code><kbd>value</kbd><code>]</code> <code>[, ...]</code><dd>Display the specified variables. 
501 If
502 <kbd>assocID</kbd>
503 is zero, the variables are from the
504 <a href="#System-Variables">System Variables</a>
505 name space, otherwise they are from the
506 <a href="#Peer-Variables">Peer Variables</a>
507 name space. 
508 The
509 <kbd>assocID</kbd>
510 is required, as the same name can occur in both spaces. 
511 If no
512 <kbd>name</kbd>
513 is included, all operative variables in the name space are displayed.
514
515      <p>In this case only, if the
516 <kbd>assocID</kbd>
517 is omitted, it is assumed zero. 
518 Multiple names are specified with comma separators and without whitespace. 
519 Note that time values are represented in milliseconds
520 and frequency values in parts-per-million (PPM). 
521 Some NTP timestamps are represented in the format
522 YYYYMMDDTTTT ,
523 where YYYY is the year,
524 MM the month of year,
525 DD the day of month and
526 TTTT the time of day. 
527 <br><dt><code>reslist</code><dd>Show the access control (restrict) list for
528 <code>ntpq</code>
529
530      <br><dt><code>saveconfig</code> <kbd>filename</kbd><dd>Write the current configuration,
531 including any runtime modifications given with
532 <code>:config</code>
533 or
534 <code>config-from-file</code>,
535 to the ntpd host's file
536 <kbd>filename</kbd>. 
537 This command will be rejected by the server unless
538 .Lk miscopt.html#saveconfigdir "saveconfigdir"
539 appears in the
540 <code>ntpd</code>
541 configuration file. 
542 <kbd>filename</kbd>
543 can use
544 <code>strftime()</code>
545 format specifies to substitute the current date and time, for example,
546 <code>q]saveconfig</code> <code>ntp-%Y%m%d-%H%M%S.confq]</code>. 
547 The filename used is stored in system variable
548 <code>savedconfig</code>. 
549 Authentication is required. 
550 <br><dt><code>timerstats</code><dd>Display interval timer counters. 
551 <br><dt><code>writelist</code> <kbd>assocID</kbd><dd>Write the system or peer variables included in the variable list. 
552 <br><dt><code>writevar</code> <kbd>assocID</kbd> <kbd>name</kbd>=<kbd>value</kbd> <code>[, ...]</code><dd>Write the specified variables. 
553 If the
554 <kbd>assocID</kbd>
555 is zero, the variables are from the
556 <a href="#System-Variables">System Variables</a>
557 name space, otherwise they are from the
558 <a href="#Peer-Variables">Peer Variables</a>
559 name space. 
560 The
561 <kbd>assocID</kbd>
562 is required, as the same name can occur in both spaces. 
563 <br><dt><code>sysinfo</code><dd>Display operational summary. 
564 <br><dt><code>sysstats</code><dd>Print statistics counters maintained in the protocol module. 
565 </dl>
566
567 <h5 class="subsubsection">Status Words and Kiss Codes</h5>
568
569 <p>The current state of the operating program is shown
570 in a set of status words
571 maintained by the system. 
572 Status information is also available on a per-association basis. 
573 These words are displayed in the
574 <code>rv</code>
575 and
576 <code>as</code>
577 commands both in hexadecimal and in decoded short tip strings. 
578 The codes, tips and short explanations are documented on the
579 .Lk decode.html "Event Messages and Status Words"
580 page. 
581 The page also includes a list of system and peer messages,
582 the code for the latest of which is included in the status word.
583
584   <p>Information resulting from protocol machine state transitions
585 is displayed using an informal set of ASCII strings called
586 .Lk decode.html#kiss "kiss codes" . 
587 The original purpose was for kiss-o'-death (KoD) packets
588 sent by the server to advise the client of an unusual condition. 
589 They are now displayed, when appropriate,
590 in the reference identifier field in various billboards.
591
592 <h5 class="subsubsection">System Variables</h5>
593
594 <p>The following system variables appear in the
595 <code>rv</code>
596 billboard. 
597 Not all variables are displayed in some configurations.
598      <dl>
599 <dt>Variable<dd>Description
600 <br><dt><code>status</code><dd>.Lk decode.html#sys "system status word"
601 <br><dt><code>version</code><dd>NTP software version and build time
602 <br><dt><code>processor</code><dd>hardware platform and version
603 <br><dt><code>system</code><dd>operating system and version
604 <br><dt><code>leap</code><dd>leap warning indicator (0-3)
605 <br><dt><code>stratum</code><dd>stratum (1-15)
606 <br><dt><code>precision</code><dd>precision (log2 s)
607 <br><dt><code>rootdelay</code><dd>total roundtrip delay to the primary reference clock
608 <br><dt><code>rootdisp</code><dd>total dispersion to the primary reference clock
609 <br><dt><code>peer</code><dd>system peer association ID
610 <br><dt><code>tc</code><dd>time constant and poll exponent (log2 s) (3-17)
611 <br><dt><code>mintc</code><dd>minimum time constant (log2 s) (3-10)
612 <br><dt><code>clock</code><dd>date and time of day
613 <br><dt><code>refid</code><dd>reference ID or
614 .Lk decode.html#kiss "kiss code"
615 <br><dt><code>reftime</code><dd>reference time
616 <br><dt><code>offset</code><dd>combined  offset of server relative to this host
617 <br><dt><code>sys_jitter</code><dd>combined system jitter
618 <br><dt><code>frequency</code><dd>frequency offset (PPM) relative to hardware clock
619 <br><dt><code>clk_wander</code><dd>clock frequency wander (PPM)
620 <br><dt><code>clk_jitter</code><dd>clock jitter
621 <br><dt><code>tai</code><dd>TAI-UTC offset (s)
622 <br><dt><code>leapsec</code><dd>NTP seconds when the next leap second is/was inserted
623 <br><dt><code>expire</code><dd>NTP seconds when the NIST leapseconds file expires
624 </dl>
625   The jitter and wander statistics are exponentially-weighted RMS averages. 
626 The system jitter is defined in the NTPv4 specification;
627 the clock jitter statistic is computed by the clock discipline module.
628
629   <p>When the NTPv4 daemon is compiled with the OpenSSL software library,
630 additional system variables are displayed,
631 including some or all of the following,
632 depending on the particular Autokey dance:
633
634      <dl>
635 <dt>Variable<dd>Description
636 <br><dt><code>host</code><dd>Autokey host name for this host
637 <br><dt><code>ident</code><dd>Autokey group name for this host
638 <br><dt><code>flags</code><dd>host flags  (see Autokey specification)
639 <br><dt><code>digest</code><dd>OpenSSL message digest algorithm
640 <br><dt><code>signature</code><dd>OpenSSL digest/signature scheme
641 <br><dt><code>update</code><dd>NTP seconds at last signature update
642 <br><dt><code>cert</code><dd>certificate subject, issuer and certificate flags
643 <br><dt><code>until</code><dd>NTP seconds when the certificate expires
644 </dl>
645
646 <h5 class="subsubsection">Peer Variables</h5>
647
648 <p>The following peer variables appear in the
649 <code>rv</code>
650 billboard for each association. 
651 Not all variables are displayed in some configurations.
652
653      <dl>
654 <dt>Variable<dd>Description
655 <br><dt><code>associd</code><dd>association ID
656 <br><dt><code>status</code><dd>.Lk decode.html#peer "peer status word"
657 <br><dt><code>srcadr</code><dd>source (remote) IP address
658 <br><dt><code>srcport</code><dd>source (remote) port
659 <br><dt><code>dstadr</code><dd>destination (local) IP address
660 <br><dt><code>dstport</code><dd>destination (local) port
661 <br><dt><code>leap</code><dd>leap indicator (0-3)
662 <br><dt><code>stratum</code><dd>stratum (0-15)
663 <br><dt><code>precision</code><dd>precision (log2 s)
664 <br><dt><code>rootdelay</code><dd>total roundtrip delay to the primary reference clock
665 <br><dt><code>rootdisp</code><dd>total root dispersion to the primary reference clock
666 <br><dt><code>refid</code><dd>reference ID or
667 .Lk decode.html#kiss "kiss code"
668 <br><dt><code>reftime</code><dd>reference time
669 <br><dt><code>reach</code><dd>reach register (octal)
670 <br><dt><code>unreach</code><dd>unreach counter
671 <br><dt><code>hmode</code><dd>host mode (1-6)
672 <br><dt><code>pmode</code><dd>peer mode (1-5)
673 <br><dt><code>hpoll</code><dd>host poll exponent (log2 s) (3-17)
674 <br><dt><code>ppoll</code><dd>peer poll exponent (log2 s) (3-17)
675 <br><dt><code>headway</code><dd>headway (see
676 .Lk rate.html "Rate Management and the Kiss-o'-Death Packet" )
677 <br><dt><code>flash</code><dd>.Lk decode.html#flash "flash status word"
678 <br><dt><code>offset</code><dd>filter offset
679 <br><dt><code>delay</code><dd>filter delay
680 <br><dt><code>dispersion</code><dd>filter dispersion
681 <br><dt><code>jitter</code><dd>filter jitter
682 <br><dt><code>ident</code><dd>Autokey group name for this association
683 <br><dt><code>bias</code><dd>unicast/broadcast bias
684 <br><dt><code>xleave</code><dd>interleave delay (see
685 .Lk xleave.html "NTP Interleaved Modes" )
686 </dl>
687   The
688 <code>bias</code>
689 variable is calculated when the first broadcast packet is received
690 after the calibration volley. 
691 It represents the offset of the broadcast subgraph relative to the unicast subgraph. 
692 The
693 <code>xleave</code>
694 variable appears only for the interleaved symmetric and interleaved modes. 
695 It represents the internal queuing, buffering and transmission delays
696 for the preceding packet.
697
698   <p>When the NTPv4 daemon is compiled with the OpenSSL software library,
699 additional peer variables are displayed, including the following:
700      <dl>
701 <dt>Variable<dd>Description
702 <br><dt><code>flags</code><dd>peer flags (see Autokey specification)
703 <br><dt><code>host</code><dd>Autokey server name
704 <br><dt><code>flags</code><dd>peer flags (see Autokey specification)
705 <br><dt><code>signature</code><dd>OpenSSL digest/signature scheme
706 <br><dt><code>initsequence</code><dd>initial key ID
707 <br><dt><code>initkey</code><dd>initial key index
708 <br><dt><code>timestamp</code><dd>Autokey signature timestamp
709 </dl>
710
711 <h5 class="subsubsection">Clock Variables</h5>
712
713 <p>The following clock variables appear in the
714 <code>cv</code>
715 billboard for each association with a reference clock. 
716 Not all variables are displayed in some configurations.
717      <dl>
718 <dt>Variable<dd>Description
719 <br><dt><code>associd</code><dd>association ID
720 <br><dt><code>status</code><dd>.Lk decode.html#clock "clock status word"
721 <br><dt><code>device</code><dd>device description
722 <br><dt><code>timecode</code><dd>ASCII time code string (specific to device)
723 <br><dt><code>poll</code><dd>poll messages sent
724 <br><dt><code>noreply</code><dd>no reply
725 <br><dt><code>badformat</code><dd>bad format
726 <br><dt><code>baddata</code><dd>bad date or time
727 <br><dt><code>fudgetime1</code><dd>fudge time 1
728 <br><dt><code>fudgetime2</code><dd>fudge time 2
729 <br><dt><code>stratum</code><dd>driver stratum
730 <br><dt><code>refid</code><dd>driver reference ID
731 <br><dt><code>flags</code><dd>driver flags
732 </dl>
733
734   <p>This section was generated by <strong>AutoGen</strong>,
735 using the <code>agtexi-cmd</code> template and the option descriptions for the <code>ntpq</code> program. 
736 This software is released under the NTP license, &lt;http://ntp.org/license&gt;.
737
738 <ul class="menu">
739 <li><a accesskey="1" href="#ntpq-usage">ntpq usage</a>:                   ntpq help/usage (<span class="option">--help</span>)
740 <li><a accesskey="2" href="#ntpq-ipv4">ntpq ipv4</a>:                    ipv4 option (-4)
741 <li><a accesskey="3" href="#ntpq-ipv6">ntpq ipv6</a>:                    ipv6 option (-6)
742 <li><a accesskey="4" href="#ntpq-command">ntpq command</a>:                 command option (-c)
743 <li><a accesskey="5" href="#ntpq-interactive">ntpq interactive</a>:             interactive option (-i)
744 <li><a accesskey="6" href="#ntpq-numeric">ntpq numeric</a>:                 numeric option (-n)
745 <li><a accesskey="7" href="#ntpq-old_002drv">ntpq old-rv</a>:                  old-rv option
746 <li><a accesskey="8" href="#ntpq-peers">ntpq peers</a>:                   peers option (-p)
747 <li><a accesskey="9" href="#ntpq-wide">ntpq wide</a>:                    wide option (-w)
748 <li><a href="#ntpq-config">ntpq config</a>:                  presetting/configuring ntpq
749 <li><a href="#ntpq-exit-status">ntpq exit status</a>:             exit status
750 </ul>
751
752 <div class="node">
753 <p><hr>
754 <a name="ntpq-usage"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#ntpq-ipv4">ntpq ipv4</a>,
755 Up:&nbsp;<a rel="up" accesskey="u" href="#ntpq-Invocation">ntpq Invocation</a>
756 <br>
757 </div>
758
759 <h4 class="subsection">ntpq help/usage (<span class="option">--help</span>)</h4>
760
761 <p><a name="index-ntpq-help-3"></a>
762 This is the automatically generated usage text for ntpq.
763
764   <p>The text printed is the same whether selected with the <code>help</code> option
765 (<span class="option">--help</span>) or the <code>more-help</code> option (<span class="option">--more-help</span>).  <code>more-help</code> will print
766 the usage text by passing it through a pager program. 
767 <code>more-help</code> is disabled on platforms without a working
768 <code>fork(2)</code> function.  The <code>PAGER</code> environment variable is
769 used to select the program, defaulting to <span class="file">more</span>.  Both will exit
770 with a status code of 0.
771
772 <pre class="example">ntpq - standard NTP query program - Ver. 4.2.8p4
773 Usage:  ntpq [ -&lt;flag&gt; [&lt;val&gt;] | --&lt;name&gt;[{=| }&lt;val&gt;] ]... [ host ...]
774   Flg Arg Option-Name    Description
775    -4 no  ipv4           Force IPv4 DNS name resolution
776                                 - prohibits the option 'ipv6'
777    -6 no  ipv6           Force IPv6 DNS name resolution
778                                 - prohibits the option 'ipv4'
779    -c Str command        run a command and exit
780                                 - may appear multiple times
781    -d no  debug-level    Increase debug verbosity level
782                                 - may appear multiple times
783    -D Num set-debug-level Set the debug verbosity level
784                                 - may appear multiple times
785    -i no  interactive    Force ntpq to operate in interactive mode
786                                 - prohibits these options:
787                                 command
788                                 peers
789    -n no  numeric        numeric host addresses
790       no  old-rv         Always output status line with readvar
791    -p no  peers          Print a list of the peers
792                                 - prohibits the option 'interactive'
793    -w no  wide           Display the full 'remote' value
794       opt version        output version information and exit
795    -? no  help           display extended usage information and exit
796    -! no  more-help      extended usage information passed thru pager
797    -&gt; opt save-opts      save the option state to a config file
798    -&lt; Str load-opts      load options from a config file
799                                 - disabled as '--no-load-opts'
800                                 - may appear multiple times
801
802 Options are specified by doubled hyphens and their name or by a single
803 hyphen and the flag character.
804
805 The following option preset mechanisms are supported:
806  - reading file $HOME/.ntprc
807  - reading file ./.ntprc
808  - examining environment variables named NTPQ_*
809
810 Please send bug reports to:  &lt;http://bugs.ntp.org, bugs@ntp.org&gt;
811 </pre>
812   <div class="node">
813 <p><hr>
814 <a name="ntpq-ipv4"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#ntpq-ipv6">ntpq ipv6</a>,
815 Previous:&nbsp;<a rel="previous" accesskey="p" href="#ntpq-usage">ntpq usage</a>,
816 Up:&nbsp;<a rel="up" accesskey="u" href="#ntpq-Invocation">ntpq Invocation</a>
817 <br>
818 </div>
819
820 <h4 class="subsection">ipv4 option (-4)</h4>
821
822 <p><a name="index-ntpq_002dipv4-4"></a>
823 This is the &ldquo;force ipv4 dns name resolution&rdquo; option.
824
825 <p class="noindent">This option has some usage constraints.  It:
826      <ul>
827 <li>must not appear in combination with any of the following options:
828 ipv6. 
829 </ul>
830
831   <p>Force DNS resolution of following host names on the command line
832 to the IPv4 namespace. 
833 <div class="node">
834 <p><hr>
835 <a name="ntpq-ipv6"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#ntpq-command">ntpq command</a>,
836 Previous:&nbsp;<a rel="previous" accesskey="p" href="#ntpq-ipv4">ntpq ipv4</a>,
837 Up:&nbsp;<a rel="up" accesskey="u" href="#ntpq-Invocation">ntpq Invocation</a>
838 <br>
839 </div>
840
841 <h4 class="subsection">ipv6 option (-6)</h4>
842
843 <p><a name="index-ntpq_002dipv6-5"></a>
844 This is the &ldquo;force ipv6 dns name resolution&rdquo; option.
845
846 <p class="noindent">This option has some usage constraints.  It:
847      <ul>
848 <li>must not appear in combination with any of the following options:
849 ipv4. 
850 </ul>
851
852   <p>Force DNS resolution of following host names on the command line
853 to the IPv6 namespace. 
854 <div class="node">
855 <p><hr>
856 <a name="ntpq-command"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#ntpq-interactive">ntpq interactive</a>,
857 Previous:&nbsp;<a rel="previous" accesskey="p" href="#ntpq-ipv6">ntpq ipv6</a>,
858 Up:&nbsp;<a rel="up" accesskey="u" href="#ntpq-Invocation">ntpq Invocation</a>
859 <br>
860 </div>
861
862 <h4 class="subsection">command option (-c)</h4>
863
864 <p><a name="index-ntpq_002dcommand-6"></a>
865 This is the &ldquo;run a command and exit&rdquo; option. 
866 This option takes a string argument <span class="file">cmd</span>.
867
868 <p class="noindent">This option has some usage constraints.  It:
869      <ul>
870 <li>may appear an unlimited number of times. 
871 </ul>
872
873   <p>The following argument is interpreted as an interactive format command
874 and is added to the list of commands to be executed on the specified
875 host(s). 
876 <div class="node">
877 <p><hr>
878 <a name="ntpq-interactive"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#ntpq-numeric">ntpq numeric</a>,
879 Previous:&nbsp;<a rel="previous" accesskey="p" href="#ntpq-command">ntpq command</a>,
880 Up:&nbsp;<a rel="up" accesskey="u" href="#ntpq-Invocation">ntpq Invocation</a>
881 <br>
882 </div>
883
884 <h4 class="subsection">interactive option (-i)</h4>
885
886 <p><a name="index-ntpq_002dinteractive-7"></a>
887 This is the &ldquo;force ntpq to operate in interactive mode&rdquo; option.
888
889 <p class="noindent">This option has some usage constraints.  It:
890      <ul>
891 <li>must not appear in combination with any of the following options:
892 command, peers. 
893 </ul>
894
895   <p>Force <code>ntpq</code> to operate in interactive mode. 
896 Prompts will be written to the standard output and
897 commands read from the standard input. 
898 <div class="node">
899 <p><hr>
900 <a name="ntpq-numeric"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#ntpq-old_002drv">ntpq old-rv</a>,
901 Previous:&nbsp;<a rel="previous" accesskey="p" href="#ntpq-interactive">ntpq interactive</a>,
902 Up:&nbsp;<a rel="up" accesskey="u" href="#ntpq-Invocation">ntpq Invocation</a>
903 <br>
904 </div>
905
906 <h4 class="subsection">numeric option (-n)</h4>
907
908 <p><a name="index-ntpq_002dnumeric-8"></a>
909 This is the &ldquo;numeric host addresses&rdquo; option. 
910 Output all host addresses in dotted-quad numeric format rather than
911 converting to the canonical host names. 
912 <div class="node">
913 <p><hr>
914 <a name="ntpq-old_002drv"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#ntpq-peers">ntpq peers</a>,
915 Previous:&nbsp;<a rel="previous" accesskey="p" href="#ntpq-numeric">ntpq numeric</a>,
916 Up:&nbsp;<a rel="up" accesskey="u" href="#ntpq-Invocation">ntpq Invocation</a>
917 <br>
918 </div>
919
920 <h4 class="subsection">old-rv option</h4>
921
922 <p><a name="index-ntpq_002dold_002drv-9"></a>
923 This is the &ldquo;always output status line with readvar&rdquo; option. 
924 By default, <code>ntpq</code> now suppresses the <code>associd=...</code>
925 line that precedes the output of <code>readvar</code>
926 (alias <code>rv</code>) when a single variable is requested, such as
927 <code>ntpq -c "rv 0 offset"</code>. 
928 This option causes <code>ntpq</code> to include both lines of output
929 for a single-variable <code>readvar</code>. 
930 Using an environment variable to
931 preset this option in a script will enable both older and
932 newer <code>ntpq</code> to behave identically in this regard. 
933 <div class="node">
934 <p><hr>
935 <a name="ntpq-peers"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#ntpq-wide">ntpq wide</a>,
936 Previous:&nbsp;<a rel="previous" accesskey="p" href="#ntpq-old_002drv">ntpq old-rv</a>,
937 Up:&nbsp;<a rel="up" accesskey="u" href="#ntpq-Invocation">ntpq Invocation</a>
938 <br>
939 </div>
940
941 <h4 class="subsection">peers option (-p)</h4>
942
943 <p><a name="index-ntpq_002dpeers-10"></a>
944 This is the &ldquo;print a list of the peers&rdquo; option.
945
946 <p class="noindent">This option has some usage constraints.  It:
947      <ul>
948 <li>must not appear in combination with any of the following options:
949 interactive. 
950 </ul>
951
952   <p>Print a list of the peers known to the server as well as a summary
953 of their state. This is equivalent to the 'peers' interactive command. 
954 <div class="node">
955 <p><hr>
956 <a name="ntpq-wide"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#ntpq-config">ntpq config</a>,
957 Previous:&nbsp;<a rel="previous" accesskey="p" href="#ntpq-peers">ntpq peers</a>,
958 Up:&nbsp;<a rel="up" accesskey="u" href="#ntpq-Invocation">ntpq Invocation</a>
959 <br>
960 </div>
961
962 <h4 class="subsection">wide option (-w)</h4>
963
964 <p><a name="index-ntpq_002dwide-11"></a>
965 This is the &ldquo;display the full 'remote' value&rdquo; option. 
966 Display the full value of the 'remote' value.  If this requires
967 more than 15 characters, display the full value, emit a newline,
968 and continue the data display properly indented on the next line.
969
970 <div class="node">
971 <p><hr>
972 <a name="ntpq-config"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#ntpq-exit-status">ntpq exit status</a>,
973 Previous:&nbsp;<a rel="previous" accesskey="p" href="#ntpq-wide">ntpq wide</a>,
974 Up:&nbsp;<a rel="up" accesskey="u" href="#ntpq-Invocation">ntpq Invocation</a>
975 <br>
976 </div>
977
978 <h4 class="subsection">presetting/configuring ntpq</h4>
979
980 <p>Any option that is not marked as <i>not presettable</i> may be preset by
981 loading values from configuration ("rc" or "ini") files, and values from environment variables named <code>NTPQ</code> and <code>NTPQ_&lt;OPTION_NAME&gt;</code>.  <code>&lt;OPTION_NAME&gt;</code> must be one of
982 the options listed above in upper case and segmented with underscores. 
983 The <code>NTPQ</code> variable will be tokenized and parsed like
984 the command line.  The remaining variables are tested for existence and their
985 values are treated like option arguments.
986
987 <p class="noindent"><code>libopts</code> will search in 2 places for configuration files:
988      <ul>
989 <li>$HOME
990 <li>$PWD
991 </ul>
992   The environment variables <code>HOME</code>, and <code>PWD</code>
993 are expanded and replaced when <span class="file">ntpq</span> runs. 
994 For any of these that are plain files, they are simply processed. 
995 For any that are directories, then a file named <span class="file">.ntprc</span> is searched for
996 within that directory and processed.
997
998   <p>Configuration files may be in a wide variety of formats. 
999 The basic format is an option name followed by a value (argument) on the
1000 same line.  Values may be separated from the option name with a colon,
1001 equal sign or simply white space.  Values may be continued across multiple
1002 lines by escaping the newline with a backslash.
1003
1004   <p>Multiple programs may also share the same initialization file. 
1005 Common options are collected at the top, followed by program specific
1006 segments.  The segments are separated by lines like:
1007 <pre class="example">    [NTPQ]
1008 </pre>
1009   <p class="noindent">or by
1010 <pre class="example">    &lt;?program ntpq&gt;
1011 </pre>
1012   <p class="noindent">Do not mix these styles within one configuration file.
1013
1014   <p>Compound values and carefully constructed string values may also be
1015 specified using XML syntax:
1016 <pre class="example">    &lt;option-name&gt;
1017        &lt;sub-opt&gt;...&amp;lt;...&amp;gt;...&lt;/sub-opt&gt;
1018     &lt;/option-name&gt;
1019 </pre>
1020   <p class="noindent">yielding an <code>option-name.sub-opt</code> string value of
1021 <pre class="example">    "...&lt;...&gt;..."
1022 </pre>
1023   <p><code>AutoOpts</code> does not track suboptions.  You simply note that it is a
1024 hierarchicly valued option.  <code>AutoOpts</code> does provide a means for searching
1025 the associated name/value pair list (see: optionFindValue).
1026
1027   <p>The command line options relating to configuration and/or usage help are:
1028
1029 <h5 class="subsubheading">version (-)</h5>
1030
1031 <p>Print the program version to standard out, optionally with licensing
1032 information, then exit 0.  The optional argument specifies how much licensing
1033 detail to provide.  The default is to print just the version.  The licensing infomation may be selected with an option argument. 
1034 Only the first letter of the argument is examined:
1035
1036      <dl>
1037 <dt><span class="samp">version</span><dd>Only print the version.  This is the default. 
1038 <br><dt><span class="samp">copyright</span><dd>Name the copyright usage licensing terms. 
1039 <br><dt><span class="samp">verbose</span><dd>Print the full copyright usage licensing terms. 
1040 </dl>
1041
1042 <div class="node">
1043 <p><hr>
1044 <a name="ntpq-exit-status"></a>Previous:&nbsp;<a rel="previous" accesskey="p" href="#ntpq-config">ntpq config</a>,
1045 Up:&nbsp;<a rel="up" accesskey="u" href="#ntpq-Invocation">ntpq Invocation</a>
1046 <br>
1047 </div>
1048
1049 <h4 class="subsection">ntpq exit status</h4>
1050
1051 <p>One of the following exit values will be returned:
1052      <dl>
1053 <dt><span class="samp">0 (EXIT_SUCCESS)</span><dd>Successful program execution. 
1054 <br><dt><span class="samp">1 (EXIT_FAILURE)</span><dd>The operation failed or the command syntax was not valid. 
1055 <br><dt><span class="samp">66 (EX_NOINPUT)</span><dd>A specified configuration file could not be loaded. 
1056 <br><dt><span class="samp">70 (EX_SOFTWARE)</span><dd>libopts had an internal operational error.  Please report
1057 it to autogen-users@lists.sourceforge.net.  Thank you. 
1058 </dl>
1059
1060 <div class="node">
1061 <p><hr>
1062 <a name="Usage"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#Internal-Commands">Internal Commands</a>,
1063 Previous:&nbsp;<a rel="previous" accesskey="p" href="#ntpq-Description">ntpq Description</a>,
1064 Up:&nbsp;<a rel="up" accesskey="u" href="#Top">Top</a>
1065 <br>
1066 </div>
1067
1068 <!-- node-name,  next,  previous,  up -->
1069 <h3 class="section">Usage</h3>
1070
1071 <p><table summary=""><tr align="left"><th valign="top" width="23%">What </th><th valign="top" width="23%">Default </th><th valign="top" width="5%">Flag </th><th valign="top" width="15%">Option
1072 <br></th></tr><tr align="left"><td valign="top" width="23%">configuration file
1073 </td><td valign="top" width="23%"><code>/etc/ntp.conf</code>
1074 </td><td valign="top" width="5%"><code>-c</code>
1075 </td><td valign="top" width="15%"><code>conffile</code>
1076 <br></td></tr><tr align="left"><td valign="top" width="23%">frequency file
1077 </td><td valign="top" width="23%">none
1078 </td><td valign="top" width="5%"><code>-f</code>
1079 </td><td valign="top" width="15%"><code>driftfile</code>
1080 <br></td></tr><tr align="left"><td valign="top" width="23%">leapseconds file
1081 </td><td valign="top" width="23%">none
1082 </td><td valign="top" width="5%">
1083 </td><td valign="top" width="15%"><code>leapfile</code>
1084 <br></td></tr><tr align="left"><td valign="top" width="23%">process ID file
1085 </td><td valign="top" width="23%">none
1086 </td><td valign="top" width="5%"><code>-p</code>
1087 </td><td valign="top" width="15%"><code>pidfile</code>
1088 <br></td></tr><tr align="left"><td valign="top" width="23%">log file
1089 </td><td valign="top" width="23%">system log
1090 </td><td valign="top" width="5%"><code>-l</code>
1091 </td><td valign="top" width="15%"><code>logfile</code>
1092 <br></td></tr><tr align="left"><td valign="top" width="23%">include file
1093 </td><td valign="top" width="23%">none
1094 </td><td valign="top" width="5%">none
1095 </td><td valign="top" width="15%"><code>includefile</code>
1096 <br></td></tr><tr align="left"><td valign="top" width="23%">statistics path
1097 </td><td valign="top" width="23%"><code>/var/NTP</code>
1098 </td><td valign="top" width="5%"><code>-s</code>
1099 </td><td valign="top" width="15%"><code>statsdir</code>
1100 <br></td></tr><tr align="left"><td valign="top" width="23%">keys path
1101 </td><td valign="top" width="23%"><code>/usr/local/etc</code>
1102 </td><td valign="top" width="5%"><code>-k</code>
1103 </td><td valign="top" width="15%"><code>keysdir</code>
1104 <br></td></tr></table>
1105
1106 <div class="node">
1107 <p><hr>
1108 <a name="Internal-Commands"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#Control-Message-Commands">Control Message Commands</a>,
1109 Previous:&nbsp;<a rel="previous" accesskey="p" href="#Usage">Usage</a>,
1110 Up:&nbsp;<a rel="up" accesskey="u" href="#Top">Top</a>
1111 <br>
1112 </div>
1113
1114 <!-- node-name,  next,  previous,  up -->
1115 <h3 class="section">Internal Commands</h3>
1116
1117 <p>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 <code>&gt;</code>, followed by a file name, to the command line.  A number of interactive format commands are executed entirely within the <code>ntpq</code> program itself and do not result in NTP mode-6 requests being sent to a server.  These are described following.
1118
1119      <dl>
1120 <dt><code><a name="help"></a> ? [</code><kbd>command_keyword</kbd><code>]</code><dt><code>help [</code><kbd>command_keyword</kbd><code>]</code><dd>A <code>?</code> by itself will print a list of all the command keywords known to <code>ntpq</code>.  A <code>?</code> followed by a command keyword will print function and usage information about the command.
1121
1122      <br><dt><code><a name="addvars"></a> &gt;addvars </code><kbd>name</kbd><code> [ = </code><kbd>value</kbd><code>] [...]</code><dt><code>rmvars </code><kbd>name</kbd><code> [...]</code><dt><code>clearvars&lt;/dt&gt;</code><dd>The arguments to these commands consist of a list of items of the form
1123 <kbd>name</kbd><code> = </code><kbd>value</kbd>, where the <code>= </code><kbd>value</kbd> is ignored,
1124 and can be omitted in read requests. 
1125 <code>ntpq</code> maintains an internal list in which data to be included
1126 in control messages can be assembled, and sent using the <code>readlist</code>
1127 and <code>writelist</code> commands described below. 
1128 The <code>addvars</code> command allows variables and optional values
1129 to be added to the list. 
1130 If more than one variable is to be added
1131 the list should be comma-separated and not contain white space. 
1132 The <code>rmvars</code> command can be used to remove individual variables
1133 from the list,
1134 while the <code>clearlist</code> command removes all variables from the list.
1135
1136      <br><dt><code><a name="cooked"></a> cooked</code><dd>Display server messages in prettyprint format.
1137
1138      <br><dt><code><a name="debug"></a> debug more | less | off</code><dd>Turns internal query program debugging on and off.
1139
1140      <br><dt><code><a name="delay"></a> delay </code><kbd>milliseconds</kbd><dd>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.
1141
1142      <br><dt><code><a name="host"></a> host </code><kbd>name</kbd><dd>Set the host to which future queries will be sent. 
1143 The name may be either a DNS name or a numeric address.
1144
1145      <br><dt><code><a name="hostnames"></a> hostnames [yes | no]</code><dd>If <code>yes</code> is specified, host names are printed in information displays. 
1146 If <code>no</code> is specified, numeric addresses are printed instead. 
1147 The default is <code>yes</code>,
1148 unless modified using the command line <code>-n</code> switch.
1149
1150      <br><dt><code><a name="keyid"></a> keyid </code><kbd>keyid</kbd><dd>This command specifies the key number to be used
1151 to authenticate configuration requests. 
1152 This must correspond to a key ID configured in <code>ntp.conf</code> for this purpose.
1153
1154      <br><dt><code><a name="keytype"></a> keytype</code><dd>Specify the digest algorithm to use for authenticated requests,
1155 with default <code>MD5</code>. 
1156 If the OpenSSL library is installed,
1157 digest can be be any message digest algorithm supported by the library. 
1158 The current selections are: <code>MD2</code>, <code>MD4</code>, <code>MD5</code>, <code>MDC2</code>, <code>RIPEMD160</code>, <code>SHA</code> and <code>SHA1</code>.
1159
1160      <br><dt><code><a name="ntpversion"></a> ntpversion 1 | 2 | 3 | 4</code><dd>Sets the NTP version number which <code>ntpq</code> claims in packets. 
1161 Defaults to 2. 
1162 Note that mode-6 control messages (and modes, for that matter)
1163 didn't exist in NTP version 1.
1164
1165      <br><dt><code><a name="passwd"></a> passwd</code><dd>This command prompts for a password to authenticate requests. 
1166 The password must correspond to the key ID configured in <code>ntp.conf</code> for this purpose.
1167
1168      <br><dt><code><a name="quit"></a> quit</code><dd>Exit <code>ntpq</code>.
1169
1170      <br><dt><code><a name="raw"></a> raw</code><dd>Display server messages as received and without reformatting.
1171
1172      <br><dt><code><a name="timeout"></a> timeout </code><kbd>millseconds</kbd><dd>Specify a timeout period for responses to server queries. 
1173 The default is about 5000 milliseconds. 
1174 Note that since <code>ntpq</code> retries each query once after a timeout
1175 the total waiting time for a timeout will be twice the timeout value set.
1176
1177   </dl>
1178
1179 <div class="node">
1180 <p><hr>
1181 <a name="Control-Message-Commands"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#Status-Words-and-Kiss-Codes">Status Words and Kiss Codes</a>,
1182 Previous:&nbsp;<a rel="previous" accesskey="p" href="#Internal-Commands">Internal Commands</a>,
1183 Up:&nbsp;<a rel="up" accesskey="u" href="#Top">Top</a>
1184 <br>
1185 </div>
1186
1187 <!-- node-name,  next,  previous,  up -->
1188 <h3 class="section">Control Message Commands</h3>
1189
1190 <p>Association IDs are used to identify system, peer and clock variables. 
1191 System variables are assigned an association ID of zero and system name space,
1192 while each association is assigned a nonzero association ID and peer namespace. 
1193 Most control commands send a single mode-6 message to the server
1194 and expect a single response message. 
1195 The exceptions are the <code>peers</code> command,
1196 which sends a series of messages,
1197 and the <code>mreadlist</code> and <code>mreadvar</code> commands,
1198 which iterate over a range of associations.
1199
1200   <p><a name="as"></a>
1201      <dl>
1202 <dt><code>associations</code><dd>Display a list of mobilized associations in the form:
1203 <br>
1204 <code>ind assid status conf reach auth condition last_event cnt</code>
1205
1206      <p><table summary=""><tr align="left"><th valign="top" width="10%">Variable </th><th valign="top" width="40%">Description
1207
1208      <p><br></th></tr><tr align="left"><td valign="top" width="10%"><code>ind</code>
1209 </td><td valign="top" width="40%">index on this list
1210
1211      <p><br></td></tr><tr align="left"><td valign="top" width="10%"><code>assid</code>
1212 </td><td valign="top" width="40%">association ID
1213
1214      <p><br></td></tr><tr align="left"><td valign="top" width="10%"><code>status</code>
1215 </td><td valign="top" width="40%"><a href="decode.html#peer">peer status word</a>
1216
1217      <p><br></td></tr><tr align="left"><td valign="top" width="10%"><code>conf</code>
1218 </td><td valign="top" width="40%"><code>yes</code>: persistent, <code>no</code>: ephemeral
1219
1220      <p><br></td></tr><tr align="left"><td valign="top" width="10%"><code>reach</code>
1221 </td><td valign="top" width="40%"><code>yes</code>: reachable, <code>no</code>: unreachable
1222
1223      <p><br></td></tr><tr align="left"><td valign="top" width="10%"><code>auth</code>
1224 </td><td valign="top" width="40%"><code>ok</code>, <code>yes</code>, <code>bad</code> and <code>none</code>
1225
1226      <p><br></td></tr><tr align="left"><td valign="top" width="10%"><code>condition</code>
1227 </td><td valign="top" width="40%">selection status (see the <code>select</code> field of the <a href="decode.html#peer">peer status word</a>)
1228
1229      <p><br></td></tr><tr align="left"><td valign="top" width="10%"><code>last_event</code>
1230 </td><td valign="top" width="40%">event report (see the <code>event</code> field of the <a href="decode.html#peer">peer status word</a>)
1231
1232      <p><br></td></tr><tr align="left"><td valign="top" width="10%"><code>cnt</code>
1233 event count (see the <code>count</code> field of the <a href="decode.html#peer">peer status word</a>)
1234
1235      <br></td></tr></table>
1236
1237      <br><dt><code><a name="cv"></a> clockvar </code><kbd>assocID</kbd><code> [</code><kbd>name</kbd><code> [ = </code><kbd>value</kbd><code> [...]] [...]]</code><dt><code>cv </code><kbd>assocID</kbd><code> [</code><kbd>name</kbd><code> [ = </code><kbd>value</kbd><code> [...] ][...]]</code><dd>Display a list of <a href="#clock">clock variables</a> for those associations supporting a reference clock.
1238
1239      <br><dt><code><a name="_003aconfig"></a> :config [...]</code><dd>Send the remainder of the command line, including whitespace, to the server
1240 as a run-time configuration command in the same format
1241 as the configuration file. 
1242 This command is experimental until further notice and clarification. 
1243 Authentication is of course required.
1244
1245      <br><dt><code><a name="config_002dfrom_002dfile"></a> config-from-file </code><kbd>filename</kbd><dd>Send the each line of <kbd>filename</kbd> to the server as
1246 run-time configuration commands in the same format as the configuration file. 
1247 This command is experimental until further notice and clarification. 
1248 Authentication is required.
1249
1250      <br><dt><code><a name="ifstats"></a> ifstats</code><dd>Display statistics for each local network address. 
1251 Authentication is required.
1252
1253      <br><dt><code><a name="iostats"></a> iostats</code><dd>Display network and reference clock I/O statistics.
1254
1255      <br><dt><code><a name="kerninfo"></a> kerninfo</code><dd>Display kernel loop and PPS statistics. 
1256 As with other ntpq output, times are in milliseconds. 
1257 The precision value displayed is in milliseconds as well,
1258 unlike the precision system variable.
1259
1260      <br><dt><code><a name="lassoc"></a> lassociations</code><dd>Perform the same function as the associations command,
1261 except display mobilized and unmobilized associations.
1262
1263      <br><dt><code><a name="monstats"></a> monstats</code><dd>Display monitor facility statistics.
1264
1265      <br><dt><code><a name="mrulist"></a> mrulist [limited | kod | mincount=</code><kbd>count</kbd><code> | laddr=</code><kbd>localaddr</kbd><code> | sort=</code><kbd>sortorder</kbd><code> | resany=</code><kbd>hexmask</kbd><code> | resall=</code><kbd>hexmask</kbd><code>]</code><dd>Obtain and print traffic counts collected and maintained by
1266 the monitor facility. 
1267 With the exception of <code>sort=</code><kbd>sortorder</kbd>,
1268 the options filter the list returned by <code>ntpd</code>. 
1269 The <code>limited</code> and <code>kod</code> options return only entries
1270 representing client addresses from which the last packet received
1271 triggered either discarding or a KoD response. 
1272 The <code>mincount=</code><kbd>count</kbd> option filters entries representing
1273 less than <kbd>count</kbd> packets. 
1274 The <code>laddr=</code><kbd>localaddr</kbd> option filters entries for packets
1275 received on any local address other than <kbd>localaddr</kbd>. 
1276 <code>resany=</code><kbd>hexmask</kbd> and <code>resall=</code><kbd>hexmask</kbd>
1277 filter entries containing none or less than all, respectively,
1278 of the bits in <kbd>hexmask</kbd>, which must begin with <code>0x</code>. 
1279 <br>
1280 The <kbd>sortorder</kbd> defaults to <code>lstint</code> and may be any of
1281 <code>addr</code>, <code>count</code>, <code>avgint</code>, <code>lstint</code>, or
1282 any of those preceded by a minus sign (hyphen) to reverse the sort order. 
1283 The output columns are:
1284
1285      <p><table summary=""><tr align="left"><th valign="top" width="10%">Column </th><th valign="top" width="40%">Description
1286
1287      <p><br></th></tr><tr align="left"><td valign="top" width="10%"><code>lstint</code>
1288 </td><td valign="top" width="40%">
1289 Interval in s between the receipt of the most recent packet from this
1290 address and the completion of the retrieval of the MRU list by <code>ntpq</code>
1291
1292      <p><br></td></tr><tr align="left"><td valign="top" width="10%"><code>avgint</code>
1293 </td><td valign="top" width="40%">
1294 Average interval in s between packets from this address.
1295
1296      <p><br></td></tr><tr align="left"><td valign="top" width="10%"><code>rstr</code>
1297 </td><td valign="top" width="40%">
1298 Restriction flags associated with this address. 
1299 Most are copied unchanged from the matching <code>restrict</code> command,
1300 however 0x400 (kod) and 0x20 (limited) flags are cleared unless
1301 the last packet from this address triggered a rate control response.
1302
1303      <p><br></td></tr><tr align="left"><td valign="top" width="10%"><code>r</code>
1304 </td><td valign="top" width="40%">
1305 Rate control indicator, either a period, <code>L</code> or <code>K</code> for
1306 no rate control response, rate limiting by discarding, or
1307 rate limiting with a KoD response, respectively.
1308
1309      <p><br></td></tr><tr align="left"><td valign="top" width="10%"><code>m</code>
1310 </td><td valign="top" width="40%">
1311 Packet mode. 
1312 <br></td></tr><tr align="left"><td valign="top" width="10%"><code>v</code>
1313 </td><td valign="top" width="40%">
1314 Packet version number.
1315
1316      <p><br></td></tr><tr align="left"><td valign="top" width="10%"><code>count</code>
1317 </td><td valign="top" width="40%">
1318 Packets received from this address.
1319
1320      <p><br></td></tr><tr align="left"><td valign="top" width="10%"><code>rport</code>
1321 </td><td valign="top" width="40%">
1322 Source port of last packet from this address.
1323
1324      <p><br></td></tr><tr align="left"><td valign="top" width="10%"><code>remote address</code>
1325 </td><td valign="top" width="40%">
1326 DNS name, numeric address, or address followed by claimed DNS name which
1327 could not be verified in parentheses.
1328
1329      <br></td></tr></table>
1330
1331      <br><dt><code><a name="mreadvar"></a> mreadvar </code><kbd>assocID</kbd> <kbd>assocID</kbd><code> [ </code><kbd>variable_name</kbd><code> [ = </code><kbd>value</kbd><code>[ ... ]</code><dt><code><a name="mrv"></a> mrv </code><kbd>assocID</kbd> <kbd>assocID</kbd><code> [ </code><kbd>variable_name</kbd><code> [ = </code><kbd>value</kbd><code>[ ... ]</code><dd>Perform the same function as the <code>readvar</code> command,
1332 except for a range of association IDs. 
1333 This range is determined from the association list cached by
1334 the most recent <code>associations</code> command.
1335
1336      <br><dt><code><a name="passoc"></a> passociations</code><dd>Perform the same function as the <code>associations command</code>, except that
1337 it uses previously stored data rather than making a new query.
1338
1339      <br><dt><code><a name="pe"></a> peers</code><dd>Display a list of peers in the form:
1340 <br>
1341 <code>[tally]remote refid st t when pool reach delay offset jitter</code>
1342
1343      <p><table summary=""><tr align="left"><th valign="top" width="10%">Variable </th><th valign="top" width="20%">Description
1344 <br></th></tr><tr align="left"><td valign="top" width="10%"><code>[tally]</code>
1345 </td><td valign="top" width="20%">
1346 single-character code indicating current value of the <code>select</code> field
1347 of the <a href="decode.html#peer">peer status word</a>.
1348
1349      <p><br></td></tr><tr align="left"><td valign="top" width="10%"><code>remote</code>
1350 </td><td valign="top" width="20%">
1351 host name (or IP number) of peer
1352
1353      <p><br></td></tr><tr align="left"><td valign="top" width="10%"><code>refid</code>
1354 </td><td valign="top" width="20%">
1355 association ID or <a href="decode.html#kiss">kiss code</a>.
1356
1357      <p><br></td></tr><tr align="left"><td valign="top" width="10%"><code>st</code>
1358 </td><td valign="top" width="20%">
1359 stratum
1360
1361      <p><br></td></tr><tr align="left"><td valign="top" width="10%"><code>t</code>
1362 </td><td valign="top" width="20%">
1363 <code>u</code>: unicast or manycast client,
1364 <code>b</code>: broadcast or multicast client,
1365 <code>l</code>: local (reference clock),
1366 <code>s</code>: symmetric (peer),
1367 <code>A</code>: manycast server,
1368 <code>B</code>: broadcast server,
1369 <code>M</code>: multicast server.
1370
1371      <p><br></td></tr><tr align="left"><td valign="top" width="10%"><code>when</code>
1372 </td><td valign="top" width="20%">
1373 sec/min/hr since last received packet
1374
1375      <p><br></td></tr><tr align="left"><td valign="top" width="10%"><code>poll</code>
1376 </td><td valign="top" width="20%">
1377 poll interval (log(2) s)
1378
1379      <p><br></td></tr><tr align="left"><td valign="top" width="10%"><code>reach</code>
1380 </td><td valign="top" width="20%">
1381 reach shift register (octal)
1382
1383      <p><br></td></tr><tr align="left"><td valign="top" width="10%"><code>delay</code>
1384 </td><td valign="top" width="20%">
1385 roundtrip delay
1386
1387      <p><br></td></tr><tr align="left"><td valign="top" width="10%"><code>offset</code>
1388 </td><td valign="top" width="20%">
1389 offset of server relative to this host
1390
1391      <p><br></td></tr><tr align="left"><td valign="top" width="10%"><code>jitter</code>
1392 </td><td valign="top" width="20%">
1393 jitter
1394
1395      <br></td></tr></table>
1396
1397      <br><dt><code><a name="rv"></a> readvar </code><kbd>assocID</kbd> <kbd>name</kbd><code> [ = </code><kbd>value</kbd><code> ] [,...]</code><dt><code>rv </code><kbd>assocID</kbd><code> [ </code><kbd>name</kbd><code> ] [,...]</code><dd>Display the specified variables. 
1398 If <kbd>assocID</kbd> is zero,
1399 the variables are from the <a href="#system">system variables</a> name space,
1400 otherwise they are from the <a href="#peer">peer variables</a> name space. 
1401 The <kbd>assocID</kbd> is required, as the same name can occur in both spaces. 
1402 If no <kbd>name</kbd> is included,
1403 all operative variables in the name space are displayed. 
1404 In this case only, if the <kbd>assocID</kbd> is omitted, it is assumed zero. 
1405 Multiple names are specified with comma separators and without whitespace. 
1406 Note that time values are represented in milliseconds and
1407 frequency values in parts-per-million (PPM). 
1408 Some NTP timestamps are represented in the format YYYYMMDDTTTT,
1409 where YYYY is the year, MM the month of year, DD the day of month and
1410 TTTT the time of day.
1411
1412      <br><dt><code><a name="saveconfig"></a> saveconfig </code><kbd>filename</kbd><dd>Write the current configuration, including any runtime modifications
1413 given with <code>:config</code> or <code>config-from-file</code>,
1414 to the ntpd host's file <kbd>filename</kbd>. 
1415 This command will be rejected by the server unless
1416 <a href="miscopt.html#saveconfigdir">saveconfigdir</a>
1417 appears in the <code>ntpd</code> configuration file. 
1418 <kbd>filename</kbd> can use <code>strftime()</code> format specifiers
1419 to substitute the current date and time, for example,
1420 <code>saveconfig ntp-%Y%m%d-%H%M%S.conf</code>. 
1421 The filename used is stored in system variable <code>savedconfig</code>. 
1422 Authentication is required.
1423
1424      <br><dt><code><a name="writevar"></a> writevar </code><kbd>assocID</kbd> <kbd>name</kbd><code> = </code><kbd>value</kbd><code> [,...]</code><dd>Write the specified variables. 
1425 If the <kbd>assocID</kbd> is zero, the variables are from the
1426 <a href="#system">system variables</a> name space, otherwise they are from the
1427 <a href="#peer">peer variables</a> name space. 
1428 The <kbd>assocID</kbd> is required,
1429 as the same name can occur in both spaces.
1430
1431      <br><dt><code><a name="sysinfo"></a> sysinfo</code><dd>Display operational summary.
1432
1433      <br><dt><code><a name="sysstats"></a> sysstats</code><dd>Print statistics counters maintained in the protocol module.
1434
1435   </dl>
1436
1437 <div class="node">
1438 <p><hr>
1439 <a name="Status-Words-and-Kiss-Codes"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#System-Variables">System Variables</a>,
1440 Previous:&nbsp;<a rel="previous" accesskey="p" href="#Control-Message-Commands">Control Message Commands</a>,
1441 Up:&nbsp;<a rel="up" accesskey="u" href="#Top">Top</a>
1442 <br>
1443 </div>
1444
1445 <!-- node-name,  next,  previous,  up -->
1446 <h3 class="section">Status Words and Kiss Codes</h3>
1447
1448 <p>The current state of the operating program is shown
1449 in a set of status words maintained by the system
1450 and each association separately. 
1451 These words are displayed in the <code>rv</code> and <code>as</code> commands
1452 both in hexadecimal and decoded short tip strings. 
1453 The codes, tips and short explanations are on the
1454 <a href="decode.html">Event Messages and Status Words</a> page. 
1455 The page also includes a list of system and peer messages,
1456 the code for the latest of which is included in the status word.
1457
1458   <p>Information resulting from protocol machine state transitions
1459 is displayed using an informal set of ASCII strings called
1460 <a href="decode.html#kiss">kiss codes</a>. 
1461 The original purpose was for kiss-o'-death (KoD) packets sent
1462 by the server to advise the client of an unusual condition. 
1463 They are now displayed, when appropriate,
1464 in the reference identifier field in various billboards.
1465
1466 <div class="node">
1467 <p><hr>
1468 <a name="System-Variables"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#Peer-Variables">Peer Variables</a>,
1469 Previous:&nbsp;<a rel="previous" accesskey="p" href="#Status-Words-and-Kiss-Codes">Status Words and Kiss Codes</a>,
1470 Up:&nbsp;<a rel="up" accesskey="u" href="#Top">Top</a>
1471 <br>
1472 </div>
1473
1474 <!-- node-name,  next,  previous,  up -->
1475 <h3 class="section">System Variables</h3>
1476
1477 <p>The following system variables appear in the <code>rv</code> billboard. 
1478 Not all variables are displayed in some configurations.
1479
1480   <p><table summary=""><tr align="left"><th valign="top" width="10%">Variable </th><th valign="top" width="20%">Description
1481
1482 <p><br></th></tr><tr align="left"><td valign="top" width="10%"><code>status</code>
1483 </td><td valign="top" width="20%">
1484 <a href="decode.html#sys">system status word</a>
1485
1486 <p><br></td></tr><tr align="left"><td valign="top" width="10%"><code>version</code>
1487 </td><td valign="top" width="20%">
1488 NTP software version and build time
1489
1490 <p><br></td></tr><tr align="left"><td valign="top" width="10%"><code>processor</code>
1491 </td><td valign="top" width="20%">
1492 hardware platform and version
1493
1494 <p><br></td></tr><tr align="left"><td valign="top" width="10%"><code>system</code>
1495 </td><td valign="top" width="20%">
1496 operating system and version
1497
1498 <p><br></td></tr><tr align="left"><td valign="top" width="10%"><code>leap</code>
1499 </td><td valign="top" width="20%">
1500 leap warning indicator (0-3)
1501
1502 <p><br></td></tr><tr align="left"><td valign="top" width="10%"><code>stratum</code>
1503 </td><td valign="top" width="20%">
1504 stratum (1-15)
1505
1506 <p><br></td></tr><tr align="left"><td valign="top" width="10%"><code>precision</code>
1507 </td><td valign="top" width="20%">
1508 precision (log(2) s)
1509
1510 <p><br></td></tr><tr align="left"><td valign="top" width="10%"><code>rootdelay</code>
1511 </td><td valign="top" width="20%">
1512 total roundtrip delay to the primary reference clock
1513
1514 <p><br></td></tr><tr align="left"><td valign="top" width="10%"><code>rootdisp</code>
1515 </td><td valign="top" width="20%">
1516 total dispersion to the primary reference clock
1517
1518 <p><br></td></tr><tr align="left"><td valign="top" width="10%"><code>peer</code>
1519 </td><td valign="top" width="20%">
1520 system peer association ID
1521
1522 <p><br></td></tr><tr align="left"><td valign="top" width="10%"><code>tc</code>
1523 time constant and poll exponent (log(2) s) (3-17)
1524
1525   <p><br></td></tr><tr align="left"><td valign="top" width="10%"><code>mintc</code>
1526 minimum time constant (log(2) s) (3-10)
1527
1528   <p><br></td></tr><tr align="left"><td valign="top" width="10%"><code>clock</code>
1529 </td><td valign="top" width="20%">
1530 date and time of day
1531
1532 <p><br></td></tr><tr align="left"><td valign="top" width="10%"><code>refid</code>
1533 reference ID or <a href="decode.html#kiss">kiss code</a>
1534
1535   <p><br></td></tr><tr align="left"><td valign="top" width="10%"><code>reftime</code>
1536 </td><td valign="top" width="20%">
1537 reference time
1538
1539 <p><br></td></tr><tr align="left"><td valign="top" width="10%"><code>offset</code>
1540 </td><td valign="top" width="20%">
1541 combined offset of server relative to this host
1542
1543 <p><br></td></tr><tr align="left"><td valign="top" width="10%"><code>sys_jitter</code>
1544 </td><td valign="top" width="20%">
1545 combined system jitter
1546
1547 <p><br></td></tr><tr align="left"><td valign="top" width="10%"><code>frequency</code>
1548 </td><td valign="top" width="20%">
1549 frequency offset (PPM) relative to hardware clock
1550
1551 <p><br></td></tr><tr align="left"><td valign="top" width="10%"><code>clk_wander</code>
1552 </td><td valign="top" width="20%">
1553 clock frequency wander (PPM)
1554
1555 <p><br></td></tr><tr align="left"><td valign="top" width="10%"><code>clk_jitter</code>
1556 </td><td valign="top" width="20%">
1557 clock jitter
1558
1559 <p><br></td></tr><tr align="left"><td valign="top" width="10%"><code>tai</code>
1560 </td><td valign="top" width="20%">
1561 TAI-UTC offset (s)
1562
1563 <p><br></td></tr><tr align="left"><td valign="top" width="10%"><code>leapsec</code>
1564 </td><td valign="top" width="20%">
1565 NTP seconds when the next leap second is/was inserted
1566
1567 <p><br></td></tr><tr align="left"><td valign="top" width="10%"><code>expire</code>
1568 </td><td valign="top" width="20%">
1569 NTP seconds when the NIST leapseconds file expires
1570
1571   <br></td></tr></table>
1572
1573   <p>The jitter and wander statistics are exponentially-weighted RMS averages. 
1574 The system jitter is defined in the NTPv4 specification;
1575 the clock jitter statistic is computed by the clock discipline module.
1576
1577   <p>When the NTPv4 daemon is compiled with the OpenSSL software library,
1578 additional system variables are displayed, including some or all of the
1579 following, depending on the particular Autokey dance:
1580
1581   <p><table summary=""><tr align="left"><th valign="top" width="10%">Variable </th><th valign="top" width="20%">Description
1582
1583 <p><br></th></tr><tr align="left"><td valign="top" width="10%"><code>host</code>
1584 </td><td valign="top" width="20%">
1585 Autokey host name for this host
1586
1587 <p><br></td></tr><tr align="left"><td valign="top" width="10%"><code>ident</code>
1588 </td><td valign="top" width="20%">
1589 Autokey group name for this host
1590
1591 <p><br></td></tr><tr align="left"><td valign="top" width="10%"><code>flags</code>
1592 </td><td valign="top" width="20%">
1593 host flags  (see Autokey specification)
1594
1595 <p><br></td></tr><tr align="left"><td valign="top" width="10%"><code>digest</code>
1596 </td><td valign="top" width="20%">
1597 OpenSSL message digest algorithm
1598
1599 <p><br></td></tr><tr align="left"><td valign="top" width="10%"><code>signature</code>
1600 </td><td valign="top" width="20%">
1601 OpenSSL digest/signature scheme
1602
1603 <p><br></td></tr><tr align="left"><td valign="top" width="10%"><code>update</code>
1604 </td><td valign="top" width="20%">
1605 NTP seconds at last signature update
1606
1607 <p><br></td></tr><tr align="left"><td valign="top" width="10%"><code>cert</code>
1608 </td><td valign="top" width="20%">
1609 certificate subject, issuer and certificate flags
1610
1611 <p><br></td></tr><tr align="left"><td valign="top" width="10%"><code>until</code>
1612 </td><td valign="top" width="20%">
1613 NTP seconds when the certificate expires
1614
1615   <br></td></tr></table>
1616
1617 <div class="node">
1618 <p><hr>
1619 <a name="Peer-Variables"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#Clock-Variables">Clock Variables</a>,
1620 Previous:&nbsp;<a rel="previous" accesskey="p" href="#System-Variables">System Variables</a>,
1621 Up:&nbsp;<a rel="up" accesskey="u" href="#Top">Top</a>
1622 <br>
1623 </div>
1624
1625 <!-- node-name,  next,  previous,  up -->
1626 <h3 class="section">Peer Variables</h3>
1627
1628 <p>The following peer variables appear in the <code>rv</code> billboard
1629 for each association. 
1630 Not all variables are displayed in some configurations.
1631
1632   <p><table summary=""><tr align="left"><th valign="top" width="10%">Variable </th><th valign="top" width="20%">Description
1633
1634 <p><br></th></tr><tr align="left"><td valign="top" width="10%"><code>associd</code>
1635 </td><td valign="top" width="20%">
1636 association ID
1637
1638 <p><br></td></tr><tr align="left"><td valign="top" width="10%"><code>status</code>
1639 </td><td valign="top" width="20%">
1640 <a href="decode.html#peer">peer status word</a>
1641
1642 <p><br></td></tr><tr align="left"><td valign="top" width="10%"><code>srcadr</code>
1643 <br></td></tr><tr align="left"><td valign="top" width="10%"><code>srcport</code>
1644 </td><td valign="top" width="20%">
1645 source (remote) IP address and port
1646
1647 <p><br></td></tr><tr align="left"><td valign="top" width="10%"><code>dstadr</code>
1648 <br></td></tr><tr align="left"><td valign="top" width="10%"><code>dstport</code>
1649 </td><td valign="top" width="20%">
1650 destination (local) IP address and port
1651
1652 <p><br></td></tr><tr align="left"><td valign="top" width="10%"><code>leap</code>
1653 </td><td valign="top" width="20%">
1654 leap indicator (0-3)
1655
1656 <p><br></td></tr><tr align="left"><td valign="top" width="10%"><code>stratum</code>
1657 </td><td valign="top" width="20%">
1658 stratum (0-15)
1659
1660 <p><br></td></tr><tr align="left"><td valign="top" width="10%"><code>precision</code>
1661 </td><td valign="top" width="20%">
1662 precision (log(2) s)
1663
1664 <p><br></td></tr><tr align="left"><td valign="top" width="10%"><code>rootdelay</code>
1665 </td><td valign="top" width="20%">
1666 total roundtrip delay to the primary reference clock
1667
1668 <p><br></td></tr><tr align="left"><td valign="top" width="10%"><code>rootdisp</code>
1669 </td><td valign="top" width="20%">total root dispersion to the primary reference clock
1670
1671 <p><br></td></tr><tr align="left"><td valign="top" width="10%"><code>refid</code>
1672 </td><td valign="top" width="20%">
1673 reference ID or <a href="decode.html#kiss">kiss code</a>
1674
1675 <p><br></td></tr><tr align="left"><td valign="top" width="10%"><code>reftime</code>
1676 </td><td valign="top" width="20%">
1677 reference time
1678
1679 <p><br></td></tr><tr align="left"><td valign="top" width="10%"><code>reach</code>
1680 </td><td valign="top" width="20%">
1681 reach register (octal)
1682
1683 <p><br></td></tr><tr align="left"><td valign="top" width="10%"><code>unreach</code>
1684 </td><td valign="top" width="20%">
1685 unreach counter
1686
1687 <p><br></td></tr><tr align="left"><td valign="top" width="10%"><code>hmode</code>
1688 </td><td valign="top" width="20%">
1689 host mode (1-6)
1690
1691 <p><br></td></tr><tr align="left"><td valign="top" width="10%"><code>pmode</code>
1692 </td><td valign="top" width="20%">
1693 peer mode (1-5)
1694
1695 <p><br></td></tr><tr align="left"><td valign="top" width="10%"><code>hpoll</code>
1696 </td><td valign="top" width="20%">
1697 host poll exponent (log(2) s) (3-17)
1698 <br></td></tr><tr align="left"><td valign="top" width="10%"><code>ppoll</code>
1699 </td><td valign="top" width="20%">
1700 peer poll exponent (log(2) s) (3-17)
1701
1702 <p><br></td></tr><tr align="left"><td valign="top" width="10%"><code>headway</code>
1703 </td><td valign="top" width="20%">
1704 headway (see <a href="rate.html">Rate Management and the Kiss-o'-Death Packet</a>)
1705
1706 <p><br></td></tr><tr align="left"><td valign="top" width="10%"><code>flash</code>
1707 </td><td valign="top" width="20%">
1708 <a href="decode.html#flash">flash status word</a>
1709
1710 <p><br></td></tr><tr align="left"><td valign="top" width="10%"><code>offset</code>
1711 </td><td valign="top" width="20%">
1712 filter offset
1713
1714 <p><br></td></tr><tr align="left"><td valign="top" width="10%"><code>delay</code>
1715 </td><td valign="top" width="20%">
1716 filter delay
1717
1718 <p><br></td></tr><tr align="left"><td valign="top" width="10%"><code>dispersion</code>
1719 </td><td valign="top" width="20%">
1720 filter dispersion
1721
1722 <p><br></td></tr><tr align="left"><td valign="top" width="10%"><code>jitter</code>
1723 </td><td valign="top" width="20%">
1724 filter jitter
1725
1726 <p><br></td></tr><tr align="left"><td valign="top" width="10%"><code>ident</code>
1727 </td><td valign="top" width="20%">
1728 Autokey group name for this association
1729
1730 <p><br></td></tr><tr align="left"><td valign="top" width="10%"><code>bias</code>
1731 </td><td valign="top" width="20%">
1732 unicast/broadcast bias
1733
1734 <p><br></td></tr><tr align="left"><td valign="top" width="10%"><code>xleave</code>
1735 </td><td valign="top" width="20%">
1736 interleave delay (see <a href="xleave.html">NTP Interleaved Modes</a>)
1737
1738   <br></td></tr></table>
1739
1740   <p>The bias variable is calculated when the first broadcast packet is received
1741 after the calibration volley.  It represents the offset of the broadcast
1742 subgraph relative to the unicast subgraph.  The xleave variable appears
1743 only the interleaved symmetric and interleaved modes.  It represents
1744 the internal queuing, buffering and transmission delays for the preceding
1745 packet.
1746
1747   <p>When the NTPv4 daemon is compiled with the OpenSSL software library,
1748 additional peer variables are displayed, including the following:
1749
1750   <p><table summary=""><tr align="left"><th valign="top" width="10%">Variable </th><th valign="top" width="20%">Description
1751
1752 <p><br></th></tr><tr align="left"><td valign="top" width="10%"><code>flags</code>
1753 </td><td valign="top" width="20%">
1754 peer flags (see Autokey specification)
1755
1756 <p><br></td></tr><tr align="left"><td valign="top" width="10%"><code>host</code>
1757 </td><td valign="top" width="20%">
1758 Autokey server name
1759
1760 <p><br></td></tr><tr align="left"><td valign="top" width="10%"><code>flags</code>
1761 </td><td valign="top" width="20%">
1762 peer flags (see Autokey specification)
1763
1764 <p><br></td></tr><tr align="left"><td valign="top" width="10%"><code>signature</code>
1765 </td><td valign="top" width="20%">
1766 OpenSSL digest/signature scheme
1767
1768 <p><br></td></tr><tr align="left"><td valign="top" width="10%"><code>initsequence</code>
1769 </td><td valign="top" width="20%">
1770 initial key ID
1771
1772 <p><br></td></tr><tr align="left"><td valign="top" width="10%"><code>initkey</code>
1773 </td><td valign="top" width="20%">
1774 initial key index
1775
1776 <p><br></td></tr><tr align="left"><td valign="top" width="10%"><code>timestamp</code>
1777 </td><td valign="top" width="20%">
1778 Autokey signature timestamp
1779
1780   <br></td></tr></table>
1781
1782 <div class="node">
1783 <p><hr>
1784 <a name="Clock-Variables"></a>Previous:&nbsp;<a rel="previous" accesskey="p" href="#Peer-Variables">Peer Variables</a>,
1785 Up:&nbsp;<a rel="up" accesskey="u" href="#Top">Top</a>
1786 <br>
1787 </div>
1788
1789 <!-- node-name,  next,  previous,  up -->
1790 <h3 class="section">Clock Variables</h3>
1791
1792 <p>The following clock variables appear in the <code>cv</code> billboard for each association with a reference clock.  Not all variables are displayed in some configurations.
1793
1794   <p><table summary=""><tr align="left"><th valign="top" width="10%">Variable </th><th valign="top" width="20%">Description
1795 <br></th></tr><tr align="left"><td valign="top" width="10%"><code>associd</code>
1796 </td><td valign="top" width="20%">association ID
1797 <br></td></tr><tr align="left"><td valign="top" width="10%"><code>status</code>
1798 </td><td valign="top" width="20%"><a href="decode.html#clock">clock status word</a>
1799 <br></td></tr><tr align="left"><td valign="top" width="10%"><code>device</code>
1800 </td><td valign="top" width="20%">device description
1801 <br></td></tr><tr align="left"><td valign="top" width="10%"><code>timecode</code>
1802 </td><td valign="top" width="20%">ASCII time code string (specific to device)
1803 <br></td></tr><tr align="left"><td valign="top" width="10%"><code>poll</code>
1804 </td><td valign="top" width="20%">poll messages sent
1805 <br></td></tr><tr align="left"><td valign="top" width="10%"><code>noreply</code>
1806 </td><td valign="top" width="20%">no reply
1807 <br></td></tr><tr align="left"><td valign="top" width="10%"><code>badformat</code>
1808 </td><td valign="top" width="20%">bad format
1809 <br></td></tr><tr align="left"><td valign="top" width="10%"><code>baddata</code>
1810 </td><td valign="top" width="20%">bad date or time
1811 <br></td></tr><tr align="left"><td valign="top" width="10%"><code>fudgetime1</code>
1812 </td><td valign="top" width="20%">fudge time 1
1813 <br></td></tr><tr align="left"><td valign="top" width="10%"><code>fudgetime2</code>
1814 </td><td valign="top" width="20%">fudge time 2
1815 <br></td></tr><tr align="left"><td valign="top" width="10%"><code>stratum</code>
1816 </td><td valign="top" width="20%">driver stratum
1817 <br></td></tr><tr align="left"><td valign="top" width="10%"><code>refid</code>
1818 </td><td valign="top" width="20%">driver reference ID
1819 <br></td></tr><tr align="left"><td valign="top" width="10%"><code>flags</code>
1820 </td><td valign="top" width="20%">driver flags
1821   <br></td></tr></table>
1822
1823 </body></html>
1824