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