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