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