xref: /freebsd/contrib/ntp/ntpd/invoke-ntpd.texi (revision b740c88bfb6453416926271c089262e7164dace3)
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  February  4, 2015 at 02:42:04 AM by AutoGen 5.18.5pre4
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.8p1
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@end example
213@exampleindent 4
214
215@node ntpd ipv4
216@subsection ipv4 option (-4)
217@cindex ntpd-ipv4
218
219This is the ``force ipv4 dns name resolution'' option.
220
221@noindent
222This option has some usage constraints.  It:
223@itemize @bullet
224@item
225must not appear in combination with any of the following options:
226ipv6.
227@end itemize
228
229Force DNS resolution of following host names on the command line
230to the IPv4 namespace.
231@node ntpd ipv6
232@subsection ipv6 option (-6)
233@cindex ntpd-ipv6
234
235This is the ``force ipv6 dns name resolution'' option.
236
237@noindent
238This option has some usage constraints.  It:
239@itemize @bullet
240@item
241must not appear in combination with any of the following options:
242ipv4.
243@end itemize
244
245Force DNS resolution of following host names on the command line
246to the IPv6 namespace.
247@node ntpd authreq
248@subsection authreq option (-a)
249@cindex ntpd-authreq
250
251This is the ``require crypto authentication'' option.
252
253@noindent
254This option has some usage constraints.  It:
255@itemize @bullet
256@item
257must not appear in combination with any of the following options:
258authnoreq.
259@end itemize
260
261Require cryptographic authentication for broadcast client,
262multicast client and symmetric passive associations.
263This is the default.
264@node ntpd authnoreq
265@subsection authnoreq option (-A)
266@cindex ntpd-authnoreq
267
268This is the ``do not require crypto authentication'' option.
269
270@noindent
271This option has some usage constraints.  It:
272@itemize @bullet
273@item
274must not appear in combination with any of the following options:
275authreq.
276@end itemize
277
278Do not require cryptographic authentication for broadcast client,
279multicast client and symmetric passive associations.
280This is almost never a good idea.
281@node ntpd configfile
282@subsection configfile option (-c)
283@cindex ntpd-configfile
284
285This is the ``configuration file name'' option.
286This option takes a string argument.
287The name and path of the configuration file,
288@file{/etc/ntp.conf}
289by default.
290@node ntpd driftfile
291@subsection driftfile option (-f)
292@cindex ntpd-driftfile
293
294This is the ``frequency drift file name'' option.
295This option takes a string argument.
296The name and path of the frequency file,
297@file{/etc/ntp.drift}
298by default.
299This is the same operation as the
300@code{driftfile} @kbd{driftfile}
301configuration specification in the
302@file{/etc/ntp.conf}
303file.
304@node ntpd panicgate
305@subsection panicgate option (-g)
306@cindex ntpd-panicgate
307
308This is the ``allow the first adjustment to be big'' option.
309
310@noindent
311This option has some usage constraints.  It:
312@itemize @bullet
313@item
314may appear an unlimited number of times.
315@end itemize
316
317Normally,
318@code{ntpd}
319exits 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,
320@code{ntpd}
321will exit with a message to the system log. This option can be used with the
322@code{-q}
323and
324@code{-x}
325options.
326See the
327@code{tinker}
328configuration file directive for other options.
329@node ntpd jaildir
330@subsection jaildir option (-i)
331@cindex ntpd-jaildir
332
333This is the ``jail directory'' option.
334This option takes a string argument.
335
336@noindent
337This option has some usage constraints.  It:
338@itemize @bullet
339@item
340must be compiled in by defining @code{HAVE_DROPROOT} during the compilation.
341@end itemize
342
343Chroot the server to the directory
344@kbd{jaildir}
345.
346This option also implies that the server attempts to drop root privileges at startup.
347You may need to also specify a
348@code{-u}
349option.
350This option is only available if the OS supports adjusting the clock
351without full root privileges.
352This option is supported under NetBSD (configure with
353@code{--enable-clockctl}) or Linux (configure with
354@code{--enable-linuxcaps}) or Solaris (configure with @code{--enable-solarisprivs}).
355@node ntpd interface
356@subsection interface option (-I)
357@cindex ntpd-interface
358
359This is the ``listen on an interface name or address'' option.
360This option takes a string argument @file{iface}.
361
362@noindent
363This option has some usage constraints.  It:
364@itemize @bullet
365@item
366may appear an unlimited number of times.
367@end itemize
368
369Open the network address given, or all the addresses associated with the
370given interface name.  This option may appear multiple times.  This option
371also implies not opening other addresses, except wildcard and localhost.
372This option is deprecated. Please consider using the configuration file
373@code{interface} command, which is more versatile.
374@node ntpd keyfile
375@subsection keyfile option (-k)
376@cindex ntpd-keyfile
377
378This is the ``path to symmetric keys'' option.
379This option takes a string argument.
380Specify the name and path of the symmetric key file.
381@file{/etc/ntp.keys}
382is the default.
383This is the same operation as the
384@code{keys} @kbd{keyfile}
385configuration file directive.
386@node ntpd logfile
387@subsection logfile option (-l)
388@cindex ntpd-logfile
389
390This is the ``path to the log file'' option.
391This option takes a string argument.
392Specify the name and path of the log file.
393The default is the system log file.
394This is the same operation as the
395@code{logfile} @kbd{logfile}
396configuration file directive.
397@node ntpd novirtualips
398@subsection novirtualips option (-L)
399@cindex ntpd-novirtualips
400
401This is the ``do not listen to virtual interfaces'' option.
402Do not listen to virtual interfaces, defined as those with
403names containing a colon.  This option is deprecated.  Please
404consider using the configuration file @code{interface} command, which
405is more versatile.
406@node ntpd modifymmtimer
407@subsection modifymmtimer option (-M)
408@cindex ntpd-modifymmtimer
409
410This is the ``modify multimedia timer (windows only)'' option.
411
412@noindent
413This option has some usage constraints.  It:
414@itemize @bullet
415@item
416must be compiled in by defining @code{SYS_WINNT} during the compilation.
417@end itemize
418
419Set the Windows Multimedia Timer to highest resolution.  This
420ensures the resolution does not change while ntpd is running,
421avoiding timekeeping glitches associated with changes.
422@node ntpd nice
423@subsection nice option (-N)
424@cindex ntpd-nice
425
426This is the ``run at high priority'' option.
427To the extent permitted by the operating system, run
428@code{ntpd}
429at the highest priority.
430@node ntpd pidfile
431@subsection pidfile option (-p)
432@cindex ntpd-pidfile
433
434This is the ``path to the pid file'' option.
435This option takes a string argument.
436Specify the name and path of the file used to record
437@code{ntpd}'s
438process ID.
439This is the same operation as the
440@code{pidfile} @kbd{pidfile}
441configuration file directive.
442@node ntpd priority
443@subsection priority option (-P)
444@cindex ntpd-priority
445
446This is the ``process priority'' option.
447This option takes a number argument.
448To the extent permitted by the operating system, run
449@code{ntpd}
450at the specified
451@code{sched_setscheduler(SCHED_FIFO)}
452priority.
453@node ntpd quit
454@subsection quit option (-q)
455@cindex ntpd-quit
456
457This is the ``set the time and quit'' option.
458
459@noindent
460This option has some usage constraints.  It:
461@itemize @bullet
462@item
463must not appear in combination with any of the following options:
464saveconfigquit, wait-sync.
465@end itemize
466
467@code{ntpd}
468will not daemonize and will exit after the clock is first
469synchronized.  This behavior mimics that of the
470@code{ntpdate}
471program, which will soon be replaced with a shell script.
472The
473@code{-g}
474and
475@code{-x}
476options can be used with this option.
477Note: The kernel time discipline is disabled with this option.
478@node ntpd propagationdelay
479@subsection propagationdelay option (-r)
480@cindex ntpd-propagationdelay
481
482This is the ``broadcast/propagation delay'' option.
483This option takes a string argument.
484Specify 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.
485@node ntpd saveconfigquit
486@subsection saveconfigquit option
487@cindex ntpd-saveconfigquit
488
489This is the ``save parsed configuration and quit'' option.
490This option takes a string argument.
491
492@noindent
493This option has some usage constraints.  It:
494@itemize @bullet
495@item
496must be compiled in by defining @code{SAVECONFIG} during the compilation.
497@item
498must not appear in combination with any of the following options:
499quit, wait-sync.
500@end itemize
501
502Cause @code{ntpd} to parse its startup configuration file and save an
503equivalent to the given filename and exit.  This option was
504designed for automated testing.
505@node ntpd statsdir
506@subsection statsdir option (-s)
507@cindex ntpd-statsdir
508
509This is the ``statistics file location'' option.
510This option takes a string argument.
511Specify the directory path for files created by the statistics facility.
512This is the same operation as the
513@code{statsdir} @kbd{statsdir}
514configuration file directive.
515@node ntpd trustedkey
516@subsection trustedkey option (-t)
517@cindex ntpd-trustedkey
518
519This is the ``trusted key number'' option.
520This option takes a string argument @file{tkey}.
521
522@noindent
523This option has some usage constraints.  It:
524@itemize @bullet
525@item
526may appear an unlimited number of times.
527@end itemize
528
529Add the specified key number to the trusted key list.
530@node ntpd user
531@subsection user option (-u)
532@cindex ntpd-user
533
534This is the ``run as userid (or userid:groupid)'' option.
535This option takes a string argument.
536
537@noindent
538This option has some usage constraints.  It:
539@itemize @bullet
540@item
541must be compiled in by defining @code{HAVE_DROPROOT} during the compilation.
542@end itemize
543
544Specify a user, and optionally a group, to switch to.
545This option is only available if the OS supports adjusting the clock
546without full root privileges.
547This option is supported under NetBSD (configure with
548@code{--enable-clockctl}) or Linux (configure with
549@code{--enable-linuxcaps}) or Solaris (configure with @code{--enable-solarisprivs}).
550@node ntpd updateinterval
551@subsection updateinterval option (-U)
552@cindex ntpd-updateinterval
553
554This is the ``interval in seconds between scans for new or dropped interfaces'' option.
555This option takes a number argument.
556Give the time in seconds between two scans for new or dropped interfaces.
557For systems with routing socket support the scans will be performed shortly after the interface change
558has been detected by the system.
559Use 0 to disable scanning. 60 seconds is the minimum time between scans.
560@node ntpd wait-sync
561@subsection wait-sync option (-w)
562@cindex ntpd-wait-sync
563
564This is the ``seconds to wait for first clock sync'' option.
565This option takes a number argument.
566
567@noindent
568This option has some usage constraints.  It:
569@itemize @bullet
570@item
571must be compiled in by defining @code{HAVE_WORKING_FORK} during the compilation.
572@item
573must not appear in combination with any of the following options:
574nofork, quit, saveconfigquit.
575@end itemize
576
577If greater than zero, alters @code{ntpd}'s behavior when forking to
578daemonize.  Instead of exiting with status 0 immediately after
579the fork, the parent waits up to the specified number of
580seconds for the child to first synchronize the clock.  The exit
581status is zero (success) if the clock was synchronized,
582otherwise it is @code{ETIMEDOUT}.
583This provides the option for a script starting @code{ntpd} to easily
584wait for the first set of the clock before proceeding.
585@node ntpd slew
586@subsection slew option (-x)
587@cindex ntpd-slew
588
589This is the ``slew up to 600 seconds'' option.
590Normally, 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.
591This option sets the threshold to 600 s, which is well within the accuracy window to set the clock manually.
592Note: 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.
593Thus, an adjustment as much as 600 s will take almost 14 days to complete.
594This option can be used with the
595@code{-g}
596and
597@code{-q}
598options.
599See the
600@code{tinker}
601configuration file directive for other options.
602Note: The kernel time discipline is disabled with this option.
603@node ntpd usepcc
604@subsection usepcc option
605@cindex ntpd-usepcc
606
607This is the ``use cpu cycle counter (windows only)'' option.
608
609@noindent
610This option has some usage constraints.  It:
611@itemize @bullet
612@item
613must be compiled in by defining @code{SYS_WINNT} during the compilation.
614@end itemize
615
616Attempt to substitute the CPU counter for @code{QueryPerformanceCounter}.
617The CPU counter and @code{QueryPerformanceCounter} are compared, and if
618they have the same frequency, the CPU counter (RDTSC on x86) is
619used directly, saving the overhead of a system call.
620@node ntpd pccfreq
621@subsection pccfreq option
622@cindex ntpd-pccfreq
623
624This is the ``force cpu cycle counter use (windows only)'' option.
625This option takes a string argument.
626
627@noindent
628This option has some usage constraints.  It:
629@itemize @bullet
630@item
631must be compiled in by defining @code{SYS_WINNT} during the compilation.
632@end itemize
633
634Force substitution the CPU counter for @code{QueryPerformanceCounter}.
635The CPU counter (RDTSC on x86) is used unconditionally with the
636given frequency (in Hz).
637@node ntpd mdns
638@subsection mdns option (-m)
639@cindex ntpd-mdns
640
641This is the ``register with mdns as a ntp server'' option.
642
643@noindent
644This option has some usage constraints.  It:
645@itemize @bullet
646@item
647must be compiled in by defining @code{HAVE_DNSREGISTRATION} during the compilation.
648@end itemize
649
650Registers as an NTP server with the local mDNS server which allows
651the server to be discovered via mDNS client lookup.
652
653
654@node ntpd config
655@subsection presetting/configuring ntpd
656
657Any option that is not marked as @i{not presettable} may be preset by
658loading values from environment variables named @code{NTPD} and @code{NTPD_<OPTION_NAME>}.  @code{<OPTION_NAME>} must be one of
659the options listed above in upper case and segmented with underscores.
660The @code{NTPD} variable will be tokenized and parsed like
661the command line.  The remaining variables are tested for existence and their
662values are treated like option arguments.
663
664
665The command line options relating to configuration and/or usage help are:
666
667@subsubheading version (-)
668
669Print the program version to standard out, optionally with licensing
670information, then exit 0.  The optional argument specifies how much licensing
671detail to provide.  The default is to print just the version.  The licensing infomation may be selected with an option argument.
672Only the first letter of the argument is examined:
673
674@table @samp
675@item version
676Only print the version.  This is the default.
677@item copyright
678Name the copyright usage licensing terms.
679@item verbose
680Print the full copyright usage licensing terms.
681@end table
682
683@node ntpd exit status
684@subsection ntpd exit status
685
686One of the following exit values will be returned:
687@table @samp
688@item 0 (EXIT_SUCCESS)
689Successful program execution.
690@item 1 (EXIT_FAILURE)
691The operation failed or the command syntax was not valid.
692@end table
693@node ntpd Usage
694@subsection ntpd Usage
695@node ntpd Files
696@subsection ntpd Files
697@node ntpd See Also
698@subsection ntpd See Also
699@node ntpd Bugs
700@subsection ntpd Bugs
701@node ntpd Notes
702@subsection ntpd Notes
703