Change the default for ntpd back to -s, the bug which triggered this
[dragonfly.git] / usr.sbin / ntp / doc / ntpdc.8
1 .\"
2 .\" $FreeBSD: src/usr.sbin/ntp/doc/ntpdc.8,v 1.2.2.8 2003/03/11 22:31:29 trhodes Exp $
3 .\" $DragonFly: src/usr.sbin/ntp/doc/Attic/ntpdc.8,v 1.2 2003/06/17 04:29:58 dillon Exp $
4 .\"
5 .Dd January 7, 2000
6 .Dt NTPDC 8
7 .Os
8 .Sh NAME
9 .Nm ntpdc
10 .Nd special NTP query program
11 .Sh SYNOPSIS
12 .Nm
13 .Op Fl ilnps
14 .Op Fl c Ar command
15 .Op Ar host ...
16 .Sh DESCRIPTION
17 The
18 .Nm
19 utility is used to query the
20 .Xr ntpd 8
21 daemon about its
22 current state and to request changes in that state.
23 The program may
24 be run either in interactive mode or controlled using command line
25 arguments.
26 Extensive state and statistics information is available
27 through the
28 .Nm
29 interface.
30 In addition, nearly all the
31 configuration options which can be specified at startup using
32 ntpd's configuration file may also be specified at run time using
33 .Nm .
34 .Pp
35 The following options are available:
36 .Bl -tag -width indent
37 .It Fl c Ar command
38 The following argument is interpreted as an interactive format
39 command and is added to the list of commands to be executed on the
40 specified host(s).
41 Multiple
42 .Fl c
43 options may be given.
44 .It Fl i
45 Force
46 .Nm
47 to operate in interactive mode.
48 Prompts
49 will be written to the standard output and commands read from the
50 standard input.
51 .It Fl l
52 Obtain a list of peers which are known to the server(s).
53 This
54 switch is equivalent to
55 .Ql -c listpeers .
56 .It Fl n
57 Output all host addresses in dotted-quad numeric format rather
58 than converting to the canonical host names.
59 .It Fl p
60 Print a list of the peers known to the server as well as a
61 summary of their state.
62 This is equivalent to
63 .Ql -c peers .
64 .It Fl s
65 Print a list of the peers known to the server as well as a
66 summary of their state, but in a slightly different format than the
67 .Fl p
68 switch.
69 This is equivalent to
70 .Ql -c dmpeers .
71 .El
72 .Pp
73 If one or more request options are included on the command line
74 when
75 .Nm
76 is executed, each of the requests will be sent
77 to the NTP servers running on each of the hosts given as command
78 line arguments, or on localhost by default.
79 If no request options
80 are given,
81 .Nm
82 will attempt to read commands from the
83 standard input and execute these on the NTP server running on the
84 first host given on the command line, again defaulting to localhost
85 when no other host is specified.
86 The
87 .Nm
88 utility will prompt for
89 commands if the standard input is a terminal device.
90 .Pp
91 The
92 .Nm
93 utility uses NTP mode 7 packets to communicate with the
94 NTP server, and hence can be used to query any compatible server on
95 the network which permits it.
96 Note that since NTP is a UDP protocol
97 this communication will be somewhat unreliable, especially over
98 large distances in terms of network topology.
99 The
100 .Nm
101 utility makes
102 no attempt to retransmit requests, and will time requests out if
103 the remote host is not heard from within a suitable timeout
104 time.
105 .Pp
106 The operation of
107 .Nm
108 are specific to the particular
109 implementation of the
110 .Xr ntpd 8
111 daemon and can be expected to
112 work only with this and maybe some previous versions of the daemon.
113 Requests from a remote
114 .Nm
115 utility which affect the
116 state of the local server must be authenticated, which requires
117 both the remote program and local server share a common key and key
118 identifier.
119 Specifying a command line option other than
120 .Fl i
121 or
122 .Fl n
123 will cause the specified query (queries) to be sent to
124 the indicated host(s) immediately.
125 Otherwise,
126 .Nm
127 will
128 attempt to read interactive format commands from the standard
129 input.
130 .Ss "Interactive Commands"
131 Interactive format commands consist of a keyword followed by zero
132 to four arguments.
133 Only enough characters of the full keyword to
134 uniquely identify the command need be typed.
135 The output of a
136 command is normally sent to the standard output, but optionally the
137 output of individual commands may be sent to a file by appending a
138 .Ql \&> ,
139 followed by a file name, to the command line.
140 .Pp
141 A number of interactive format commands are executed entirely
142 within the
143 .Nm
144 utility itself and do not result in NTP
145 mode 7 requests being sent to a server.
146 These are described
147 following.
148 .Bl -tag -width indent
149 .It Ic \&? Ar command_keyword
150 .It Ic help Ar command_keyword
151 A
152 .Ic \&?
153 will print a list of all the command
154 keywords known to this incarnation of
155 .Nm .
156 A
157 .Ic \&?
158 followed by a command keyword will print function and usage
159 information about the command.
160 This command is probably a better
161 source of information about
162 .Xr ntpq 8
163 than this manual
164 page.
165 .It Ic delay Ar milliseconds
166 Specify a time interval to be added to timestamps included in
167 requests which require authentication.
168 This is used to enable
169 (unreliable) server reconfiguration over long delay network paths
170 or between machines whose clocks are unsynchronized.
171 Actually the
172 server does not now require timestamps in authenticated requests,
173 so this command may be obsolete.
174 .It Ic host Ar hostname
175 Set the host to which future queries will be sent.
176 Hostname may
177 be either a host name or a numeric address.
178 .It Ic hostnames Op Cm yes | Cm no
179 If
180 .Cm yes
181 is specified, host names are printed in
182 information displays.
183 If
184 .Cm no
185 is specified, numeric
186 addresses are printed instead.
187 The default is
188 .Cm yes ,
189 unless
190 modified using the command line
191 .Fl n
192 switch.
193 .It Ic keyid Ar keyid
194 This command allows the specification of a key number to be
195 used to authenticate configuration requests.
196 This must correspond
197 to a key number the server has been configured to use for this
198 purpose.
199 .It Ic quit
200 Exit
201 .Nm .
202 .It Ic passwd
203 This command prompts you to type in a password (which will not
204 be echoed) which will be used to authenticate configuration
205 requests.
206 The password must correspond to the key configured for
207 use by the NTP server for this purpose if such requests are to be
208 successful.
209 .It Ic timeout Ar milliseconds
210 Specify a timeout period for responses to server queries.
211 The
212 default is about 8000 milliseconds.
213 Note that since
214 .Nm
215 retries each query once after a timeout, the total waiting time for
216 a timeout will be twice the timeout value set.
217 .El
218 .Ss "Control Message Commands"
219 Query commands result in NTP mode 7 packets containing requests for
220 information being sent to the server.
221 These are read-only commands
222 in that they make no modification of the server configuration
223 state.
224 .Bl -tag -width indent
225 .It Ic listpeers
226 Obtains and prints a brief list of the peers for which the
227 server is maintaining state.
228 These should include all configured
229 peer associations as well as those peers whose stratum is such that
230 they are considered by the server to be possible future
231 synchonization candidates.
232 .It Ic peers
233 Obtains a list of peers for which the server is maintaining
234 state, along with a summary of that state.
235 Summary information
236 includes the address of the remote peer, the local interface
237 address (0.0.0.0 if a local address has yet to be determined), the
238 stratum of the remote peer (a stratum of 16 indicates the remote
239 peer is unsynchronized), the polling interval, in seconds, the
240 reachability register, in octal, and the current estimated delay,
241 offset and dispersion of the peer, all in seconds.
242 .Pp
243 The character in the left margin indicates the mode this peer
244 entry is operating in.
245 A
246 .Ql \&+
247 denotes symmetric active, a
248 .Ql \&-
249 indicates symmetric passive, a
250 .Ql \&=
251 means the
252 remote server is being polled in client mode, a
253 .Ql \&^
254 indicates that the server is broadcasting to this address, a
255 .Ql \&~
256 denotes that the remote peer is sending broadcasts and a
257 .Ql \&*
258 marks the peer the server is currently synchronizing
259 to.
260 .Pp
261 The contents of the host field may be one of four forms.
262 It may
263 be a host name, an IP address, a reference clock implementation
264 name with its parameter or
265 .Fn REFCLK "implementation_number" "parameter" .
266 On
267 .Ic hostnames
268 .Cm no
269 only IP-addresses
270 will be displayed.
271 .It Ic dmpeers
272 A slightly different peer summary list.
273 Identical to the output
274 of the
275 .Ic peers
276 command, except for the character in the
277 leftmost column.
278 Characters only appear beside peers which were
279 included in the final stage of the clock selection algorithm.
280 A
281 .Ql \&.
282 indicates that this peer was cast off in the falseticker
283 detection, while a
284 .Ql \&+
285 indicates that the peer made it
286 through.
287 A
288 .Ql \&*
289 denotes the peer the server is currently
290 synchronizing with.
291 .It Ic showpeer Ar peer_address ...
292 Shows a detailed display of the current peer variables for one
293 or more peers.
294 Most of these values are described in the NTP
295 Version 2 specification.
296 .It Ic pstats Ar peer_address ...
297 Show per-peer statistic counters associated with the specified
298 peer(s).
299 .It Ic clockinfo Ar clock_peer_address ...
300 Obtain and print information concerning a peer clock.
301 The
302 values obtained provide information on the setting of fudge factors
303 and other clock performance information.
304 .It Ic kerninfo
305 Obtain and print kernel phase-lock loop operating parameters.
306 This information is available only if the kernel has been specially
307 modified for a precision timekeeping function.
308 .It Ic loopinfo Op Cm oneline | Cm multiline
309 Print the values of selected loop filter variables.
310 The loop
311 filter is the part of NTP which deals with adjusting the local
312 system clock.
313 The
314 .Sq offset
315 is the last offset given to the
316 loop filter by the packet processing code.
317 The
318 .Sq frequency
319 is the frequency error of the local clock in parts-per-million
320 (ppm).
321 The
322 .Sq time_const
323 controls the stiffness of the
324 phase-lock loop and thus the speed at which it can adapt to
325 oscillator drift.
326 The
327 .Sq watchdog timer
328 value is the number
329 of seconds which have elapsed since the last sample offset was
330 given to the loop filter.
331 The
332 .Cm oneline
333 and
334 .Cm multiline
335 options specify the format in which this
336 information is to be printed, with
337 .Cm multiline
338 as the
339 default.
340 .It Ic sysinfo
341 Print a variety of system state variables, i.e., state related
342 to the local server.
343 All except the last four lines are described
344 in the NTP Version 3 specification, RFC-1305.
345 .Pp
346 The
347 .Sq system flags
348 show various system flags, some of
349 which can be set and cleared by the
350 .Ic enable
351 and
352 .Ic disable
353 configuration commands, respectively.
354 These are
355 the
356 .Cm auth  ,
357 .Cm bclient ,
358 .Cm monitor ,
359 .Cm pll ,
360 .Cm pps
361 and
362 .Cm stats
363 flags.
364 See the
365 .Xr ntpd 8
366 documentation for the meaning of these flags.
367 There
368 are two additional flags which are read only, the
369 .Cm kernel_pll
370 and
371 .Cm kernel_pps .
372 These flags indicate
373 the synchronization status when the precision time kernel
374 modifications are in use.
375 The
376 .Sq kernel_pll
377 indicates that
378 the local clock is being disciplined by the kernel, while the
379 .Sq kernel_pps
380 indicates the kernel discipline is provided by the PPS
381 signal.
382 .Pp
383 The
384 .Sq stability
385 is the residual frequency error remaining
386 after the system frequency correction is applied and is intended for
387 maintenance and debugging.
388 In most architectures, this value will
389 initially decrease from as high as 500 ppm to a nominal value in
390 the range .01 to 0.1 ppm.
391 If it remains high for some time after
392 starting the daemon, something may be wrong with the local clock,
393 or the value of the kernel variable
394 .Va kern.clockrate.tick
395 may be
396 incorrect.
397 .Pp
398 The
399 .Sq broadcastdelay
400 shows the default broadcast delay,
401 as set by the
402 .Ic broadcastdelay
403 configuration command.
404 .Pp
405 The
406 .Sq authdelay
407 shows the default authentication delay,
408 as set by the
409 .Ic authdelay
410 configuration command.
411 .It Ic sysstats
412 Print statistics counters maintained in the protocol
413 module.
414 .It Ic memstats
415 Print statistics counters related to memory allocation
416 code.
417 .It Ic iostats
418 Print statistics counters maintained in the input-output
419 module.
420 .It Ic timerstats
421 Print statistics counters maintained in the timer/event queue
422 support code.
423 .It Ic reslist
424 Obtain and print the server's restriction list.
425 This list is
426 (usually) printed in sorted order and may help to understand how
427 the restrictions are applied.
428 .It Ic monlist Op Ar version
429 Obtain and print traffic counts collected and maintained by the
430 monitor facility.
431 The version number should not normally need to be
432 specified.
433 .It Ic clkbug Ar clock_peer_address ...
434 Obtain debugging information for a reference clock driver.
435 This
436 information is provided only by some clock drivers and is mostly
437 undecodable without a copy of the driver source in hand.
438 .El
439 .Ss "Runtime Configuration Requests"
440 All requests which cause state changes in the server are
441 authenticated by the server using a configured NTP key (the
442 facility can also be disabled by the server by not configuring a
443 key).
444 The key number and the corresponding key must also be made
445 known to
446 .Nm .
447 This can be done using the
448 .Ic keyid
449 and
450 .Ic passwd
451 commands, the latter of which will prompt at the terminal for a
452 password to use as the encryption key.
453 You will also be prompted
454 automatically for both the key number and password the first time a
455 command which would result in an authenticated request to the
456 server is given.
457 Authentication not only provides verification that
458 the requester has permission to make such changes, but also gives
459 an extra degree of protection again transmission errors.
460 .Pp
461 Authenticated requests always include a timestamp in the packet
462 data, which is included in the computation of the authentication
463 code.
464 This timestamp is compared by the server to its receive time
465 stamp.
466 If they differ by more than a small amount the request is
467 rejected.
468 This is done for two reasons.
469 First, it makes simple
470 replay attacks on the server, by someone who might be able to
471 overhear traffic on your LAN, much more difficult.
472 Second, it makes
473 it more difficult to request configuration changes to your server
474 from topologically remote hosts.
475 While the reconfiguration facility
476 will work well with a server on the local host, and may work
477 adequately between time-synchronized hosts on the same LAN, it will
478 work very poorly for more distant hosts.
479 As such, if reasonable
480 passwords are chosen, care is taken in the distribution and
481 protection of keys and appropriate source address restrictions are
482 applied, the run time reconfiguration facility should provide an
483 adequate level of security.
484 .Pp
485 The following commands all make authenticated requests.
486 .Bl -tag -width indent
487 .It Xo Ic addpeer Ar peer_address
488 .Op Ar keyid
489 .Op Ar version
490 .Op Cm prefer
491 .Xc
492 Add a configured peer association at the given address and
493 operating in symmetric active mode.
494 Note that an existing
495 association with the same peer may be deleted when this command is
496 executed, or may simply be converted to conform to the new
497 configuration, as appropriate.
498 If the optional
499 .Ar keyid
500 is a
501 nonzero integer, all outgoing packets to the remote server will
502 have an authentication field attached encrypted with this key.
503 If
504 the value is 0 (or not given) no authentication will be done.
505 The
506 .Ar version
507 can be 1, 2 or 3 and defaults to 3.
508 The
509 .Cm prefer
510 keyword indicates a preferred peer (and thus will
511 be used primarily for clock synchronisation if possible).
512 The
513 preferred peer also determines the validity of the PPS signal - if
514 the preferred peer is suitable for synchronisation so is the PPS
515 signal.
516 .It Xo Ic addserver Ar peer_address
517 .Op Ar keyid
518 .Op Ar version
519 .Op Cm prefer
520 .Xc
521 Identical to the addpeer command, except that the operating
522 mode is client.
523 .It Xo Ic broadcast Ar peer_address
524 .Op Ar keyid
525 .Op Ar version
526 .Op Cm prefer
527 .Xc
528 Identical to the addpeer command, except that the operating
529 mode is broadcast.
530 In this case a valid key identifier and key are
531 required.
532 The
533 .Ar peer_address
534 parameter can be the broadcast
535 address of the local network or a multicast group address assigned
536 to NTP.
537 If a multicast address, a multicast-capable kernel is
538 required.
539 .It Ic unconfig Ar peer_address ...
540 This command causes the configured bit to be removed from the
541 specified peer(s).
542 In many cases this will cause the peer
543 association to be deleted.
544 When appropriate, however, the
545 association may persist in an unconfigured mode if the remote peer
546 is willing to continue on in this fashion.
547 .It Xo Ic fudge Ar peer_address
548 .Op Cm time1
549 .Op Cm time2
550 .Op Ar stratum
551 .Op Ar refid
552 .Xc
553 This command provides a way to set certain data for a reference
554 clock.
555 See the source listing for further information.
556 .It Ic enable Ar flag ...
557 .It Ic disable Ar flag ...
558 These commands operate in the same way as the
559 .Ic enable
560 and
561 .Ic disable
562 configuration file commands of
563 .Xr ntpd 8  .
564 Following is a description of the flags.
565 Note that only the
566 .Cm auth  ,
567 .Cm bclient ,
568 .Cm monitor ,
569 .Cm pll ,
570 .Cm pps
571 and
572 .Cm stats
573 flags can be set by
574 .Nm ;
575 the
576 .Cm pll_kernel
577 and
578 .Cm pps_kernel
579 flags are
580 read-only.
581 .Bl -tag -width indent
582 .It Cm auth
583 Enables the server to synchronize with unconfigured peers only
584 if the peer has been correctly authenticated using a trusted key
585 and key identifier.
586 The default for this flag is enable.
587 .It Cm bclient
588 Enables the server to listen for a message from a broadcast or
589 multicast server, as in the
590 .Ic multicastclient
591 command with
592 default address.
593 The default for this flag is disable.
594 .It Cm monitor
595 Enables the monitoring facility.
596 See the
597 .Ic monlist
598 command for further information.
599 The
600 default for this flag is enable.
601 .It Cm pll
602 Enables the server to adjust its local clock by means of NTP.
603 If disabled, the local clock free-runs at its intrinsic time and
604 frequency offset.
605 This flag is useful in case the local clock is
606 controlled by some other device or protocol and NTP is used only to
607 provide synchronization to other clients.
608 In this case, the local
609 clock driver is used.
610 See the
611 .Qq "Reference Clock Drivers"
612 page
613 (available as part of the HTML documentation
614 provided in
615 .Pa /usr/share/doc/ntp )
616 page for further information.
617 The default for
618 this flag is enable.
619 .It Cm pps
620 Enables the pulse-per-second (PPS) signal when frequency and
621 time is disciplined by the precision time kernel modifications.
622 See
623 the
624 .Qq "A Kernel Model for Precision Timekeeping"
625 page for further information.
626 The default for this flag is
627 disable.
628 .It Cm stats
629 Enables the statistics facility.
630 See the
631 .Sx Monitoring Options
632 section
633 of the
634 .Xr ntp.conf 5
635 page for further information.
636 The default for this flag is enable.
637 .It Cm pll_kernel
638 When the precision time kernel modifications are installed,
639 this indicates the kernel controls the clock discipline; otherwise,
640 the daemon controls the clock discipline.
641 .It Cm pps_kernel
642 When the precision time kernel modifications are installed and
643 a pulse-per-second (PPS) signal is available, this indicates the
644 PPS signal controls the clock discipline; otherwise, the daemon or
645 kernel controls the clock discipline, as indicated by the
646 .Cm pll_kernel
647 flag.
648 .El
649 .It Xo Ic restrict Ar address Ar mask
650 .Ar flag ...
651 .Xc
652 This command operates in the same way as the
653 .Ic restrict
654 configuration file commands of
655 .Xr ntpd 8  .
656 .It Xo Ic unrestrict Ar address Ar mask
657 .Ar flag ...
658 .Xc
659 Unrestrict the matching entry from the restrict list.
660 .It Xo Ic delrestrict Ar address Ar mask
661 .Op Cm ntpport
662 .Xc
663 Delete the matching entry from the restrict list.
664 .It Ic readkeys
665 Causes the current set of authentication keys to be purged and
666 a new set to be obtained by rereading the keys file (which must
667 have been specified in the
668 .Xr ntpd 8
669 configuration file).
670 This
671 allows encryption keys to be changed without restarting the
672 server.
673 .It Ic trustedkey Ar keyid ...
674 .It Ic untrustedkey Ar keyid ...
675 These commands operate in the same way as the
676 .Ic trustedkey
677 and
678 .Ic untrustedkey
679 configuration file
680 commands of
681 .Xr ntpd 8  .
682 .It Ic authinfo
683 Returns information concerning the authentication module,
684 including known keys and counts of encryptions and decryptions
685 which have been done.
686 .It Ic traps
687 Display the traps set in the server.
688 See the source listing for
689 further information.
690 .It Xo Ic addtrap Ar address
691 .Op Ar port
692 .Op Ar interface
693 .Xc
694 Set a trap for asynchronous messages.
695 See the source listing
696 for further information.
697 .It Xo Ic clrtrap Ar address
698 .Op Ar port
699 .Op Ar interface
700 .Xc
701 Clear a trap for asynchronous messages.
702 See the source listing
703 for further information.
704 .It Ic reset
705 Clear the statistics counters in various modules of the server.
706 See the source listing for further information.
707 .El
708 .Sh SEE ALSO
709 .Xr ntp.conf 5 ,
710 .Xr ntpd 8
711 .Rs
712 .%A David L. Mills
713 .%T Network Time Protocol (Version 3)
714 .%O RFC1305
715 .Re
716 .Sh BUGS
717 The
718 .Nm
719 utility is a crude hack.
720 Much of the information it shows is
721 deadly boring and could only be loved by its implementer.
722 The
723 program was designed so that new (and temporary) features were easy
724 to hack in, at great expense to the program's ease of use.
725 Despite
726 this, the program is occasionally useful.