2 .Dt NTPQ 8 User Commands
4 .\" EDIT THIS FILE WITH CAUTION (ntpq-opts.mdoc)
8 .\" It has been AutoGen-ed February 4, 2015 at 02:43:19 AM by AutoGen 5.18.5pre4
9 .\" From the definitions ntpq-opts.def
10 .\" and the template file agmdoc-cmd.tpl
13 .Nd standard NTP query program
16 .\" Mixture of short (flag) options and long options
18 .Op Fl flag Op Ar value
19 .Op Fl \-option\-name Ns Oo Oo Ns "=| " Oc Ns Ar value Oc
25 utility program is used to query NTP servers which
26 implement the standard NTP mode 6 control message formats defined
27 in Appendix B of the NTPv3 specification RFC1305, requesting
28 information about current state and/or changes in that state.
29 The same formats are used in NTPv4, although some of the
30 variables have changed and new ones added. The description on this
31 page is for the NTPv4 variables.
32 The program may be run either in interactive mode or controlled using
33 command line arguments.
34 Requests to read and write arbitrary
35 variables can be assembled, with raw and pretty\-printed output
36 options being available.
39 utility can also obtain and print a
40 list of peers in a common format by sending multiple queries to the
42 If one or more request options is included on the command line
45 is executed, each of the requests will be sent
46 to the NTP servers running on each of the hosts given as command
47 line arguments, or on localhost by default.
51 will attempt to read commands from the
52 standard input and execute these on the NTP server running on the
53 first host given on the command line, again defaulting to localhost
54 when no other host is specified.
57 utility will prompt for
58 commands if the standard input is a terminal device.
60 uses NTP mode 6 packets to communicate with the
61 NTP server, and hence can be used to query any compatible server on
62 the network which permits it.
63 Note that since NTP is a UDP protocol
64 this communication will be somewhat unreliable, especially over
65 large distances in terms of network topology.
69 one attempt to retransmit requests, and will time requests out if
70 the remote host is not heard from within a suitable timeout
73 command line option other than
78 cause the specified query (queries) to be sent to the indicated
83 interactive format commands from the standard input.
84 .Ss "Internal Commands"
85 Interactive format commands consist of a keyword followed by zero
87 Only enough characters of the full keyword to
88 uniquely identify the command need be typed.
90 number of interactive format commands are executed entirely within
93 utility itself and do not result in NTP mode 6
94 requests being sent to a server.
95 These are described following.
96 .Bl -tag -width "? [command_keyword]" -compact -offset indent
97 .It Ic ? Op Ar command_keyword
98 .It Ic help Op Ar command_keyword
101 by itself will print a list of all the command
102 keywords known to this incarnation of
106 followed by a command keyword will print function and usage
107 information about the command.
108 This command is probably a better
109 source of information about
113 .It Ic addvars Ar variable_name Ns Xo Op Ic =value
116 .It Ic rmvars Ar variable_name Ic ...
119 The data carried by NTP mode 6 messages consists of a list of
121 .Ql variable_name=value ,
124 is ignored, and can be omitted,
125 in requests to the server to read variables.
128 utility maintains an internal list in which data to be included in control
129 messages can be assembled, and sent using the
133 commands described below.
136 command allows variables and their optional values to be added to
138 If more than one variable is to be added, the list should
139 be comma\-separated and not contain white space.
142 command can be used to remove individual variables from the list,
145 command removes all variables from the
149 command displays the current list of optional variables.
150 .It Ic authenticate Op yes | no
153 does not authenticate requests unless
154 they are write requests.
159 to send authentication with all requests it
161 Authenticated requests causes some servers to handle
162 requests slightly differently, and can occasionally melt the CPU in
163 fuzzballs if you turn authentication on before doing a
170 to display whether or not
172 is currently autheinticating requests.
174 Causes output from query commands to be "cooked", so that
175 variables which are recognized by
178 values reformatted for human consumption.
181 thinks should have a decodable value but didn't are
182 marked with a trailing
192 With no argument, displays the current debug level.
193 Otherwise, the debug level is changed to the indicated level.
194 .It Ic delay Ar milliseconds
195 Specify a time interval to be added to timestamps included in
196 requests which require authentication.
197 This is used to enable
198 (unreliable) server reconfiguration over long delay network paths
199 or between machines whose clocks are unsynchronized.
201 server does not now require timestamps in authenticated requests,
202 so this command may be obsolete.
206 .It Ic host Ar hostname
207 Set the host to which future queries will be sent.
209 may be either a host name or a numeric address.
210 .It Ic hostnames Op Cm yes | Cm no
213 is specified, host names are printed in
214 information displays.
217 is specified, numeric
218 addresses are printed instead.
222 modified using the command line
225 .It Ic keyid Ar keyid
226 This command allows the specification of a key number to be
227 used to authenticate configuration requests.
229 to a key number the server has been configured to use for this
233 .Cm OpenSSLDigestType
236 Specify the type of key to use for authenticating requests.
241 was built with OpenSSL support,
242 any digest type supported by OpenSSL can also be provided.
243 If no argument is given, the current
246 .It Ic ntpversion Xo Oo
253 Sets the NTP version number which
257 Defaults to 3, and note that mode 6 control messages (and
258 modes, for that matter) didn't exist in NTP version 1.
260 to be no servers left which demand version 1.
261 With no argument, displays the current NTP version that will be used
262 when communicating with servers.
264 This command prompts you to type in a password (which will not
265 be echoed) which will be used to authenticate configuration
267 The password must correspond to the key configured for
268 use by the NTP server for this purpose if such requests are to be
270 .\" Not yet implemented.
274 .\" Poll an NTP server in client mode
281 Causes all output from query commands is printed as received
282 from the remote server.
283 The only formating/interpretation done on
284 the data is to transform nonascii data into a printable (but barely
285 understandable) form.
286 .It Ic timeout Ar milliseconds
287 Specify a timeout period for responses to server queries.
289 default is about 5000 milliseconds.
292 retries each query once after a timeout, the total waiting time for
293 a timeout will be twice the timeout value set.
295 Print the version of the
299 .Ss "Control Message Commands"
300 Association IDs are used to identify system, peer and clock variables.
301 System variables are assigned an association ID of zero and system name space, while each association is assigned a nonzero association ID and peer namespace.
302 Most control commands send a single mode\-6 message to the server and expect a single response message.
303 The exceptions are the
305 command, which sends a series of messages,
310 commands, which iterate over a range of associations.
311 .Bl -tag -width "something" -compact -offset indent
313 Display a list of mobilized associations in the form:
314 .Dl ind assid status conf reach auth condition last_event cnt
315 .Bl -column -offset indent ".Sy Variable" ".Sy Description"
316 .It Sy String Ta Sy Description
317 .It Li ind Ta index on this list
318 .It Li assid Ta association ID
319 .It Li status Ta peer status word
320 .It Li conf Ta Li yes : persistent, Li no : ephemeral
321 .It Li reach Ta Li yes : reachable, Li no : unreachable
322 .It Li auth Ta Li ok , Li yes , Li bad and Li none
323 .It Li condition Ta selection status (see the Li select field of the peer status word)
324 .It Li last_event Ta event report (see the Li event field of the peer status word)
325 .It Li cnt Ta event count (see the Li count field of the peer status word)
328 Display the authentication statistics.
329 .It Cm clockvar Ar assocID Oo Ar name Ns Oo Cm = Ns Ar value Oc Oc Op ...
330 .It Cm cv Ar assocID Oo Ar name Ns Oo Cm = Ns Ar value Oc Oc Op ...
331 Display a list of clock variables for those associations supporting a reference clock.
332 .It Cm :config Op ...
333 Send the remainder of the command line, including whitespace, to the server as a run\-time configuration command in the same format as a line in the configuration file. This command is experimental until further notice and clarification. Authentication is of course required.
334 .It Cm config\-from\-file Ar filename
335 Send the each line of
337 to the server as run\-time configuration commands in the same format as a line in the configuration file. This command is experimental until further notice and clarification. Authentication is required.
339 Display statistics for each local network address. Authentication is required.
341 Display network and reference clock I/O statistics.
343 Display kernel loop and PPS statistics. As with other ntpq output, times are in milliseconds. The precision value displayed is in milliseconds as well, unlike the precision system variable.
345 Perform the same function as the associations command, except display mobilized and unmobilized associations.
351 Obtain and print a list of all peers and clients showing
353 (associated with any given IP version).
359 Print a peer spreadsheet for the appropriate IP version(s).
361 (associated with any given IP version).
363 Display monitor facility statistics.
364 .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
365 Obtain and print traffic counts collected and maintained by the monitor facility.
366 With the exception of
367 .Cm sort Ns = Ns Ar sortorder ,
368 the options filter the list returned by
374 options return only entries representing client addresses from which the last packet received triggered either discarding or a KoD response.
376 .Cm mincount Ns = Ns Ar count
377 option filters entries representing less than
381 .Cm laddr Ns = Ns Ar localaddr
382 option filters entries for packets received on any local address other than
384 .Cm resany Ns = Ns Ar hexmask
386 .Cm resall Ns = Ns Ar hexmask
387 filter entries containing none or less than all, respectively, of the bits in
389 which must begin with
400 or any of those preceded by a minus sign (hyphen) to reverse the sort order.
401 The output columns are:
402 .Bl -tag -width "something" -compact -offset indent
406 Interval in s between the receipt of the most recent packet from this address and the completion of the retrieval of the MRU list by
409 Average interval in s between packets from this address.
411 Restriction flags associated with this address.
412 Most are copied unchanged from the matching
414 command, however 0x400 (kod) and 0x20 (limited) flags are cleared unless the last packet from this address triggered a rate control response.
416 Rate control indicator, either
421 for no rate control response,
422 rate limiting by discarding, or rate limiting with a KoD response, respectively.
426 Packet version number.
428 Packets received from this address.
430 Source port of last packet from this address.
431 .It Ic remote address
432 DNS name, numeric address, or address followed by
433 claimed DNS name which could not be verified in parentheses.
435 .It Ic mreadvar assocID assocID Oo Ar variable_name Ns Oo = Ns Ar value Oc Oc ...
436 .It Ic mrv assocID assocID Oo Ar variable_name Ns Oo = Ns Ar value Oc Oc ...
437 Perform the same function as the
439 command, except for a range of association IDs.
440 This range is determined from the association list cached by the most recent
448 Obtain and print the old\-style list of all peers and clients showing
450 (associated with any given IP version),
454 Perform the same function as the
457 except that it uses previously stored data rather than making a new query.
459 Display a list of peers in the form:
460 .Dl [tally]remote refid st t when pool reach delay offset jitter
461 .Bl -tag -width "something" -compact -offset indent
465 single\-character code indicating current value of the
468 .Lk decode.html#peer "peer status word"
470 host name (or IP number) of peer.
471 The value displayed will be truncated to 15 characters unless the
473 flag is given, in which case the full value will be displayed
475 and the remaining data is displayed on the next line.
478 .Lk decode.html#kiss "'kiss code"
483 unicast or manycast client,
485 broadcast or multicast client,
487 local (reference clock),
497 sec/min/hr since last received packet
499 poll interval (log2 s)
501 reach shift register (octal)
505 offset of server relative to this host
509 .It Ic pstats Ar assocID
510 Show the statistics for the peer with the given
512 .It Ic readlist Ar assocID
514 Read the system or peer variables included in the variable list.
515 .It Ic readvar Ar assocID Ar name Ns Oo Ns = Ns Ar value Oc Oo , ... Oc
516 .It Ic rv Ar assocID Ar name Ns Oo Ns = Ns Ar value Oc Oo , ... Oc
517 Display the specified variables.
520 is zero, the variables are from the
522 name space, otherwise they are from the
527 is required, as the same name can occur in both spaces.
530 is included, all operative variables in the name space are displayed.
531 In this case only, if the
533 is omitted, it is assumed zero.
534 Multiple names are specified with comma separators and without whitespace.
535 Note that time values are represented in milliseconds
536 and frequency values in parts\-per\-million (PPM).
537 Some NTP timestamps are represented in the format
539 where YYYY is the year,
540 MM the month of year,
541 DD the day of month and
542 TTTT the time of day.
544 Show the access control (restrict) list for
546 .It Ic saveconfig Ar filename
547 Write the current configuration,
548 including any runtime modifications given with
551 .Ic config\-from\-file ,
552 to the ntpd host's file
554 This command will be rejected by the server unless
555 .Lk miscopt.html#saveconfigdir "saveconfigdir"
562 format specifies to substitute the current date and time, for example,
563 .Ic q]saveconfig ntp\-%Y%m%d\-%H%M%S.confq] .
564 The filename used is stored in system variable
566 Authentication is required.
568 Display interval timer counters.
569 .It Ic writelist Ar assocID
570 Write the system or peer variables included in the variable list.
571 .It Ic writevar Ar assocID Ar name Ns = Ns Ar value Op , ...
572 Write the specified variables.
575 is zero, the variables are from the
577 name space, otherwise they are from the
582 is required, as the same name can occur in both spaces.
584 Display operational summary.
586 Print statistics counters maintained in the protocol module.
588 .Ss Status Words and Kiss Codes
589 The current state of the operating program is shown
590 in a set of status words
591 maintained by the system.
592 Status information is also available on a per\-association basis.
593 These words are displayed in the
597 commands both in hexadecimal and in decoded short tip strings.
598 The codes, tips and short explanations are documented on the
599 .Lk decode.html "Event Messages and Status Words"
601 The page also includes a list of system and peer messages,
602 the code for the latest of which is included in the status word.
604 Information resulting from protocol machine state transitions
605 is displayed using an informal set of ASCII strings called
606 .Lk decode.html#kiss "kiss codes" .
607 The original purpose was for kiss\-o'\-death (KoD) packets
608 sent by the server to advise the client of an unusual condition.
609 They are now displayed, when appropriate,
610 in the reference identifier field in various billboards.
612 The following system variables appear in the
615 Not all variables are displayed in some configurations.
616 .Bl -tag -width "something" -compact -offset indent
620 .Lk decode.html#sys "system status word"
622 NTP software version and build time
624 hardware platform and version
626 operating system and version
628 leap warning indicator (0\-3)
634 total roundtrip delay to the primary reference clock
636 total dispersion to the primary reference clock
638 system peer association ID
640 time constant and poll exponent (log2 s) (3\-17)
642 minimum time constant (log2 s) (3\-10)
647 .Lk decode.html#kiss "kiss code"
651 combined offset of server relative to this host
653 combined system jitter
655 frequency offset (PPM) relative to hardware clock
657 clock frequency wander (PPM)
663 NTP seconds when the next leap second is/was inserted
665 NTP seconds when the NIST leapseconds file expires
667 The jitter and wander statistics are exponentially\-weighted RMS averages.
668 The system jitter is defined in the NTPv4 specification;
669 the clock jitter statistic is computed by the clock discipline module.
671 When the NTPv4 daemon is compiled with the OpenSSL software library,
672 additional system variables are displayed,
673 including some or all of the following,
674 depending on the particular Autokey dance:
675 .Bl -tag -width "something" -compact -offset indent
679 Autokey host name for this host
681 Autokey group name for this host
683 host flags (see Autokey specification)
685 OpenSSL message digest algorithm
687 OpenSSL digest/signature scheme
689 NTP seconds at last signature update
691 certificate subject, issuer and certificate flags
693 NTP seconds when the certificate expires
696 The following peer variables appear in the
698 billboard for each association.
699 Not all variables are displayed in some configurations.
700 .Bl -tag -width "something" -compact -offset indent
706 .Lk decode.html#peer "peer status word"
708 source (remote) IP address
712 destination (local) IP address
714 destination (local) port
716 leap indicator (0\-3)
722 total roundtrip delay to the primary reference clock
724 total root dispersion to the primary reference clock
727 .Lk decode.html#kiss "kiss code"
731 reach register (octal)
739 host poll exponent (log2 s) (3\-17)
741 peer poll exponent (log2 s) (3\-17)
744 .Lk rate.html "Rate Management and the Kiss\-o'\-Death Packet" )
746 .Lk decode.html#flash "flash status word"
756 Autokey group name for this association
758 unicast/broadcast bias
760 interleave delay (see
761 .Lk xleave.html "NTP Interleaved Modes" )
765 variable is calculated when the first broadcast packet is received
766 after the calibration volley.
767 It represents the offset of the broadcast subgraph relative to the unicast subgraph.
770 variable appears only for the interleaved symmetric and interleaved modes.
771 It represents the internal queuing, buffering and transmission delays
772 for the preceding packet.
774 When the NTPv4 daemon is compiled with the OpenSSL software library,
775 additional peer variables are displayed, including the following:
776 .Bl -tag -width "something" -compact -offset indent
780 peer flags (see Autokey specification)
784 peer flags (see Autokey specification)
786 OpenSSL digest/signature scheme
792 Autokey signature timestamp
795 The following clock variables appear in the
797 billboard for each association with a reference clock.
798 Not all variables are displayed in some configurations.
799 .Bl -tag -width "something" -compact -offset indent
805 .Lk decode.html#clock "clock status word"
809 ASCII time code string (specific to device)
832 Force IPv4 DNS name resolution.
833 This option must not appear in combination with any of the following options:
836 Force DNS resolution of following host names on the command line
837 to the IPv4 namespace.
839 Force IPv6 DNS name resolution.
840 This option must not appear in combination with any of the following options:
843 Force DNS resolution of following host names on the command line
844 to the IPv6 namespace.
845 .It Fl c Ar cmd , Fl \-command Ns = Ns Ar cmd
846 run a command and exit.
847 This option may appear an unlimited number of times.
849 The following argument is interpreted as an interactive format command
850 and is added to the list of commands to be executed on the specified
852 .It Fl d , Fl \-debug\-level
853 Increase debug verbosity level.
854 This option may appear an unlimited number of times.
856 .It Fl D Ar number , Fl \-set\-debug\-level Ns = Ns Ar number
857 Set the debug verbosity level.
858 This option may appear an unlimited number of times.
859 This option takes an integer number as its argument.
861 .It Fl i , Fl \-interactive
862 Force ntpq to operate in interactive mode.
863 This option must not appear in combination with any of the following options:
866 Force \fBntpq\fP to operate in interactive mode.
867 Prompts will be written to the standard output and
868 commands read from the standard input.
869 .It Fl n , Fl \-numeric
870 numeric host addresses.
872 Output all host addresses in dotted\-quad numeric format rather than
873 converting to the canonical host names.
875 Always output status line with readvar.
877 By default, \fBntpq\fP now suppresses the \fBassocid=...\fP
878 line that precedes the output of \fBreadvar\fP
879 (alias \fBrv\fP) when a single variable is requested, such as
880 \fBntpq \-c "rv 0 offset"\fP.
881 This option causes \fBntpq\fP to include both lines of output
882 for a single\-variable \fBreadvar\fP.
883 Using an environment variable to
884 preset this option in a script will enable both older and
885 newer \fBntpq\fP to behave identically in this regard.
886 .It Fl p , Fl \-peers
887 Print a list of the peers.
888 This option must not appear in combination with any of the following options:
891 Print a list of the peers known to the server as well as a summary
892 of their state. This is equivalent to the 'peers' interactive command.
894 Display the full 'remote' value.
896 Display the full value of the 'remote' value. If this requires
897 more than 15 characters, display the full value, emit a newline,
898 and continue the data display properly indented on the next line.
899 .It Fl \&? , Fl \-help
900 Display usage information and exit.
901 .It Fl \&! , Fl \-more\-help
902 Pass the extended usage information through a pager.
903 .It Fl > Oo Ar cfgfile Oc , Fl \-save\-opts Oo Ns = Ns Ar cfgfile Oc
904 Save the option state to \fIcfgfile\fP. The default is the \fIlast\fP
905 configuration file listed in the \fBOPTION PRESETS\fP section, below.
906 The command will exit after updating the config file.
907 .It Fl < Ar cfgfile , Fl \-load\-opts Ns = Ns Ar cfgfile , Fl \-no\-load\-opts
908 Load options from \fIcfgfile\fP.
909 The \fIno\-load\-opts\fP form will disable the loading
910 of earlier config/rc/ini files. \fI\-\-no\-load\-opts\fP is handled early,
912 .It Fl \-version Op Brq Ar v|c|n
913 Output version of program and exit. The default mode is `v', a simple
914 version. The `c' mode will print copyright information and `n' will
915 print the full copyright notice.
918 Any option that is not marked as \fInot presettable\fP may be preset
919 by loading values from configuration ("RC" or ".INI") file(s) and values from
920 environment variables named:
922 \fBNTPQ_<option\-name>\fP or \fBNTPQ\fP
925 The environmental presets take precedence (are processed later than)
926 the configuration files.
927 The \fIhomerc\fP files are "\fI$HOME\fP", and "\fI.\fP".
928 If any of these are directories, then the file \fI.ntprc\fP
929 is searched for within those directories.
931 See \fBOPTION PRESETS\fP for configuration environment variables.
933 See \fBOPTION PRESETS\fP for configuration files.
935 One of the following exit values will be returned:
937 .It 0 " (EXIT_SUCCESS)"
938 Successful program execution.
939 .It 1 " (EXIT_FAILURE)"
940 The operation failed or the command syntax was not valid.
941 .It 66 " (EX_NOINPUT)"
942 A specified configuration file could not be loaded.
943 .It 70 " (EX_SOFTWARE)"
944 libopts had an internal operational error. Please report
945 it to autogen\-users@lists.sourceforge.net. Thank you.
948 The University of Delaware and Network Time Foundation
950 Copyright (C) 1992\-2015 The University of Delaware and Network Time Foundation all rights reserved.
951 This program is released under the terms of the NTP license, <http://ntp.org/license>.
953 Please send bug reports to: http://bugs.ntp.org, bugs@ntp.org
955 This manual page was \fIAutoGen\fP\-erated from the \fBntpq\fP