xref: /netbsd-src/external/bsd/ntp/dist/ntpd/invoke-ntpd.texi (revision 413d532bcc3f62d122e56d92e13ac64825a40baf)
1@node ntpd Invocation
2@section Invoking ntpd
3@pindex ntpd
4@cindex NTP daemon program
5@ignore
6#
7# EDIT THIS FILE WITH CAUTION  (invoke-ntpd.texi)
8#
9# It has been AutoGen-ed  December 24, 2013 at 11:38:19 AM by AutoGen 5.18.3pre5
10# From the definitions    ntpd-opts.def
11# and the template file   agtexi-cmd.tpl
12@end ignore
13
14
15
16The
17@code{ntpd}
18utility is an operating system daemon which sets
19and maintains the system time of day in synchronism with Internet
20standard time servers.
21It is a complete implementation of the
22Network Time Protocol (NTP) version 4, as defined by RFC-5905,
23but also retains compatibility with
24version 3, as defined by RFC-1305, and versions 1
25and 2, as defined by RFC-1059 and RFC-1119, respectively.
26
27The
28@code{ntpd}
29utility does most computations in 64-bit floating point
30arithmetic and does relatively clumsy 64-bit fixed point operations
31only when necessary to preserve the ultimate precision, about 232
32picoseconds.
33While the ultimate precision is not achievable with
34ordinary workstations and networks of today, it may be required
35with future gigahertz CPU clocks and gigabit LANs.
36
37Ordinarily,
38@code{ntpd}
39reads the
40@code{ntp.conf(5)}
41configuration file at startup time in order to determine the
42synchronization sources and operating modes.
43It is also possible to
44specify a working, although limited, configuration entirely on the
45command line, obviating the need for a configuration file.
46This may
47be particularly useful when the local host is to be configured as a
48broadcast/multicast client, with all peers being determined by
49listening to broadcasts at run time.
50
51If NetInfo support is built into
52@code{ntpd}
53then
54@code{ntpd}
55will attempt to read its configuration from the
56NetInfo if the default
57@code{ntp.conf(5)}
58file cannot be read and no file is
59specified by the
60@code{-c}
61option.
62
63Various internal
64@code{ntpd}
65variables can be displayed and
66configuration options altered while the
67@code{ntpd}
68is running
69using the
70@code{ntpq(1ntpqmdoc)}
71and
72@code{ntpdc(1ntpdcmdoc)}
73utility programs.
74
75When
76@code{ntpd}
77starts it looks at the value of
78@code{umask(2)},
79and if zero
80@code{ntpd}
81will set the
82@code{umask(2)}
83to 022.
84
85This section was generated by @strong{AutoGen},
86using the @code{agtexi-cmd} template and the option descriptions for the @code{ntpd} program.
87This software is released under the NTP license, <http://ntp.org/license>.
88
89@menu
90* ntpd usage::                  ntpd help/usage (@option{--help})
91* ntpd ipv4::                   ipv4 option (-4)
92* ntpd ipv6::                   ipv6 option (-6)
93* ntpd authreq::                authreq option (-a)
94* ntpd authnoreq::              authnoreq option (-A)
95* ntpd configfile::             configfile option (-c)
96* ntpd driftfile::              driftfile option (-f)
97* ntpd panicgate::              panicgate option (-g)
98* ntpd jaildir::                jaildir option (-i)
99* ntpd interface::              interface option (-I)
100* ntpd keyfile::                keyfile option (-k)
101* ntpd logfile::                logfile option (-l)
102* ntpd novirtualips::           novirtualips option (-L)
103* ntpd modifymmtimer::          modifymmtimer option (-M)
104* ntpd nice::                   nice option (-N)
105* ntpd pidfile::                pidfile option (-p)
106* ntpd priority::               priority option (-P)
107* ntpd quit::                   quit option (-q)
108* ntpd propagationdelay::       propagationdelay option (-r)
109* ntpd saveconfigquit::         saveconfigquit option
110* ntpd statsdir::               statsdir option (-s)
111* ntpd trustedkey::             trustedkey option (-t)
112* ntpd user::                   user option (-u)
113* ntpd updateinterval::         updateinterval option (-U)
114* ntpd wait-sync::              wait-sync option (-w)
115* ntpd slew::                   slew option (-x)
116* ntpd usepcc::                 usepcc option
117* ntpd pccfreq::                pccfreq option
118* ntpd mdns::                   mdns option (-m)
119* ntpd config::                 presetting/configuring ntpd
120* ntpd exit status::            exit status
121* ntpd Usage::                  Usage
122* ntpd Files::                  Files
123* ntpd See Also::               See Also
124* ntpd Bugs::                   Bugs
125* ntpd Notes::                  Notes
126@end menu
127
128@node ntpd usage
129@subsection ntpd help/usage (@option{--help})
130@cindex ntpd help
131
132This is the automatically generated usage text for ntpd.
133
134The text printed is the same whether selected with the @code{help} option
135(@option{--help}) or the @code{more-help} option (@option{--more-help}).  @code{more-help} will print
136the usage text by passing it through a pager program.
137@code{more-help} is disabled on platforms without a working
138@code{fork(2)} function.  The @code{PAGER} environment variable is
139used to select the program, defaulting to @file{more}.  Both will exit
140with a status code of 0.
141
142@exampleindent 0
143@example
144ntpd - NTP daemon program - Ver. 4.2.7p404
145Usage:  ntpd [ -<flag> [<val>] | --<name>[@{=| @}<val>] ]... \
146                [ <server1> ... <serverN> ]
147  Flg Arg Option-Name    Description
148   -4 no  ipv4           Force IPv4 DNS name resolution
149                                - prohibits the option 'ipv6'
150   -6 no  ipv6           Force IPv6 DNS name resolution
151                                - prohibits the option 'ipv4'
152   -a no  authreq        Require crypto authentication
153                                - prohibits the option 'authnoreq'
154   -A no  authnoreq      Do not require crypto authentication
155                                - prohibits the option 'authreq'
156   -b no  bcastsync      Allow us to sync to broadcast servers
157   -c Str configfile     configuration file name
158   -d no  debug-level    Increase debug verbosity level
159                                - may appear multiple times
160   -D Num set-debug-level Set the debug verbosity level
161                                - may appear multiple times
162   -f Str driftfile      frequency drift file name
163   -g no  panicgate      Allow the first adjustment to be Big
164                                - may appear multiple times
165   -i Str jaildir        Jail directory
166   -I Str interface      Listen on an interface name or address
167                                - may appear multiple times
168   -k Str keyfile        path to symmetric keys
169   -l Str logfile        path to the log file
170   -L no  novirtualips   Do not listen to virtual interfaces
171   -n no  nofork         Do not fork
172                                - prohibits the option 'wait-sync'
173   -N no  nice           Run at high priority
174   -p Str pidfile        path to the PID file
175   -P Num priority       Process priority
176   -q no  quit           Set the time and quit
177                                - prohibits these options:
178                                saveconfigquit
179                                wait-sync
180   -r Str propagationdelay Broadcast/propagation delay
181      Str saveconfigquit Save parsed configuration and quit
182                                - prohibits these options:
183                                quit
184                                wait-sync
185   -s Str statsdir       Statistics file location
186   -t Str trustedkey     Trusted key number
187                                - may appear multiple times
188   -u Str user           Run as userid (or userid:groupid)
189   -U Num updateinterval interval in seconds between scans for new or dropped interfaces
190      Str var            make ARG an ntp variable (RW)
191                                - may appear multiple times
192      Str dvar           make ARG an ntp variable (RW|DEF)
193                                - may appear multiple times
194   -w Num wait-sync      Seconds to wait for first clock sync
195                                - prohibits these options:
196                                nofork
197                                quit
198                                saveconfigquit
199   -x no  slew           Slew up to 600 seconds
200      opt version        output version information and exit
201   -? no  help           display extended usage information and exit
202   -! no  more-help      extended usage information passed thru pager
203
204Options are specified by doubled hyphens and their name or by a single
205hyphen and the flag character.
206
207
208The following option preset mechanisms are supported:
209 - examining environment variables named NTPD_*
210
211Please send bug reports to:  <http://bugs.ntp.org, bugs@@ntp.org>
212
213exit 0
214@end example
215@exampleindent 4
216
217@node ntpd ipv4
218@subsection ipv4 option (-4)
219@cindex ntpd-ipv4
220
221This is the ``force ipv4 dns name resolution'' option.
222
223@noindent
224This option has some usage constraints.  It:
225@itemize @bullet
226@item
227must not appear in combination with any of the following options:
228ipv6.
229@end itemize
230
231Force DNS resolution of following host names on the command line
232to the IPv4 namespace.
233@node ntpd ipv6
234@subsection ipv6 option (-6)
235@cindex ntpd-ipv6
236
237This is the ``force ipv6 dns name resolution'' option.
238
239@noindent
240This option has some usage constraints.  It:
241@itemize @bullet
242@item
243must not appear in combination with any of the following options:
244ipv4.
245@end itemize
246
247Force DNS resolution of following host names on the command line
248to the IPv6 namespace.
249@node ntpd authreq
250@subsection authreq option (-a)
251@cindex ntpd-authreq
252
253This is the ``require crypto authentication'' option.
254
255@noindent
256This option has some usage constraints.  It:
257@itemize @bullet
258@item
259must not appear in combination with any of the following options:
260authnoreq.
261@end itemize
262
263Require cryptographic authentication for broadcast client,
264multicast client and symmetric passive associations.
265This is the default.
266@node ntpd authnoreq
267@subsection authnoreq option (-A)
268@cindex ntpd-authnoreq
269
270This is the ``do not require crypto authentication'' option.
271
272@noindent
273This option has some usage constraints.  It:
274@itemize @bullet
275@item
276must not appear in combination with any of the following options:
277authreq.
278@end itemize
279
280Do not require cryptographic authentication for broadcast client,
281multicast client and symmetric passive associations.
282This is almost never a good idea.
283@node ntpd configfile
284@subsection configfile option (-c)
285@cindex ntpd-configfile
286
287This is the ``configuration file name'' option.
288This option takes a string argument.
289The name and path of the configuration file,
290@file{/etc/ntp.conf}
291by default.
292@node ntpd driftfile
293@subsection driftfile option (-f)
294@cindex ntpd-driftfile
295
296This is the ``frequency drift file name'' option.
297This option takes a string argument.
298The name and path of the frequency file,
299@file{/etc/ntp.drift}
300by default.
301This is the same operation as the
302@code{driftfile} @kbd{driftfile}
303configuration specification in the
304@file{/etc/ntp.conf}
305file.
306@node ntpd panicgate
307@subsection panicgate option (-g)
308@cindex ntpd-panicgate
309
310This is the ``allow the first adjustment to be big'' option.
311
312@noindent
313This option has some usage constraints.  It:
314@itemize @bullet
315@item
316may appear an unlimited number of times.
317@end itemize
318
319Normally,
320@code{ntpd}
321exits with a message to the system log if the offset exceeds the panic threshold, which is 1000 s by default. This option allows the time to be set to any value without restriction; however, this can happen only once. If the threshold is exceeded after that,
322@code{ntpd}
323will exit with a message to the system log. This option can be used with the
324@code{-q}
325and
326@code{-x}
327options.
328See the
329@code{tinker}
330configuration file directive for other options.
331@node ntpd jaildir
332@subsection jaildir option (-i)
333@cindex ntpd-jaildir
334
335This is the ``jail directory'' option.
336This option takes a string argument.
337
338@noindent
339This option has some usage constraints.  It:
340@itemize @bullet
341@item
342must be compiled in by defining @code{HAVE_DROPROOT} during the compilation.
343@end itemize
344
345Chroot the server to the directory
346@kbd{jaildir}
347.
348This option also implies that the server attempts to drop root privileges at startup.
349You may need to also specify a
350@code{-u}
351option.
352This option is only available if the OS supports adjusting the clock
353without full root privileges.
354This option is supported under NetBSD (configure with
355@code{--enable-clockctl}) or Linux (configure with
356@code{--enable-linuxcaps}) or Solaris (configure with @code{--enable-solarisprivs}).
357@node ntpd interface
358@subsection interface option (-I)
359@cindex ntpd-interface
360
361This is the ``listen on an interface name or address'' option.
362This option takes a string argument @file{iface}.
363
364@noindent
365This option has some usage constraints.  It:
366@itemize @bullet
367@item
368may appear an unlimited number of times.
369@end itemize
370
371Open the network address given, or all the addresses associated with the
372given interface name.  This option may appear multiple times.  This option
373also implies not opening other addresses, except wildcard and localhost.
374This option is deprecated. Please consider using the configuration file
375@code{interface} command, which is more versatile.
376@node ntpd keyfile
377@subsection keyfile option (-k)
378@cindex ntpd-keyfile
379
380This is the ``path to symmetric keys'' option.
381This option takes a string argument.
382Specify the name and path of the symmetric key file.
383@file{/etc/ntp.keys}
384is the default.
385This is the same operation as the
386@code{keys} @kbd{keyfile}
387configuration file directive.
388@node ntpd logfile
389@subsection logfile option (-l)
390@cindex ntpd-logfile
391
392This is the ``path to the log file'' option.
393This option takes a string argument.
394Specify the name and path of the log file.
395The default is the system log file.
396This is the same operation as the
397@code{logfile} @kbd{logfile}
398configuration file directive.
399@node ntpd novirtualips
400@subsection novirtualips option (-L)
401@cindex ntpd-novirtualips
402
403This is the ``do not listen to virtual interfaces'' option.
404Do not listen to virtual interfaces, defined as those with
405names containing a colon.  This option is deprecated.  Please
406consider using the configuration file @code{interface} command, which
407is more versatile.
408@node ntpd modifymmtimer
409@subsection modifymmtimer option (-M)
410@cindex ntpd-modifymmtimer
411
412This is the ``modify multimedia timer (windows only)'' option.
413
414@noindent
415This option has some usage constraints.  It:
416@itemize @bullet
417@item
418must be compiled in by defining @code{SYS_WINNT} during the compilation.
419@end itemize
420
421Set the Windows Multimedia Timer to highest resolution.  This
422ensures the resolution does not change while ntpd is running,
423avoiding timekeeping glitches associated with changes.
424@node ntpd nice
425@subsection nice option (-N)
426@cindex ntpd-nice
427
428This is the ``run at high priority'' option.
429To the extent permitted by the operating system, run
430@code{ntpd}
431at the highest priority.
432@node ntpd pidfile
433@subsection pidfile option (-p)
434@cindex ntpd-pidfile
435
436This is the ``path to the pid file'' option.
437This option takes a string argument.
438Specify the name and path of the file used to record
439@code{ntpd}'s
440process ID.
441This is the same operation as the
442@code{pidfile} @kbd{pidfile}
443configuration file directive.
444@node ntpd priority
445@subsection priority option (-P)
446@cindex ntpd-priority
447
448This is the ``process priority'' option.
449This option takes a number argument.
450To the extent permitted by the operating system, run
451@code{ntpd}
452at the specified
453@code{sched_setscheduler(SCHED_FIFO)}
454priority.
455@node ntpd quit
456@subsection quit option (-q)
457@cindex ntpd-quit
458
459This is the ``set the time and quit'' option.
460
461@noindent
462This option has some usage constraints.  It:
463@itemize @bullet
464@item
465must not appear in combination with any of the following options:
466saveconfigquit, wait-sync.
467@end itemize
468
469@code{ntpd}
470will not daemonize and will exit after the clock is first
471synchronized.  This behavior mimics that of the
472@code{ntpdate}
473program, which will soon be replaced with a shell script.
474The
475@code{-g}
476and
477@code{-x}
478options can be used with this option.
479Note: The kernel time discipline is disabled with this option.
480@node ntpd propagationdelay
481@subsection propagationdelay option (-r)
482@cindex ntpd-propagationdelay
483
484This is the ``broadcast/propagation delay'' option.
485This option takes a string argument.
486Specify the default propagation delay from the broadcast/multicast server to this client. This is necessary only if the delay cannot be computed automatically by the protocol.
487@node ntpd saveconfigquit
488@subsection saveconfigquit option
489@cindex ntpd-saveconfigquit
490
491This is the ``save parsed configuration and quit'' option.
492This option takes a string argument.
493
494@noindent
495This option has some usage constraints.  It:
496@itemize @bullet
497@item
498must be compiled in by defining @code{SAVECONFIG} during the compilation.
499@item
500must not appear in combination with any of the following options:
501quit, wait-sync.
502@end itemize
503
504Cause @code{ntpd} to parse its startup configuration file and save an
505equivalent to the given filename and exit.  This option was
506designed for automated testing.
507@node ntpd statsdir
508@subsection statsdir option (-s)
509@cindex ntpd-statsdir
510
511This is the ``statistics file location'' option.
512This option takes a string argument.
513Specify the directory path for files created by the statistics facility.
514This is the same operation as the
515@code{statsdir} @kbd{statsdir}
516configuration file directive.
517@node ntpd trustedkey
518@subsection trustedkey option (-t)
519@cindex ntpd-trustedkey
520
521This is the ``trusted key number'' option.
522This option takes a string argument @file{tkey}.
523
524@noindent
525This option has some usage constraints.  It:
526@itemize @bullet
527@item
528may appear an unlimited number of times.
529@end itemize
530
531Add the specified key number to the trusted key list.
532@node ntpd user
533@subsection user option (-u)
534@cindex ntpd-user
535
536This is the ``run as userid (or userid:groupid)'' option.
537This option takes a string argument.
538
539@noindent
540This option has some usage constraints.  It:
541@itemize @bullet
542@item
543must be compiled in by defining @code{HAVE_DROPROOT} during the compilation.
544@end itemize
545
546Specify a user, and optionally a group, to switch to.
547This option is only available if the OS supports adjusting the clock
548without full root privileges.
549This option is supported under NetBSD (configure with
550@code{--enable-clockctl}) or Linux (configure with
551@code{--enable-linuxcaps}) or Solaris (configure with @code{--enable-solarisprivs}).
552@node ntpd updateinterval
553@subsection updateinterval option (-U)
554@cindex ntpd-updateinterval
555
556This is the ``interval in seconds between scans for new or dropped interfaces'' option.
557This option takes a number argument.
558Give the time in seconds between two scans for new or dropped interfaces.
559For systems with routing socket support the scans will be performed shortly after the interface change
560has been detected by the system.
561Use 0 to disable scanning. 60 seconds is the minimum time between scans.
562@node ntpd wait-sync
563@subsection wait-sync option (-w)
564@cindex ntpd-wait-sync
565
566This is the ``seconds to wait for first clock sync'' option.
567This option takes a number argument.
568
569@noindent
570This option has some usage constraints.  It:
571@itemize @bullet
572@item
573must be compiled in by defining @code{HAVE_WORKING_FORK} during the compilation.
574@item
575must not appear in combination with any of the following options:
576nofork, quit, saveconfigquit.
577@end itemize
578
579If greater than zero, alters @code{ntpd}'s behavior when forking to
580daemonize.  Instead of exiting with status 0 immediately after
581the fork, the parent waits up to the specified number of
582seconds for the child to first synchronize the clock.  The exit
583status is zero (success) if the clock was synchronized,
584otherwise it is @code{ETIMEDOUT}.
585This provides the option for a script starting @code{ntpd} to easily
586wait for the first set of the clock before proceeding.
587@node ntpd slew
588@subsection slew option (-x)
589@cindex ntpd-slew
590
591This is the ``slew up to 600 seconds'' option.
592Normally, the time is slewed if the offset is less than the step threshold, which is 128 ms by default, and stepped if above the threshold.
593This option sets the threshold to 600 s, which is well within the accuracy window to set the clock manually.
594Note: Since the slew rate of typical Unix kernels is limited to 0.5 ms/s, each second of adjustment requires an amortization interval of 2000 s.
595Thus, an adjustment as much as 600 s will take almost 14 days to complete.
596This option can be used with the
597@code{-g}
598and
599@code{-q}
600options.
601See the
602@code{tinker}
603configuration file directive for other options.
604Note: The kernel time discipline is disabled with this option.
605@node ntpd usepcc
606@subsection usepcc option
607@cindex ntpd-usepcc
608
609This is the ``use cpu cycle counter (windows only)'' option.
610
611@noindent
612This option has some usage constraints.  It:
613@itemize @bullet
614@item
615must be compiled in by defining @code{SYS_WINNT} during the compilation.
616@end itemize
617
618Attempt to substitute the CPU counter for @code{QueryPerformanceCounter}.
619The CPU counter and @code{QueryPerformanceCounter} are compared, and if
620they have the same frequency, the CPU counter (RDTSC on x86) is
621used directly, saving the overhead of a system call.
622@node ntpd pccfreq
623@subsection pccfreq option
624@cindex ntpd-pccfreq
625
626This is the ``force cpu cycle counter use (windows only)'' option.
627This option takes a string argument.
628
629@noindent
630This option has some usage constraints.  It:
631@itemize @bullet
632@item
633must be compiled in by defining @code{SYS_WINNT} during the compilation.
634@end itemize
635
636Force substitution the CPU counter for @code{QueryPerformanceCounter}.
637The CPU counter (RDTSC on x86) is used unconditionally with the
638given frequency (in Hz).
639@node ntpd mdns
640@subsection mdns option (-m)
641@cindex ntpd-mdns
642
643This is the ``register with mdns as a ntp server'' option.
644
645@noindent
646This option has some usage constraints.  It:
647@itemize @bullet
648@item
649must be compiled in by defining @code{HAVE_DNSREGISTRATION} during the compilation.
650@end itemize
651
652Registers as an NTP server with the local mDNS server which allows
653the server to be discovered via mDNS client lookup.
654
655
656@node ntpd config
657@subsection presetting/configuring ntpd
658
659Any option that is not marked as @i{not presettable} may be preset by
660loading values from environment variables named @code{NTPD} and @code{NTPD_<OPTION_NAME>}.  @code{<OPTION_NAME>} must be one of
661the options listed above in upper case and segmented with underscores.
662The @code{NTPD} variable will be tokenized and parsed like
663the command line.  The remaining variables are tested for existence and their
664values are treated like option arguments.
665
666
667The command line options relating to configuration and/or usage help are:
668
669@subsubheading version (-)
670
671Print the program version to standard out, optionally with licensing
672information, then exit 0.  The optional argument specifies how much licensing
673detail to provide.  The default is to print just the version.  The licensing infomation may be selected with an option argument.
674Only the first letter of the argument is examined:
675
676@table @samp
677@item version
678Only print the version.  This is the default.
679@item copyright
680Name the copyright usage licensing terms.
681@item verbose
682Print the full copyright usage licensing terms.
683@end table
684
685@node ntpd exit status
686@subsection ntpd exit status
687
688One of the following exit values will be returned:
689@table @samp
690@item 0 (EXIT_SUCCESS)
691Successful program execution.
692@item 1 (EXIT_FAILURE)
693The operation failed or the command syntax was not valid.
694@end table
695@node ntpd Usage
696@subsection ntpd Usage
697@node ntpd Files
698@subsection ntpd Files
699@node ntpd See Also
700@subsection ntpd See Also
701@node ntpd Bugs
702@subsection ntpd Bugs
703@node ntpd Notes
704@subsection ntpd Notes
705