ntpq.8 revision 294904
1169689Skan.Dd January 20 2016
2169689Skan.Dt NTPQ 8 User Commands
3169689Skan.Os
4169689Skan.\"  EDIT THIS FILE WITH CAUTION  (ntpq-opts.mdoc)
5169689Skan.\"
6169689Skan.\" $FreeBSD: releng/10.2/usr.sbin/ntp/doc/ntpq.8 294904 2016-01-27 07:41:31Z delphij $
7169689Skan.\"
8169689Skan.\"  It has been AutoGen-ed  January 20, 2016 at 04:19:12 AM by AutoGen 5.18.5
9169689Skan.\"  From the definitions    ntpq-opts.def
10169689Skan.\"  and the template file   agmdoc-cmd.tpl
11169689Skan.Sh NAME
12169689Skan.Nm ntpq
13169689Skan.Nd standard NTP query program
14169689Skan.Sh SYNOPSIS
15169689Skan.Nm
16169689Skan.\" Mixture of short (flag) options and long options
17169689Skan.Op Fl flags
18169689Skan.Op Fl flag Op Ar value
19169689Skan.Op Fl \-option\-name Ns Oo Oo Ns "=| " Oc Ns Ar value Oc
20169689Skan[ host ...]
21169689Skan.Pp
22169689Skan.Sh DESCRIPTION
23169689SkanThe
24169689Skan.Nm
25169689Skanutility program is used to query NTP servers which
26169689Skanimplement the standard NTP mode 6 control message formats defined
27169689Skanin Appendix B of the NTPv3 specification RFC1305, requesting
28169689Skaninformation about current state and/or changes in that state.
29169689SkanThe same formats are used in NTPv4, although some of the
30169689Skanvariables have changed and new ones added. The description on this
31169689Skanpage is for the NTPv4 variables.
32169689SkanThe program may be run either in interactive mode or controlled using
33169689Skancommand line arguments.
34169689SkanRequests to read and write arbitrary
35169689Skanvariables can be assembled, with raw and pretty\-printed output
36169689Skanoptions being available.
37169689SkanThe
38169689Skan.Nm
39169689Skanutility can also obtain and print a
40169689Skanlist of peers in a common format by sending multiple queries to the
41169689Skanserver.
42169689SkanIf one or more request options is included on the command line
43169689Skanwhen
44169689Skan.Nm
45169689Skanis executed, each of the requests will be sent
46169689Skanto the NTP servers running on each of the hosts given as command
47169689Skanline arguments, or on localhost by default.
48169689SkanIf no request options
49169689Skanare given,
50169689Skan.Nm
51169689Skanwill attempt to read commands from the
52169689Skanstandard input and execute these on the NTP server running on the
53169689Skanfirst host given on the command line, again defaulting to localhost
54169689Skanwhen no other host is specified.
55169689SkanThe
56169689Skan.Nm
57169689Skanutility will prompt for
58169689Skancommands if the standard input is a terminal device.
59169689Skan.Nm
60169689Skanuses NTP mode 6 packets to communicate with the
61169689SkanNTP server, and hence can be used to query any compatible server on
62169689Skanthe network which permits it.
63169689SkanNote that since NTP is a UDP protocol
64169689Skanthis communication will be somewhat unreliable, especially over
65169689Skanlarge distances in terms of network topology.
66169689SkanThe
67169689Skan.Nm
68169689Skanutility makes
69169689Skanone attempt to retransmit requests, and will time requests out if
70169689Skanthe remote host is not heard from within a suitable timeout
71169689Skantime.
72169689SkanSpecifying a
73169689Skancommand line option other than
74169689Skan.Fl i
75169689Skanor
76169689Skan.Fl n
77169689Skanwill
78169689Skancause the specified query (queries) to be sent to the indicated
79169689Skanhost(s) immediately.
80169689SkanOtherwise,
81169689Skan.Nm
82169689Skanwill attempt to read
83169689Skaninteractive format commands from the standard input.
84169689Skan.Ss "Internal Commands"
85169689SkanInteractive format commands consist of a keyword followed by zero
86169689Skanto four arguments.
87169689SkanOnly enough characters of the full keyword to
88169689Skanuniquely identify the command need be typed.
89169689SkanA
90169689Skannumber of interactive format commands are executed entirely within
91169689Skanthe
92169689Skan.Nm
93169689Skanutility itself and do not result in NTP mode 6
94169689Skanrequests being sent to a server.
95169689SkanThese are described following.
96169689Skan.Bl -tag -width "? [command_keyword]" -compact -offset indent
97169689Skan.It Ic ? Op  Ar command_keyword
98169689Skan.It Ic help Op Ar command_keyword
99169689SkanA
100169689Skan.Ql \&?
101169689Skanby itself will print a list of all the command
102169689Skankeywords known to this incarnation of
103169689Skan.Nm .
104169689SkanA
105169689Skan.Ql \&?
106169689Skanfollowed by a command keyword will print function and usage
107169689Skaninformation about the command.
108169689SkanThis command is probably a better
109169689Skansource of information about
110169689Skan.Nm
111169689Skanthan this manual
112169689Skanpage.
113169689Skan.It Ic addvars Ar variable_name Ns Xo Op Ic =value
114169689Skan.Ic ...
115169689Skan.Xc
116169689Skan.It Ic rmvars Ar variable_name Ic ...
117169689Skan.It Ic clearvars
118169689Skan.It Ic showvars
119169689SkanThe data carried by NTP mode 6 messages consists of a list of
120169689Skanitems of the form
121169689Skan.Ql variable_name=value ,
122169689Skanwhere the
123169689Skan.Ql =value
124169689Skanis ignored, and can be omitted,
125169689Skanin requests to the server to read variables.
126169689SkanThe
127169689Skan.Nm
128169689Skanutility maintains an internal list in which data to be included in control
129169689Skanmessages can be assembled, and sent using the
130169689Skan.Ic readlist
131169689Skanand
132169689Skan.Ic writelist
133169689Skancommands described below.
134169689SkanThe
135169689Skan.Ic addvars
136169689Skancommand allows variables and their optional values to be added to
137169689Skanthe list.
138169689SkanIf more than one variable is to be added, the list should
139169689Skanbe comma\-separated and not contain white space.
140169689SkanThe
141169689Skan.Ic rmvars
142169689Skancommand can be used to remove individual variables from the list,
143169689Skanwhile the
144169689Skan.Ic clearlist
145169689Skancommand removes all variables from the
146169689Skanlist.
147169689SkanThe
148169689Skan.Ic showvars
149169689Skancommand displays the current list of optional variables.
150169689Skan.It Ic authenticate Op yes | no
151169689SkanNormally
152169689Skan.Nm
153169689Skandoes not authenticate requests unless
154169689Skanthey are write requests.
155169689SkanThe command
156169689Skan.Ql authenticate yes
157169689Skancauses
158169689Skan.Nm
159169689Skanto send authentication with all requests it
160169689Skanmakes.
161169689SkanAuthenticated requests causes some servers to handle
162169689Skanrequests slightly differently, and can occasionally melt the CPU in
163169689Skanfuzzballs if you turn authentication on before doing a
164169689Skan.Ic peer
165169689Skandisplay.
166169689SkanThe command
167169689Skan.Ql authenticate
168169689Skancauses
169169689Skan.Nm
170169689Skanto display whether or not
171169689Skan.Nm
172169689Skanis currently autheinticating requests.
173169689Skan.It Ic cooked
174169689SkanCauses output from query commands to be "cooked", so that
175169689Skanvariables which are recognized by
176169689Skan.Nm
177169689Skanwill have their
178169689Skanvalues reformatted for human consumption.
179169689SkanVariables which
180169689Skan.Nm
181169689Skanthinks should have a decodable value but didn't are
182169689Skanmarked with a trailing
183169689Skan.Ql \&? .
184169689Skan.It Xo
185169689Skan.Ic debug
186169689Skan.Oo
187169689Skan.Cm more |
188169689Skan.Cm less |
189169689Skan.Cm off
190169689Skan.Oc
191169689Skan.Xc
192169689SkanWith no argument, displays the current debug level.
193169689SkanOtherwise, the debug level is changed to the indicated level.
194169689Skan.It Ic delay Ar milliseconds
195169689SkanSpecify a time interval to be added to timestamps included in
196169689Skanrequests which require authentication.
197169689SkanThis is used to enable
198169689Skan(unreliable) server reconfiguration over long delay network paths
199169689Skanor between machines whose clocks are unsynchronized.
200169689SkanActually the
201169689Skanserver does not now require timestamps in authenticated requests,
202169689Skanso this command may be obsolete.
203169689Skan.It Ic exit
204169689SkanExit
205169689Skan.Nm .
206169689Skan.It Ic host Ar hostname
207169689SkanSet the host to which future queries will be sent.
208169689Skan.Ar hostname
209169689Skanmay be either a host name or a numeric address.
210169689Skan.It Ic hostnames Op Cm yes | Cm no
211169689SkanIf
212169689Skan.Cm yes
213169689Skanis specified, host names are printed in
214169689Skaninformation displays.
215169689SkanIf
216169689Skan.Cm no
217169689Skanis specified, numeric
218169689Skanaddresses are printed instead.
219169689SkanThe default is
220169689Skan.Cm yes ,
221169689Skanunless
222169689Skanmodified using the command line
223169689Skan.Fl n
224169689Skanswitch.
225169689Skan.It Ic keyid Ar keyid
226169689SkanThis command allows the specification of a key number to be
227169689Skanused to authenticate configuration requests.
228169689SkanThis must correspond
229169689Skanto the
230169689Skan.Cm controlkey
231169689Skankey number the server has been configured to use for this
232169689Skanpurpose.
233169689Skan.It Ic keytype Xo Oo
234169689Skan.Cm md5 |
235169689Skan.Cm OpenSSLDigestType
236169689Skan.Oc
237169689Skan.Xc
238169689SkanSpecify the type of key to use for authenticating requests.
239169689Skan.Cm md5
240169689Skanis alway supported.
241169689SkanIf
242169689Skan.Nm
243169689Skanwas built with OpenSSL support,
244169689Skanany digest type supported by OpenSSL can also be provided.
245169689SkanIf no argument is given, the current
246169689Skan.Ic keytype
247169689Skanis displayed.
248169689Skan.It Ic ntpversion Xo Oo
249169689Skan.Cm 1 |
250169689Skan.Cm 2 |
251169689Skan.Cm 3 |
252169689Skan.Cm 4
253169689Skan.Oc
254169689Skan.Xc
255169689SkanSets the NTP version number which
256169689Skan.Nm
257169689Skanclaims in
258169689Skanpackets.
259169689SkanDefaults to 3, and note that mode 6 control messages (and
260169689Skanmodes, for that matter) didn't exist in NTP version 1.
261169689SkanThere appear
262169689Skanto be no servers left which demand version 1.
263169689SkanWith no argument, displays the current NTP version that will be used
264169689Skanwhen communicating with servers.
265169689Skan.It Ic passwd
266169689SkanThis command prompts you to type in a password (which will not
267169689Skanbe echoed) which will be used to authenticate configuration
268169689Skanrequests.
269169689SkanThe password must correspond to the key configured for
270169689Skanuse by the NTP server for this purpose if such requests are to be
271169689Skansuccessful.
272169689Skan.\" Not yet implemented.
273169689Skan.\" .It Ic poll
274169689Skan.\" .Op Ar n
275169689Skan.\" .Op Ic verbose
276169689Skan.\" Poll an NTP server in client mode
277169689Skan.\" .Ar n
278169689Skan.\" times.
279169689Skan.It Ic quit
280169689SkanExit
281169689Skan.Nm .
282169689Skan.It Ic raw
283169689SkanCauses all output from query commands is printed as received
284169689Skanfrom the remote server.
285169689SkanThe only formating/interpretation done on
286169689Skanthe data is to transform nonascii data into a printable (but barely
287169689Skanunderstandable) form.
288169689Skan.It Ic timeout Ar milliseconds
289169689SkanSpecify a timeout period for responses to server queries.
290169689SkanThe
291169689Skandefault is about 5000 milliseconds.
292169689SkanNote that since
293169689Skan.Nm
294169689Skanretries each query once after a timeout, the total waiting time for
295169689Skana timeout will be twice the timeout value set.
296169689Skan.It Ic version
297169689SkanPrint the version of the
298169689Skan.Nm
299169689Skanprogram.
300169689Skan.El
301169689Skan.Ss "Control Message Commands"
302169689SkanAssociation IDs are used to identify system, peer and clock variables.
303169689SkanSystem variables are assigned an association ID of zero and system name space, while each association is assigned a nonzero association ID and peer namespace.
304169689SkanMost control commands send a single mode\-6 message to the server and expect a single response message.
305169689SkanThe exceptions are the
306169689Skan.Li peers
307169689Skancommand, which sends a series of messages,
308169689Skanand the
309169689Skan.Li mreadlist
310169689Skanand
311169689Skan.Li mreadvar
312169689Skancommands, which iterate over a range of associations.
313169689Skan.Bl -tag -width "something" -compact -offset indent
314169689Skan.It Cm associations
315169689SkanDisplay a list of mobilized associations in the form:
316169689Skan.Dl ind assid status conf reach auth condition last_event cnt
317169689Skan.Bl -column -offset indent ".Sy Variable" ".Sy Description"
318169689Skan.It Sy String Ta Sy Description
319169689Skan.It Li ind Ta index on this list
320169689Skan.It Li assid Ta association ID
321169689Skan.It Li status Ta peer status word
322169689Skan.It Li conf Ta Li yes : persistent, Li no : ephemeral
323169689Skan.It Li reach Ta Li yes : reachable, Li no : unreachable
324169689Skan.It Li auth Ta Li ok , Li yes , Li bad and Li none
325169689Skan.It Li condition Ta selection status (see the Li select field of the peer status word)
326169689Skan.It Li last_event Ta event report (see the Li event field of the peer status word)
327169689Skan.It Li cnt Ta event count (see the Li count field of the peer status word)
328169689Skan.El
329169689Skan.It Cm authinfo
330169689SkanDisplay the authentication statistics.
331169689Skan.It Cm clockvar Ar assocID Oo Ar name Ns Oo Cm = Ns Ar value Oc Oc Op ...
332169689Skan.It Cm cv Ar assocID Oo Ar name Ns Oo Cm = Ns Ar value Oc Oc Op ...
333169689SkanDisplay a list of clock variables for those associations supporting a reference clock.
334169689Skan.It Cm :config Op ...
335169689SkanSend 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.
336169689Skan.It Cm config\-from\-file Ar filename
337169689SkanSend the each line of
338169689Skan.Ar filename
339169689Skanto 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.
340169689Skan.It Ic ifstats
341169689SkanDisplay statistics for each local network address. Authentication is required.
342169689Skan.It Ic iostats
343169689SkanDisplay network and reference clock I/O statistics.
344169689Skan.It Ic kerninfo
345169689SkanDisplay 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.
346169689Skan.It Ic lassociations
347169689SkanPerform the same function as the associations command, except display mobilized and unmobilized associations.
348169689Skan.It Ic lopeers Xo
349169689Skan.Oo Ic \-4 |
350169689Skan.Ic \-6
351169689Skan.Oc
352169689Skan.Xc
353169689SkanObtain and print a list of all peers and clients showing
354169689Skan.Ar dstadr
355169689Skan(associated with any given IP version).
356169689Skan.It Ic lpeers Xo
357169689Skan.Oo Ic \-4 |
358169689Skan.Ic \-6
359169689Skan.Oc
360169689Skan.Xc
361169689SkanPrint a peer spreadsheet for the appropriate IP version(s).
362169689Skan.Ar dstadr
363169689Skan(associated with any given IP version).
364169689Skan.It Ic monstats
365169689SkanDisplay monitor facility statistics.
366169689Skan.It Ic mrulist Oo Ic limited | Ic kod | Ic mincount Ns = Ns Ar count | Ic laddr Ns = Ns Ar localaddr | Ic sort Ns = Ns Ar sortorder | Ic resany Ns = Ns Ar hexmask | Ic resall Ns = Ns Ar hexmask Oc
367169689SkanObtain and print traffic counts collected and maintained by the monitor facility.
368169689SkanWith the exception of
369169689Skan.Cm sort Ns = Ns Ar sortorder ,
370169689Skanthe options filter the list returned by
371169689Skan.Cm ntpd.
372169689SkanThe
373169689Skan.Cm limited
374169689Skanand
375169689Skan.Cm kod
376169689Skanoptions return only entries representing client addresses from which the last packet received triggered either discarding or a KoD response.
377169689SkanThe
378169689Skan.Cm mincount Ns = Ns Ar count
379169689Skanoption filters entries representing less than
380169689Skan.Ar count
381169689Skanpackets.
382169689SkanThe
383169689Skan.Cm laddr Ns = Ns Ar localaddr
384169689Skanoption filters entries for packets received on any local address other than
385169689Skan.Ar localaddr .
386169689Skan.Cm resany Ns = Ns Ar hexmask
387169689Skanand
388169689Skan.Cm resall Ns = Ns Ar hexmask
389169689Skanfilter entries containing none or less than all, respectively, of the bits in
390169689Skan.Ar hexmask ,
391169689Skanwhich must begin with
392169689Skan.Cm 0x .
393169689SkanThe
394169689Skan.Ar sortorder
395169689Skandefaults to
396169689Skan.Cm lstint
397169689Skanand may be any of
398169689Skan.Cm addr ,
399169689Skan.Cm count ,
400169689Skan.Cm avgint ,
401169689Skan.Cm lstint ,
402169689Skanor any of those preceded by a minus sign (hyphen) to reverse the sort order.
403169689SkanThe output columns are:
404169689Skan.Bl -tag -width "something" -compact -offset indent
405169689Skan.It Column
406169689SkanDescription
407169689Skan.It Ic lstint
408169689SkanInterval in s between the receipt of the most recent packet from this address and the completion of the retrieval of the MRU list by
409169689Skan.Nm .
410169689Skan.It Ic avgint
411169689SkanAverage interval in s between packets from this address.
412169689Skan.It Ic rstr
413169689SkanRestriction flags associated with this address.
414169689SkanMost are copied unchanged from the matching
415169689Skan.Ic restrict
416169689Skancommand, however 0x400 (kod) and 0x20 (limited) flags are cleared unless the last packet from this address triggered a rate control response.
417169689Skan.It Ic r
418169689SkanRate control indicator, either
419169689Skana period,
420169689Skan.Ic L
421169689Skanor
422169689Skan.Ic K
423169689Skanfor no rate control response,
424169689Skanrate limiting by discarding, or rate limiting with a KoD response, respectively.
425169689Skan.It Ic m
426169689SkanPacket mode.
427169689Skan.It Ic v
428169689SkanPacket version number.
429169689Skan.It Ic count
430169689SkanPackets received from this address.
431169689Skan.It Ic rport
432169689SkanSource port of last packet from this address.
433169689Skan.It Ic remote address
434169689SkanDNS name, numeric address, or address followed by
435169689Skanclaimed DNS name which could not be verified in parentheses.
436169689Skan.El
437169689Skan.It Ic mreadvar assocID assocID Oo Ar variable_name Ns Oo = Ns Ar value Oc Oc ...
438169689Skan.It Ic mrv assocID assocID Oo Ar variable_name Ns Oo = Ns Ar value Oc Oc ...
439169689SkanPerform the same function as the
440169689Skan.Ic readvar
441169689Skancommand, except for a range of association IDs.
442169689SkanThis range is determined from the association list cached by the most recent
443169689Skan.Ic associations
444169689Skancommand.
445169689Skan.It Ic opeers Xo
446169689Skan.Oo Ic \-4 |
447169689Skan.Ic \-6
448169689Skan.Oc
449169689Skan.Xc
450169689SkanObtain and print the old\-style list of all peers and clients showing
451169689Skan.Ar dstadr
452169689Skan(associated with any given IP version),
453169689Skanrather than the
454169689Skan.Ar refid .
455169689Skan.It Ic passociations
456169689SkanPerform the same function as the
457169689Skan.Ic associations
458169689Skancommand,
459169689Skanexcept that it uses previously stored data rather than making a new query.
460169689Skan.It Ic peers
461169689SkanDisplay a list of peers in the form:
462169689Skan.Dl [tally]remote refid st t when pool reach delay offset jitter
463169689Skan.Bl -tag -width "something" -compact -offset indent
464169689Skan.It Variable
465169689SkanDescription
466169689Skan.It Ic [tally]
467169689Skansingle\-character code indicating current value of the
468169689Skan.Ic select
469169689Skanfield of the
470169689Skan.Lk decode.html#peer "peer status word"
471169689Skan.It Ic remote
472169689Skanhost name (or IP number) of peer.
473169689SkanThe value displayed will be truncated to 15 characters  unless the
474169689Skan.Fl w
475169689Skanflag is given, in which case the full value will be displayed
476169689Skanon the first line,
477169689Skanand the remaining data is displayed on the next line.
478169689Skan.It Ic refid
479169689Skanassociation ID or
480169689Skan.Lk decode.html#kiss "'kiss code"
481169689Skan.It Ic st
482169689Skanstratum
483169689Skan.It Ic t
484169689Skan.Ic u :
485169689Skanunicast or manycast client,
486169689Skan.Ic b :
487169689Skanbroadcast or multicast client,
488169689Skan.Ic l :
489169689Skanlocal (reference clock),
490169689Skan.Ic s :
491169689Skansymmetric (peer),
492169689Skan.Ic A :
493169689Skanmanycast server,
494169689Skan.Ic B :
495169689Skanbroadcast server,
496169689Skan.Ic M :
497169689Skanmulticast server
498169689Skan.It Ic when
499169689Skansec/min/hr since last received packet
500169689Skan.It Ic poll
501169689Skanpoll interval (log2 s)
502169689Skan.It Ic reach
503169689Skanreach shift register (octal)
504169689Skan.It Ic delay
505169689Skanroundtrip delay
506169689Skan.It Ic offset
507169689Skanoffset of server relative to this host
508169689Skan.It Ic jitter
509169689Skanjitter
510169689Skan.El
511169689Skan.It Ic apeers
512169689SkanDisplay a list of peers in the form:
513169689Skan.Dl [tally]remote refid assid st t when pool reach delay offset jitter
514169689Skanwhere the output is just like the
515169689Skan.Ic peers
516169689Skancommand except that the
517169689Skan.Ic refid
518169689Skanis displayed in hex format and the association number is also displayed.
519169689Skan.It Ic pstats Ar assocID
520169689SkanShow the statistics for the peer with the given
521169689Skan.Ar assocID .
522169689Skan.It Ic readlist Ar assocID
523169689Skan.It Ic rl Ar assocID
524169689SkanRead the system or peer variables included in the variable list.
525169689Skan.It Ic readvar Ar assocID Ar name Ns Oo Ns = Ns Ar value Oc  Oo , ... Oc
526169689Skan.It Ic rv Ar assocID Ar name Ns Oo Ns = Ns Ar value Oc  Oo , ... Oc
527169689SkanDisplay the specified variables.
528169689SkanIf
529169689Skan.Ar assocID
530169689Skanis zero, the variables are from the
531169689Skan.Sx System Variables
532169689Skanname space, otherwise they are from the
533169689Skan.Sx Peer Variables
534169689Skanname space.
535169689SkanThe
536169689Skan.Ar assocID
537169689Skanis required, as the same name can occur in both spaces.
538169689SkanIf no
539169689Skan.Ar name
540169689Skanis included, all operative variables in the name space are displayed.
541169689SkanIn this case only, if the
542169689Skan.Ar assocID
543169689Skanis omitted, it is assumed zero.
544169689SkanMultiple names are specified with comma separators and without whitespace.
545169689SkanNote that time values are represented in milliseconds
546169689Skanand frequency values in parts\-per\-million (PPM).
547169689SkanSome NTP timestamps are represented in the format
548169689SkanYYYYMMDDTTTT ,
549169689Skanwhere YYYY is the year,
550169689SkanMM the month of year,
551169689SkanDD the day of month and
552169689SkanTTTT the time of day.
553169689Skan.It Ic reslist
554169689SkanShow the access control (restrict) list for
555169689Skan.Nm .
556169689Skan.It Ic saveconfig Ar filename
557169689SkanWrite the current configuration,
558169689Skanincluding any runtime modifications given with
559169689Skan.Ic :config
560169689Skanor
561169689Skan.Ic config\-from\-file ,
562169689Skanto the ntpd host's file
563169689Skan.Ar filename .
564169689SkanThis command will be rejected by the server unless
565169689Skan.Lk miscopt.html#saveconfigdir "saveconfigdir"
566169689Skanappears in the
567169689Skan.Ic ntpd
568169689Skanconfiguration file.
569169689Skan.Ar filename
570169689Skancan use
571169689Skan.Xr strftime
572169689Skanformat specifies to substitute the current date and time, for example,
573169689Skan.Ic q]saveconfig ntp\-%Y%m%d\-%H%M%S.confq] .
574169689SkanThe filename used is stored in system variable
575169689Skan.Ic savedconfig .
576169689SkanAuthentication is required.
577169689Skan.It Ic timerstats
578169689SkanDisplay interval timer counters.
579169689Skan.It Ic writelist Ar assocID
580169689SkanWrite the system or peer variables included in the variable list.
581169689Skan.It Ic writevar Ar assocID Ar name Ns = Ns Ar value Op , ...
582169689SkanWrite the specified variables.
583169689SkanIf the
584169689Skan.Ar assocID
585169689Skanis zero, the variables are from the
586169689Skan.Sx System Variables
587169689Skanname space, otherwise they are from the
588169689Skan.Sx Peer Variables
589169689Skanname space.
590169689SkanThe
591169689Skan.Ar assocID
592169689Skanis required, as the same name can occur in both spaces.
593169689Skan.It Ic sysinfo
594169689SkanDisplay operational summary.
595169689Skan.It Ic sysstats
596169689SkanPrint statistics counters maintained in the protocol module.
597169689Skan.El
598169689Skan.Ss Status Words and Kiss Codes
599169689SkanThe current state of the operating program is shown
600169689Skanin a set of status words
601169689Skanmaintained by the system.
602169689SkanStatus information is also available on a per\-association basis.
603169689SkanThese words are displayed in the
604169689Skan.Ic rv
605169689Skanand
606169689Skan.Ic as
607169689Skancommands both in hexadecimal and in decoded short tip strings.
608169689SkanThe codes, tips and short explanations are documented on the
609169689Skan.Lk decode.html "Event Messages and Status Words"
610169689Skanpage.
611169689SkanThe page also includes a list of system and peer messages,
612169689Skanthe code for the latest of which is included in the status word.
613169689Skan.Pp
614169689SkanInformation resulting from protocol machine state transitions
615169689Skanis displayed using an informal set of ASCII strings called
616169689Skan.Lk decode.html#kiss "kiss codes" .
617169689SkanThe original purpose was for kiss\-o'\-death (KoD) packets
618169689Skansent by the server to advise the client of an unusual condition.
619169689SkanThey are now displayed, when appropriate,
620169689Skanin the reference identifier field in various billboards.
621169689Skan.Ss System Variables
622169689SkanThe following system variables appear in the
623169689Skan.Ic rv
624169689Skanbillboard.
625169689SkanNot all variables are displayed in some configurations.
626169689Skan.Bl -tag -width "something" -compact -offset indent
627169689Skan.It Variable
628169689SkanDescription
629169689Skan.It Ic status
630169689Skan.Lk decode.html#sys "system status word"
631169689Skan.It Ic version
632169689SkanNTP software version and build time
633169689Skan.It Ic processor
634169689Skanhardware platform and version
635169689Skan.It Ic system
636169689Skanoperating system and version
637169689Skan.It Ic leap
638169689Skanleap warning indicator (0\-3)
639169689Skan.It Ic stratum
640169689Skanstratum (1\-15)
641169689Skan.It Ic precision
642169689Skanprecision (log2 s)
643169689Skan.It Ic rootdelay
644169689Skantotal roundtrip delay to the primary reference clock
645169689Skan.It Ic rootdisp
646169689Skantotal dispersion to the primary reference clock
647169689Skan.It Ic peer
648169689Skansystem peer association ID
649169689Skan.It Ic tc
650169689Skantime constant and poll exponent (log2 s) (3\-17)
651169689Skan.It Ic mintc
652169689Skanminimum time constant (log2 s) (3\-10)
653169689Skan.It Ic clock
654169689Skandate and time of day
655169689Skan.It Ic refid
656169689Skanreference ID or
657169689Skan.Lk decode.html#kiss "kiss code"
658169689Skan.It Ic reftime
659169689Skanreference time
660169689Skan.It Ic offset
661169689Skancombined  offset of server relative to this host
662169689Skan.It Ic sys_jitter
663169689Skancombined system jitter
664169689Skan.It Ic frequency
665169689Skanfrequency offset (PPM) relative to hardware clock
666169689Skan.It Ic clk_wander
667169689Skanclock frequency wander (PPM)
668169689Skan.It Ic clk_jitter
669169689Skanclock jitter
670169689Skan.It Ic tai
671169689SkanTAI\-UTC offset (s)
672169689Skan.It Ic leapsec
673169689SkanNTP seconds when the next leap second is/was inserted
674169689Skan.It Ic expire
675169689SkanNTP seconds when the NIST leapseconds file expires
676.El
677The jitter and wander statistics are exponentially\-weighted RMS averages.
678The system jitter is defined in the NTPv4 specification;
679the clock jitter statistic is computed by the clock discipline module.
680.Pp
681When the NTPv4 daemon is compiled with the OpenSSL software library,
682additional system variables are displayed,
683including some or all of the following,
684depending on the particular Autokey dance:
685.Bl -tag -width "something" -compact -offset indent
686.It Variable
687Description
688.It Ic host
689Autokey host name for this host
690.It Ic ident
691Autokey group name for this host
692.It Ic flags
693host flags  (see Autokey specification)
694.It Ic digest
695OpenSSL message digest algorithm
696.It Ic signature
697OpenSSL digest/signature scheme
698.It Ic update
699NTP seconds at last signature update
700.It Ic cert
701certificate subject, issuer and certificate flags
702.It Ic until
703NTP seconds when the certificate expires
704.El
705.Ss Peer Variables
706The following peer variables appear in the
707.Ic rv
708billboard for each association.
709Not all variables are displayed in some configurations.
710.Bl -tag -width "something" -compact -offset indent
711.It Variable
712Description
713.It Ic associd
714association ID
715.It Ic status
716.Lk decode.html#peer "peer status word"
717.It Ic srcadr
718source (remote) IP address
719.It Ic srcport
720source (remote) port
721.It Ic dstadr
722destination (local) IP address
723.It Ic dstport
724destination (local) port
725.It Ic leap
726leap indicator (0\-3)
727.It Ic stratum
728stratum (0\-15)
729.It Ic precision
730precision (log2 s)
731.It Ic rootdelay
732total roundtrip delay to the primary reference clock
733.It Ic rootdisp
734total root dispersion to the primary reference clock
735.It Ic refid
736reference ID or
737.Lk decode.html#kiss "kiss code"
738.It Ic reftime
739reference time
740.It Ic reach
741reach register (octal)
742.It Ic unreach
743unreach counter
744.It Ic hmode
745host mode (1\-6)
746.It Ic pmode
747peer mode (1\-5)
748.It Ic hpoll
749host poll exponent (log2 s) (3\-17)
750.It Ic ppoll
751peer poll exponent (log2 s) (3\-17)
752.It Ic headway
753headway (see
754.Lk rate.html "Rate Management and the Kiss\-o'\-Death Packet" )
755.It Ic flash
756.Lk decode.html#flash "flash status word"
757.It Ic offset
758filter offset
759.It Ic delay
760filter delay
761.It Ic dispersion
762filter dispersion
763.It Ic jitter
764filter jitter
765.It Ic ident
766Autokey group name for this association
767.It Ic bias
768unicast/broadcast bias
769.It Ic xleave
770interleave delay (see
771.Lk xleave.html "NTP Interleaved Modes" )
772.El
773The
774.Ic bias
775variable is calculated when the first broadcast packet is received
776after the calibration volley.
777It represents the offset of the broadcast subgraph relative to the unicast subgraph.
778The
779.Ic xleave
780variable appears only for the interleaved symmetric and interleaved modes.
781It represents the internal queuing, buffering and transmission delays
782for the preceding packet.
783.Pp
784When the NTPv4 daemon is compiled with the OpenSSL software library,
785additional peer variables are displayed, including the following:
786.Bl -tag -width "something" -compact -offset indent
787.It Variable
788Description
789.It Ic flags
790peer flags (see Autokey specification)
791.It Ic host
792Autokey server name
793.It Ic flags
794peer flags (see Autokey specification)
795.It Ic signature
796OpenSSL digest/signature scheme
797.It Ic initsequence
798initial key ID
799.It Ic initkey
800initial key index
801.It Ic timestamp
802Autokey signature timestamp
803.El
804.Ss Clock Variables
805The following clock variables appear in the
806.Ic cv
807billboard for each association with a reference clock.
808Not all variables are displayed in some configurations.
809.Bl -tag -width "something" -compact -offset indent
810.It Variable
811Description
812.It Ic associd
813association ID
814.It Ic status
815.Lk decode.html#clock "clock status word"
816.It Ic device
817device description
818.It Ic timecode
819ASCII time code string (specific to device)
820.It Ic poll
821poll messages sent
822.It Ic noreply
823no reply
824.It Ic badformat
825bad format
826.It Ic baddata
827bad date or time
828.It Ic fudgetime1
829fudge time 1
830.It Ic fudgetime2
831fudge time 2
832.It Ic stratum
833driver stratum
834.It Ic refid
835driver reference ID
836.It Ic flags
837driver flags
838.El
839.Sh "OPTIONS"
840.Bl -tag
841.It  Fl 4 , Fl \-ipv4 
842Force IPv4 DNS name resolution.
843This option must not appear in combination with any of the following options:
844ipv6.
845.sp
846Force DNS resolution of following host names on the command line
847to the IPv4 namespace.
848.It  Fl 6 , Fl \-ipv6 
849Force IPv6 DNS name resolution.
850This option must not appear in combination with any of the following options:
851ipv4.
852.sp
853Force DNS resolution of following host names on the command line
854to the IPv6 namespace.
855.It  Fl c Ar cmd , Fl \-command Ns = Ns Ar cmd 
856run a command and exit.
857This option may appear an unlimited number of times.
858.sp
859The following argument is interpreted as an interactive format command
860and is added to the list of commands to be executed on the specified
861host(s).
862.It  Fl d , Fl \-debug\-level 
863Increase debug verbosity level.
864This option may appear an unlimited number of times.
865.sp
866.It  Fl D Ar number , Fl \-set\-debug\-level Ns = Ns Ar number 
867Set the debug verbosity level.
868This option may appear an unlimited number of times.
869This option takes an integer number as its argument.
870.sp
871.It  Fl i , Fl \-interactive 
872Force ntpq to operate in interactive mode.
873This option must not appear in combination with any of the following options:
874command, peers.
875.sp
876Force \fBntpq\fP to operate in interactive mode.
877Prompts will be written to the standard output and
878commands read from the standard input.
879.It  Fl n , Fl \-numeric 
880numeric host addresses.
881.sp
882Output all host addresses in dotted\-quad numeric format rather than
883converting to the canonical host names. 
884.It  Fl \-old\-rv 
885Always output status line with readvar.
886.sp
887By default, \fBntpq\fP now suppresses the \fBassocid=...\fP
888line that precedes the output of \fBreadvar\fP
889(alias \fBrv\fP) when a single variable is requested, such as
890\fBntpq \-c "rv 0 offset"\fP.
891This option causes \fBntpq\fP to include both lines of output
892for a single\-variable \fBreadvar\fP.
893Using an environment variable to
894preset this option in a script will enable both older and
895newer \fBntpq\fP to behave identically in this regard.
896.It  Fl p , Fl \-peers 
897Print a list of the peers.
898This option must not appear in combination with any of the following options:
899interactive.
900.sp
901Print a list of the peers known to the server as well as a summary
902of their state. This is equivalent to the 'peers' interactive command.
903.It  Fl w , Fl \-wide 
904Display the full 'remote' value.
905.sp
906Display the full value of the 'remote' value.  If this requires
907more than 15 characters, display the full value, emit a newline,
908and continue the data display properly indented on the next line.
909.It Fl \&? , Fl \-help
910Display usage information and exit.
911.It Fl \&! , Fl \-more\-help
912Pass the extended usage information through a pager.
913.It Fl > Oo Ar cfgfile Oc , Fl \-save\-opts Oo Ns = Ns Ar cfgfile Oc
914Save the option state to \fIcfgfile\fP.  The default is the \fIlast\fP
915configuration file listed in the \fBOPTION PRESETS\fP section, below.
916The command will exit after updating the config file.
917.It Fl < Ar cfgfile , Fl \-load\-opts Ns = Ns Ar cfgfile , Fl \-no\-load\-opts
918Load options from \fIcfgfile\fP.
919The \fIno\-load\-opts\fP form will disable the loading
920of earlier config/rc/ini files.  \fI\-\-no\-load\-opts\fP is handled early,
921out of order.
922.It Fl \-version Op Brq Ar v|c|n
923Output version of program and exit.  The default mode is `v', a simple
924version.  The `c' mode will print copyright information and `n' will
925print the full copyright notice.
926.El
927.Sh "OPTION PRESETS"
928Any option that is not marked as \fInot presettable\fP may be preset
929by loading values from configuration ("RC" or ".INI") file(s) and values from
930environment variables named:
931.nf
932  \fBNTPQ_<option\-name>\fP or \fBNTPQ\fP
933.fi
934.ad
935The environmental presets take precedence (are processed later than)
936the configuration files.
937The \fIhomerc\fP files are "\fI$HOME\fP", and "\fI.\fP".
938If any of these are directories, then the file \fI.ntprc\fP
939is searched for within those directories.
940.Sh "ENVIRONMENT"
941See \fBOPTION PRESETS\fP for configuration environment variables.
942.Sh "FILES"
943See \fBOPTION PRESETS\fP for configuration files.
944.Sh "EXIT STATUS"
945One of the following exit values will be returned:
946.Bl -tag
947.It 0 " (EXIT_SUCCESS)"
948Successful program execution.
949.It 1 " (EXIT_FAILURE)"
950The operation failed or the command syntax was not valid.
951.It 66 " (EX_NOINPUT)"
952A specified configuration file could not be loaded.
953.It 70 " (EX_SOFTWARE)"
954libopts had an internal operational error.  Please report
955it to autogen\-users@lists.sourceforge.net.  Thank you.
956.El
957.Sh "AUTHORS"
958The University of Delaware and Network Time Foundation
959.Sh "COPYRIGHT"
960Copyright (C) 1992\-2016 The University of Delaware and Network Time Foundation all rights reserved.
961This program is released under the terms of the NTP license, <http://ntp.org/license>.
962.Sh "BUGS"
963Please send bug reports to: http://bugs.ntp.org, bugs@ntp.org
964.Sh "NOTES"
965This manual page was \fIAutoGen\fP\-erated from the \fBntpq\fP
966option definitions.
967