Query the NTP daemon
ntpdc [-46ilnps] [-c command] [host] [...]
Neutrino
- -4
- Force DNS resolution of hosts to the IP4 namespace.
- -6
- Force DNS resolution of hosts to the IP6 namespace.
- -c command
- Execute the given command on the specified hosts.
You can use multiple -c options. For more information about
the commands, see below.
- -i
- Force the ntpdc utility to operate in interactive mode.
Prompts will be written to the standard output and commands read from the
standard input.
- -l
- Obtain a list of peers that are known to the servers.
It is equivalent to -c listpeers option.
- -n
- Output all host addresses in dotted-quad numeric format rather than
converting to the canonical host names.
- -p
- Print a list of the peers known to the server along with the
summary of their state. This is equivalent to the
-c peers option.
- -s
- Print a list of the peers known to the server along with
the summary of their state. It has slightly different format
than the -p option. This is equivalent to -c
dmpeers command.
Use the ntpdc utility to query the ntpd daemon
about its current state, and to request changes in that state. You can run
this utility is run either in interactive mode or in command mode. It provides
extensive state and statistics information.
At run time, all configuration options that are specified at startup
using the ntpd utility's configuration file can also be
specified using the ntpdc utility.
When you run the ntpdc utility by including one or more requests
in the command line, each request is sent to the NTP (Network Time Protocol)
servers running on each of the hosts. If no request option is given,
the ntpdc utility attempts to read commands from the
standard input and execute them on the NTP server running
on the first host, as given on the command line. If no host is mentioned, it
always defaults to localhost. The ntpdc
utility prompts for commands if the
standard input is a terminal device.
The ntpdc utility uses NTP mode 7 packets to
communicate with the NTP server, and hence can be used to
query any compatible server on the network that permits it. However
it is somewhat unreliable, especially over large distances
in a network topology. The ntpdc utility makes
no attempt to retransmit requests, and times out if the remote
host's response isn't received within a suitable timeout time.
|
NTP behaves very similar to UDP (User Datagram Protocol). |
You may force the DNS resolution to the IPv4 (or IPv6)
namespace, if you use a
-4 (or -6) option before a host name.
The interactive format commands consist of a
keyword followed by zero or more arguments. You can type only enough
characters to uniquely identify the command. The output of a command is
normally sent to the standard output, but you can send output of
individual commands may be sent to a file by appending a <, followed by a
file name, to the command line. A number of interactive format commands are
executed entirely within the ntpdc utility:
- ? [command_keyword]
help
[command_keyword]
- Print a list of all the command keywords for
the ntpdc utility. If you specify a command keyword,
the function and the usage information about the command are
printed.
- delay milliseconds
- Specify a time interval. This is to be added to timestamps for
requests that require authentication.
- host hostname
- Set the host to which future queries will be sent. The hostname
may be either a host name or a numeric address.
- hostnames [yes | no]
- Print the host names in the information display
when yes is specified. Print the numeric address when no is specified.
The default is yes, unless modified using the
command-line -n option.
- keyid keyid
- Set the key number to use to authenticate configuration requests.
This must correspond to a key number that the server has been configured to.
- passwd
- Prompt for a password, which is not echoed, and is used to
authenticate configuration requests. The password must
correspond to the key configured for the NTP server for this purpose.
- quit
- Exit the ntpdc utility.
- timeout milliseconds
- Specify a timeout period for responses to server queries. The default is
about 8000 milliseconds. Since the ntpdc utility retries each
query once after a timeout, the total waiting time for a timeout will be
twice the timeout value set.
When you use the ntpdc utility to query, NTP mode 7
packets containing requests are sent to the server.
These are read-only commands in that they make no modification
of the server configuration state.
- listpeers
- Obtain and print a brief list of the peers for which the server is
maintaining the state. These should include all configured peer associations
as well as those peers whose stratum is such that they are considered by
the server to be possible future synchronization candidates.
- peers
- Obtain a list of peers for which the server is maintaining the state, along
with a summary of that state. Summary information includes the address
of the remote peer, the local interface address (0.0.0.0 if a local
address has yet to be determined), the stratum of the remote peer (a
stratum of 16 indicates the remote peer is unsynchronized), the polling
interval, in seconds, the register in octal, and the
current estimated delay, offset and dispersion of the peer, all in
seconds.
The character in the left margin indicates the mode this peer entry is
operating in.
This Character: |
Indicates:
|
+ |
Symmetric active
|
- |
Symmetric passive
|
= |
Remote server is being polled in client mode
|
^ |
Server is broadcasting to this address
|
* |
Server is currently synchronizing to this peer. |
The contents of the host field may be one of:
- a host name
- an IP address
- a reference clock implementation name with its
parameter or REFCLK(implementation number, parameter).
If you've specified no, only IP-addresses are displayed.
- dmpeers
- Obtain peer summary list, identical to the output of the
peers command, except for the character in the leftmost column.
Characters appear only beside peers that were included in the final
stage of the clock selection algorithm. A . indicates that this peer was
cast off in the falseticker detection, while a + indicates that the peer
made it through. A * denotes the peer the server is currently
synchronizing with.
- showpeer peer_address [...]
- Show a detailed display of the current peer
variables for one or more peers. Most of these values are described in the
NTP version 2 specification.
- pstats peer_address [...]
- Show per-peer statistic counters associated with the specified peers.
- clockinfo clock_peer_address [...]
- Obtain and print information concerning a peer clock. The values
obtained provide information on the setting of fudge factors and other
clock performance information.
- kerninfo
- Obtain and print kernel phase-lock loop operating parameters. This
information is available only if the kernel has been specially modified
for a precision timekeeping function.
- loopinfo [oneline | multiline]
- Print the values of selected loop filter variables.
The loop filter is the part of NTP that deals with adjusting
the local system clock. The offset is the last
offset given to the loop filter by the packet-processing code.
The frequency is the frequency error of the local clock
in parts-per-million (ppm). The time_const controls
the stiffness of the
phase-lock loop and thus the speed at which it can adapt to oscillator
drift. The watchdog timer value is the number of seconds which have
elapsed since the last sample offset was given to the loop filter. The
oneline and multiline options specify the format in which this
information is to be printed, with multiline as the default.
- sysinfo
- Print a variety of system state variables, i.e., state related to the
local server. All except the last four lines are described in the NTP
Version 3 specification, RFC 1305.
The system flags show various system flags, some of which can be set and
cleared by the enable and disable configuration
commands, respectively. These are the auth, bclient,
monitor, pll, pps and stats
flags. See the ntpd
documentation for the meaning of these flags.
There are two
additional flags which are read only, the kernel_pll and
kernel_pps.
These flags indicate the synchronization status when the precision time
kernel modifications are in use. The kernel_pll indicates
that the local clock is being disciplined by the kernel, while the
kernel_pps indicates
the kernel discipline is provided by the PPS signal.
The stability is the residual frequency error remaining after the system
frequency correction is applied and is intended for maintenance and
debugging. In QNX Neutrino, this value will initially decrease
from as high as 500 ppm to a nominal value in the range .01 to 0.1 ppm.
If it remains high for some time after starting the daemon, something
may be wrong with the local clock, or the value of the kernel variable
tick may be incorrect.
The broadcastdelay shows the default broadcast delay,
as set by the broadcastdelay configuration command.
The authdelay shows the default authentication delay,
as set by the authdelay configuration command.
- sysstats
- Print statistic counters maintained in the protocol module.
- memstats
- Print statistic counters related to memory-allocation code.
- iostats
- Print statistic counters maintained in the input-output module.
- timerstats
- Print statistic counters maintained in the timer/event queue support
code.
- reslist
- Obtain and print the server's restriction list. This list is (usually)
printed in sorted order and may help to understand how the restrictions
are applied.
- monlist [version]
- Obtain and print traffic counts collected and maintained by the monitor
facility. You don't normally have to specify the version number.
- clkbug clock_peer_address [...]
- Obtain debugging information for a reference clock driver. This
information is provided only by some clock drivers and is mostly
undecodable without a copy of the driver source in hand.
With the help of a configured NTP key, the
server authenticates all requests. Authenticated requests
always include a timestamp in the packet data,
which is included in the computation of the authentication code. This
timestamp is compared by the server to its receive timestamp. If they
differ by more than a small amount, the request is rejected.
The following commands all make authenticated requests:
- addpeer peer_address [keyid] [version] [prefer]
- Add a configured peer association at the given address and operating in
symmetric active mode. Note that an existing association with the same
peer may be deleted when this command is executed, or may simply be
converted to conform to the new configuration, as appropriate.
If the
optional keyid is a nonzero integer, all outgoing packets to the remote
server will have an authentication field attached encrypted with this
key. If the value is 0 (or not given) no authentication will be done.
The version number can be 1, 2 or 3, and defaults to 3. The
prefer
keyword
indicates a preferred peer (and thus will be used primarily for clock
synchronization if possible). The preferred peer also determines the
validity of the PPS signal; if the preferred peer is suitable for
synchronization, so is the PPS signal.
- addserver peer_address [keyid]
[version] [prefer]
- Identical to the addpeer command, except that the operating mode is
client.
- broadcast peer_address [keyid]
[version] [prefer]
- Identical to the addpeer command, except that the operating mode is
broadcast. In this case, a valid key identifier and key are required. The
peer_address parameter can be the broadcast address of the local network
or a multicast group address assigned to NTP. If a multicast address, a
multicast-capable kernel is required.
- unconfig peer_address [...]
- This command causes the configured bit to be removed from the specified
peer(s). In many cases, this causes the peer association to be
deleted. When appropriate, however, the association may persist in an
unconfigured mode if the remote peer is willing to continue in this
fashion.
- fudge peer_address [time1]
[time2] [stratum] [refid]
- This command provides a way to set certain data for a reference clock.
- enable [auth | bclient |
calibrate | kernel | monitor |
ntp | pps |
stats]
disable [auth | bclient |
calibrate | kernel | monitor |
ntp | pps |
stats]
- These commands operate in the same way as the enable and
disable
configuration file commands of ntpd.
- restrict address mask flag
[flag]
- This command operates in the same way as the restrict configuration file
commands of the ntpd utility.
- unrestrict address mask flag
[flag]
- Unrestrict the matching entry from the restriction list.
- delrestrict address mask [ntpport]
- Delete the matching entry from the restriction list.
- readkeys
- Purge the current set of authentication keys and obtain a new set
by rereading the keys file (which must have been
specified in the ntpd configuration file). This allows encryption keys
to be changed without restarting the server.
- trustedkey keyid [...]
untrustedkey keyid [...]
- These commands operate in the same way as the trustedkey and
untrustedkey configuration file commands of ntpd.
- authinfo
- Return information concerning the authentication module, including
known keys and counts of encryptions and decryptions that have been
done.
- traps
- Display the traps set in the server.
- addtrap [address [port] [interface]
- Set a trap for asynchronous messages.
- clrtrap [address [port] [interface]
- Clear a trap for asynchronous messages.
- reset
- Clear the statistics counters in various modules of the server.
The ntpdc utility is a crude hack. It is designed so
that new (and temporary) features were easy to hack in, at great expense
to the program's ease of use. Despite this, the program is occasionally
useful.
ntpd,
ntpdate,
ntpq,
ntptrace