1330567Sgordon.Dd February 27 2018
2285612Sdelphij.Dt NTPD 8 User Commands
3285612Sdelphij.Os
4285612Sdelphij.\"  EDIT THIS FILE WITH CAUTION  (ntpd-opts.mdoc)
555857Ssheldonh.\"
655857Ssheldonh.\" $FreeBSD: releng/10.3/usr.sbin/ntp/doc/ntpd.8 330567 2018-03-07 05:58:24Z gordon $
755857Ssheldonh.\"
8330567Sgordon.\"  It has been AutoGen-ed  February 27, 2018 at 05:14:47 PM by AutoGen 5.18.5
9285612Sdelphij.\"  From the definitions    ntpd-opts.def
10285612Sdelphij.\"  and the template file   agmdoc-cmd.tpl
1155857Ssheldonh.Sh NAME
1255857Ssheldonh.Nm ntpd
13285612Sdelphij.Nd NTP daemon program
1455857Ssheldonh.Sh SYNOPSIS
1568965Sru.Nm
16285612Sdelphij.\" Mixture of short (flag) options and long options
17285612Sdelphij.Op Fl flags
18285612Sdelphij.Op Fl flag Op Ar value
19285612Sdelphij.Op Fl \-option\-name Ns Oo Oo Ns "=| " Oc Ns Ar value Oc
20285612Sdelphij[ <server1> ... <serverN> ]
21285612Sdelphij.Pp
2255857Ssheldonh.Sh DESCRIPTION
2382501SsheldonhThe
2455857Ssheldonh.Nm
2599968Scharnierutility is an operating system daemon which sets
2682501Ssheldonhand maintains the system time of day in synchronism with Internet
2782501Ssheldonhstandard time servers.
2882501SsheldonhIt is a complete implementation of the
29285612SdelphijNetwork Time Protocol (NTP) version 4, as defined by RFC\-5905,
30285612Sdelphijbut also retains compatibility with
31285612Sdelphijversion 3, as defined by RFC\-1305, and versions 1
32285612Sdelphijand 2, as defined by RFC\-1059 and RFC\-1119, respectively.
3382501Ssheldonh.Pp
3499968ScharnierThe
3555857Ssheldonh.Nm
36285612Sdelphijutility does most computations in 64\-bit floating point
37285612Sdelphijarithmetic and does relatively clumsy 64\-bit fixed point operations
3882501Ssheldonhonly when necessary to preserve the ultimate precision, about 232
3982501Ssheldonhpicoseconds.
40168248SchinsanWhile the ultimate precision is not achievable with
4182501Ssheldonhordinary workstations and networks of today, it may be required
4282501Ssheldonhwith future gigahertz CPU clocks and gigabit LANs.
4355857Ssheldonh.Pp
4455857SsheldonhOrdinarily,
4555857Ssheldonh.Nm
4655857Ssheldonhreads the
4755895Ssheldonh.Xr ntp.conf 5
4882501Ssheldonhconfiguration file at startup time in order to determine the
4982501Ssheldonhsynchronization sources and operating modes.
5082501SsheldonhIt is also possible to
5182501Ssheldonhspecify a working, although limited, configuration entirely on the
5282501Ssheldonhcommand line, obviating the need for a configuration file.
5382501SsheldonhThis may
5482501Ssheldonhbe particularly useful when the local host is to be configured as a
5582501Ssheldonhbroadcast/multicast client, with all peers being determined by
5682501Ssheldonhlistening to broadcasts at run time.
5755857Ssheldonh.Pp
5855857SsheldonhIf NetInfo support is built into
5968965Sru.Nm ,
6055857Ssheldonhthen
6155857Ssheldonh.Nm
6282501Ssheldonhwill attempt to read its configuration from the
6382501SsheldonhNetInfo if the default
6482501Ssheldonh.Xr ntp.conf 5
6582501Ssheldonhfile cannot be read and no file is
6682501Ssheldonhspecified by the
6755857Ssheldonh.Fl c
6855857Ssheldonhoption.
6955857Ssheldonh.Pp
7082501SsheldonhVarious internal
7155857Ssheldonh.Nm
7282501Ssheldonhvariables can be displayed and
7382501Ssheldonhconfiguration options altered while the
7482501Ssheldonh.Nm
7582501Ssheldonhis running
7682501Ssheldonhusing the
7755857Ssheldonh.Xr ntpq 8
7855857Ssheldonhand
7955857Ssheldonh.Xr ntpdc 8
8082501Ssheldonhutility programs.
8155857Ssheldonh.Pp
8255857SsheldonhWhen
8355857Ssheldonh.Nm
8455857Ssheldonhstarts it looks at the value of
85285612Sdelphij.Xr umask 2 ,
8682501Ssheldonhand if zero
8782501Ssheldonh.Nm
8882501Ssheldonhwill set the
89285612Sdelphij.Xr umask 2
9082501Ssheldonhto 022.
91285612Sdelphij.Sh "OPTIONS"
92285612Sdelphij.Bl -tag
93285612Sdelphij.It  Fl 4 , Fl \-ipv4 
94285612SdelphijForce IPv4 DNS name resolution.
95285612SdelphijThis option must not appear in combination with any of the following options:
96285612Sdelphijipv6.
97285612Sdelphij.sp
98285612SdelphijForce DNS resolution of following host names on the command line
99285612Sdelphijto the IPv4 namespace.
100285612Sdelphij.It  Fl 6 , Fl \-ipv6 
101285612SdelphijForce IPv6 DNS name resolution.
102285612SdelphijThis option must not appear in combination with any of the following options:
103285612Sdelphijipv4.
104285612Sdelphij.sp
105285612SdelphijForce DNS resolution of following host names on the command line
106285612Sdelphijto the IPv6 namespace.
107285612Sdelphij.It  Fl a , Fl \-authreq 
108285612SdelphijRequire crypto authentication.
109285612SdelphijThis option must not appear in combination with any of the following options:
110285612Sdelphijauthnoreq.
111285612Sdelphij.sp
112158688SpavRequire cryptographic authentication for broadcast client,
113158688Spavmulticast client and symmetric passive associations.
114158688SpavThis is the default.
115285612Sdelphij.It  Fl A , Fl \-authnoreq 
116285612SdelphijDo not require crypto authentication.
117285612SdelphijThis option must not appear in combination with any of the following options:
118285612Sdelphijauthreq.
119285612Sdelphij.sp
120158688SpavDo not require cryptographic authentication for broadcast client,
121158688Spavmulticast client and symmetric passive associations.
122158688SpavThis is almost never a good idea.
123285612Sdelphij.It  Fl b , Fl \-bcastsync 
124285612SdelphijAllow us to sync to broadcast servers.
125285612Sdelphij.sp
126285612Sdelphij.It  Fl c Ar string , Fl \-configfile Ns = Ns Ar string 
127285612Sdelphijconfiguration file name.
128285612Sdelphij.sp
129285612SdelphijThe name and path of the configuration file,
130285612Sdelphij\fI/etc/ntp.conf\fP
131285612Sdelphijby default.
132285612Sdelphij.It  Fl d , Fl \-debug\-level 
133285612SdelphijIncrease debug verbosity level.
134285612SdelphijThis option may appear an unlimited number of times.
135285612Sdelphij.sp
136285612Sdelphij.It  Fl D Ar number , Fl \-set\-debug\-level Ns = Ns Ar number 
137285612SdelphijSet the debug verbosity level.
138285612SdelphijThis option may appear an unlimited number of times.
139285612SdelphijThis option takes an integer number as its argument.
140285612Sdelphij.sp
141285612Sdelphij.It  Fl f Ar string , Fl \-driftfile Ns = Ns Ar string 
142285612Sdelphijfrequency drift file name.
143285612Sdelphij.sp
144285612SdelphijThe name and path of the frequency file,
145285612Sdelphij\fI/etc/ntp.drift\fP
146285612Sdelphijby default.
147158688SpavThis is the same operation as the
148285612Sdelphij\fBdriftfile\fP \fIdriftfile\fP
149289997Sglebiusconfiguration specification in the
150285612Sdelphij\fI/etc/ntp.conf\fP
151285612Sdelphijfile.
152285612Sdelphij.It  Fl g , Fl \-panicgate 
153285612SdelphijAllow the first adjustment to be Big.
154285612SdelphijThis option may appear an unlimited number of times.
155285612Sdelphij.sp
15682501SsheldonhNormally,
157285612Sdelphij\fBntpd\fP
158285612Sdelphijexits 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,
159285612Sdelphij\fBntpd\fP
160285612Sdelphijwill exit with a message to the system log. This option can be used with the
161285612Sdelphij\fB\-q\fP
162158688Spavand
163285612Sdelphij\fB\-x\fP
164162806Sruoptions.
165162806SruSee the
166285612Sdelphij\fBtinker\fP
167285612Sdelphijconfiguration file directive for other options.
168289997Sglebius.It  Fl G , Fl \-force\-step\-once 
169289997SglebiusStep any initial offset correction..
170289997Sglebius.sp
171289997SglebiusNormally,
172289997Sglebius\fBntpd\fP
173289997Sglebiussteps the time if the time offset exceeds the step threshold,
174289997Sglebiuswhich is 128 ms by default, and otherwise slews the time.
175289997SglebiusThis option forces the initial offset correction to be stepped,
176289997Sglebiusso the highest time accuracy can be achieved quickly.
177289997SglebiusHowever, this may also cause the time to be stepped back
178289997Sglebiusso this option must not be used if
179289997Sglebiusapplications requiring monotonic time are running.
180289997SglebiusSee the \fBtinker\fP configuration file directive for other options.
181285612Sdelphij.It  Fl i Ar string , Fl \-jaildir Ns = Ns Ar string 
182285612SdelphijJail directory.
183285612Sdelphij.sp
184285612SdelphijChroot the server to the directory
185285612Sdelphij\fIjaildir\fP
186285612Sdelphij.
187285612SdelphijThis option also implies that the server attempts to drop root privileges at startup.
188285612SdelphijYou may need to also specify a
189285612Sdelphij\fB\-u\fP
190285612Sdelphijoption.
191285612SdelphijThis option is only available if the OS supports adjusting the clock
192285612Sdelphijwithout full root privileges.
193285612SdelphijThis option is supported under NetBSD (configure with
194285612Sdelphij\fB\-\-enable\-clockctl\fP) or Linux (configure with
195285612Sdelphij\fB\-\-enable\-linuxcaps\fP) or Solaris (configure with \fB\-\-enable\-solarisprivs\fP).
196285612Sdelphij.It  Fl I Ar iface , Fl \-interface Ns = Ns Ar iface 
197285612SdelphijListen on an interface name or address.
198285612SdelphijThis option may appear an unlimited number of times.
199285612Sdelphij.sp
200285612SdelphijOpen the network address given, or all the addresses associated with the
201285612Sdelphijgiven interface name.  This option may appear multiple times.  This option
202285612Sdelphijalso implies not opening other addresses, except wildcard and localhost.
203285612SdelphijThis option is deprecated. Please consider using the configuration file
204289997Sglebius\fBinterface\fP command, which is more versatile.
205285612Sdelphij.It  Fl k Ar string , Fl \-keyfile Ns = Ns Ar string 
206285612Sdelphijpath to symmetric keys.
207285612Sdelphij.sp
208285612SdelphijSpecify the name and path of the symmetric key file.
209285612Sdelphij\fI/etc/ntp.keys\fP
210285612Sdelphijis the default.
211158688SpavThis is the same operation as the
212285612Sdelphij\fBkeys\fP \fIkeyfile\fP
213285612Sdelphijconfiguration file directive.
214285612Sdelphij.It  Fl l Ar string , Fl \-logfile Ns = Ns Ar string 
215285612Sdelphijpath to the log file.
216285612Sdelphij.sp
21755857SsheldonhSpecify the name and path of the log file.
218158688SpavThe default is the system log file.
219158688SpavThis is the same operation as the
220285612Sdelphij\fBlogfile\fP \fIlogfile\fP
221285612Sdelphijconfiguration file directive.
222285612Sdelphij.It  Fl L , Fl \-novirtualips 
223285612SdelphijDo not listen to virtual interfaces.
224285612Sdelphij.sp
225285612SdelphijDo not listen to virtual interfaces, defined as those with
226285612Sdelphijnames containing a colon.  This option is deprecated.  Please
227285612Sdelphijconsider using the configuration file \fBinterface\fP command, which
228285612Sdelphijis more versatile.
229285612Sdelphij.It  Fl M , Fl \-modifymmtimer 
230285612SdelphijModify Multimedia Timer (Windows only).
231285612Sdelphij.sp
232285612SdelphijSet the Windows Multimedia Timer to highest resolution.  This
233285612Sdelphijensures the resolution does not change while ntpd is running,
234285612Sdelphijavoiding timekeeping glitches associated with changes.
235285612Sdelphij.It  Fl n , Fl \-nofork 
236141846SruDo not fork.
237285612SdelphijThis option must not appear in combination with any of the following options:
238285612Sdelphijwait\-sync.
239285612Sdelphij.sp
240285612Sdelphij.It  Fl N , Fl \-nice 
241285612SdelphijRun at high priority.
242285612Sdelphij.sp
243285612SdelphijTo the extent permitted by the operating system, run
244285612Sdelphij\fBntpd\fP
245158688Spavat the highest priority.
246285612Sdelphij.It  Fl p Ar string , Fl \-pidfile Ns = Ns Ar string 
247285612Sdelphijpath to the PID file.
248285612Sdelphij.sp
249285612SdelphijSpecify the name and path of the file used to record
250285612Sdelphij\fBntpd\fP's
251158688Spavprocess ID.
252158688SpavThis is the same operation as the
253285612Sdelphij\fBpidfile\fP \fIpidfile\fP
254285612Sdelphijconfiguration file directive.
255285612Sdelphij.It  Fl P Ar number , Fl \-priority Ns = Ns Ar number 
256285612SdelphijProcess priority.
257285612SdelphijThis option takes an integer number as its argument.
258285612Sdelphij.sp
259285612SdelphijTo the extent permitted by the operating system, run
260285612Sdelphij\fBntpd\fP
261285612Sdelphijat the specified
262285612Sdelphij\fBsched_setscheduler(SCHED_FIFO)\fP
263285612Sdelphijpriority.
264285612Sdelphij.It  Fl q , Fl \-quit 
265285612SdelphijSet the time and quit.
266285612SdelphijThis option must not appear in combination with any of the following options:
267285612Sdelphijsaveconfigquit, wait\-sync.
268285612Sdelphij.sp
269285612Sdelphij\fBntpd\fP
270285612Sdelphijwill not daemonize and will exit after the clock is first
271285612Sdelphijsynchronized.  This behavior mimics that of the
272285612Sdelphij\fBntpdate\fP
273285612Sdelphijprogram, which will soon be replaced with a shell script.
27482501SsheldonhThe
275285612Sdelphij\fB\-g\fP
27682501Ssheldonhand
277285612Sdelphij\fB\-x\fP
278285612Sdelphijoptions can be used with this option.
279158688SpavNote: The kernel time discipline is disabled with this option.
280285612Sdelphij.It  Fl r Ar string , Fl \-propagationdelay Ns = Ns Ar string 
281285612SdelphijBroadcast/propagation delay.
282285612Sdelphij.sp
283285612SdelphijSpecify 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.
284285612Sdelphij.It  Fl \-saveconfigquit  Ns = Ns Ar string 
285285612SdelphijSave parsed configuration and quit.
286285612SdelphijThis option must not appear in combination with any of the following options:
287285612Sdelphijquit, wait\-sync.
288285612Sdelphij.sp
289285612SdelphijCause \fBntpd\fP to parse its startup configuration file and save an
290285612Sdelphijequivalent to the given filename and exit.  This option was
291285612Sdelphijdesigned for automated testing.
292285612Sdelphij.It  Fl s Ar string , Fl \-statsdir Ns = Ns Ar string 
293285612SdelphijStatistics file location.
294285612Sdelphij.sp
295285612SdelphijSpecify the directory path for files created by the statistics facility.
296158688SpavThis is the same operation as the
297285612Sdelphij\fBstatsdir\fP \fIstatsdir\fP
298285612Sdelphijconfiguration file directive.
299285612Sdelphij.It  Fl t Ar tkey , Fl \-trustedkey Ns = Ns Ar tkey 
300285612SdelphijTrusted key number.
301285612SdelphijThis option may appear an unlimited number of times.
302285612Sdelphij.sp
303285612SdelphijAdd the specified key number to the trusted key list.
304285612Sdelphij.It  Fl u Ar string , Fl \-user Ns = Ns Ar string 
305285612SdelphijRun as userid (or userid:groupid).
306285612Sdelphij.sp
307285612SdelphijSpecify a user, and optionally a group, to switch to.
308285612SdelphijThis option is only available if the OS supports adjusting the clock
309285612Sdelphijwithout full root privileges.
310285612SdelphijThis option is supported under NetBSD (configure with
311285612Sdelphij\fB\-\-enable\-clockctl\fP) or Linux (configure with
312285612Sdelphij\fB\-\-enable\-linuxcaps\fP) or Solaris (configure with \fB\-\-enable\-solarisprivs\fP).
313285612Sdelphij.It  Fl U Ar number , Fl \-updateinterval Ns = Ns Ar number 
314285612Sdelphijinterval in seconds between scans for new or dropped interfaces.
315285612SdelphijThis option takes an integer number as its argument.
316285612Sdelphij.sp
317285612SdelphijGive the time in seconds between two scans for new or dropped interfaces.
318285612SdelphijFor systems with routing socket support the scans will be performed shortly after the interface change
319285612Sdelphijhas been detected by the system.
320285612SdelphijUse 0 to disable scanning. 60 seconds is the minimum time between scans.
321285612Sdelphij.It  Fl \-var  Ns = Ns Ar nvar 
322285612Sdelphijmake ARG an ntp variable (RW).
323285612SdelphijThis option may appear an unlimited number of times.
324285612Sdelphij.sp
325285612Sdelphij.It  Fl \-dvar  Ns = Ns Ar ndvar 
326285612Sdelphijmake ARG an ntp variable (RW|DEF).
327285612SdelphijThis option may appear an unlimited number of times.
328285612Sdelphij.sp
329285612Sdelphij.It  Fl w Ar number , Fl \-wait\-sync Ns = Ns Ar number 
330285612SdelphijSeconds to wait for first clock sync.
331285612SdelphijThis option must not appear in combination with any of the following options:
332285612Sdelphijnofork, quit, saveconfigquit.
333285612SdelphijThis option takes an integer number as its argument.
334285612Sdelphij.sp
335285612SdelphijIf greater than zero, alters \fBntpd\fP's behavior when forking to
336285612Sdelphijdaemonize.  Instead of exiting with status 0 immediately after
337285612Sdelphijthe fork, the parent waits up to the specified number of
338285612Sdelphijseconds for the child to first synchronize the clock.  The exit
339285612Sdelphijstatus is zero (success) if the clock was synchronized,
340285612Sdelphijotherwise it is \fBETIMEDOUT\fP.
341285612SdelphijThis provides the option for a script starting \fBntpd\fP to easily
342285612Sdelphijwait for the first set of the clock before proceeding.
343285612Sdelphij.It  Fl x , Fl \-slew 
344285612SdelphijSlew up to 600 seconds.
345285612Sdelphij.sp
346285612SdelphijNormally, 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.
347285612SdelphijThis option sets the threshold to 600 s, which is well within the accuracy window to set the clock manually.
348285612SdelphijNote: 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.
349158688SpavThus, an adjustment as much as 600 s will take almost 14 days to complete.
35082501SsheldonhThis option can be used with the
351285612Sdelphij\fB\-g\fP
352158688Spavand
353285612Sdelphij\fB\-q\fP
354158688Spavoptions.
355158688SpavSee the
356285612Sdelphij\fBtinker\fP
357285612Sdelphijconfiguration file directive for other options.
358158688SpavNote: The kernel time discipline is disabled with this option.
359285612Sdelphij.It  Fl \-usepcc 
360285612SdelphijUse CPU cycle counter (Windows only).
361285612Sdelphij.sp
362285612SdelphijAttempt to substitute the CPU counter for \fBQueryPerformanceCounter\fP.
363285612SdelphijThe CPU counter and \fBQueryPerformanceCounter\fP are compared, and if
364285612Sdelphijthey have the same frequency, the CPU counter (RDTSC on x86) is
365285612Sdelphijused directly, saving the overhead of a system call.
366285612Sdelphij.It  Fl \-pccfreq  Ns = Ns Ar string 
367285612SdelphijForce CPU cycle counter use (Windows only).
368285612Sdelphij.sp
369285612SdelphijForce substitution the CPU counter for \fBQueryPerformanceCounter\fP.
370285612SdelphijThe CPU counter (RDTSC on x86) is used unconditionally with the
371285612Sdelphijgiven frequency (in Hz).
372285612Sdelphij.It  Fl m , Fl \-mdns 
373285612SdelphijRegister with mDNS as a NTP server.
374285612Sdelphij.sp
375285612SdelphijRegisters as an NTP server with the local mDNS server which allows
376285612Sdelphijthe server to be discovered via mDNS client lookup.
377285612Sdelphij.It Fl \&? , Fl \-help
378285612SdelphijDisplay usage information and exit.
379285612Sdelphij.It Fl \&! , Fl \-more\-help
380285612SdelphijPass the extended usage information through a pager.
381285612Sdelphij.It Fl \-version Op Brq Ar v|c|n
382285612SdelphijOutput version of program and exit.  The default mode is `v', a simple
383285612Sdelphijversion.  The `c' mode will print copyright information and `n' will
384285612Sdelphijprint the full copyright notice.
38555857Ssheldonh.El
386285612Sdelphij.Sh "OPTION PRESETS"
387285612SdelphijAny option that is not marked as \fInot presettable\fP may be preset
388285612Sdelphijby loading values from environment variables named:
389285612Sdelphij.nf
390285612Sdelphij  \fBNTPD_<option\-name>\fP or \fBNTPD\fP
391285612Sdelphij.fi
392285612Sdelphij.ad
393285612Sdelphij.Sh USAGE
39482501Ssheldonh.Ss "How NTP Operates"
39582501SsheldonhThe
39682501Ssheldonh.Nm
39799968Scharnierutility operates by exchanging messages with
398285612Sdelphijone or more configured servers over a range of designated poll intervals.
39982501SsheldonhWhen
40082501Ssheldonhstarted, whether for the first or subsequent times, the program
40197735Sschweikhrequires several exchanges from the majority of these servers so
40282501Ssheldonhthe signal processing and mitigation algorithms can accumulate and
40382501Ssheldonhgroom the data and set the clock.
40482501SsheldonhIn order to protect the network
40582501Ssheldonhfrom bursts, the initial poll interval for each server is delayed
406158688Spavan interval randomized over a few seconds.
40782501SsheldonhAt the default initial poll
40882501Ssheldonhinterval of 64s, several minutes can elapse before the clock is
40982501Ssheldonhset.
410285612SdelphijThis initial delay to set the clock
411285612Sdelphijcan be safely and dramatically reduced using the
41282501Ssheldonh.Cm iburst
41382501Ssheldonhkeyword with the
41482501Ssheldonh.Ic server
41582501Ssheldonhconfiguration
41682501Ssheldonhcommand, as described in
41782501Ssheldonh.Xr ntp.conf 5 .
41855895Ssheldonh.Pp
41982501SsheldonhMost operating systems and hardware of today incorporate a
420285612Sdelphijtime\-of\-year (TOY) chip to maintain the time during periods when
42182501Ssheldonhthe power is off.
42282501SsheldonhWhen the machine is booted, the chip is used to
42382501Ssheldonhinitialize the operating system time.
42482501SsheldonhAfter the machine has
42582501Ssheldonhsynchronized to a NTP server, the operating system corrects the
42682501Ssheldonhchip from time to time.
427285612SdelphijIn the default case, if
42882501Ssheldonh.Nm
429285612Sdelphijdetects that the time on the host
430285612Sdelphijis more than 1000s from the server time,
431285612Sdelphij.Nm
43282501Ssheldonhassumes something must be terribly wrong and the only
43382501Ssheldonhreliable action is for the operator to intervene and set the clock
43482501Ssheldonhby hand.
435285612Sdelphij(Reasons for this include there is no TOY chip,
436285612Sdelphijor its battery is dead, or that the TOY chip is just of poor quality.)
43782501SsheldonhThis causes
43882501Ssheldonh.Nm
43982501Ssheldonhto exit with a panic message to
44082501Ssheldonhthe system log.
44182501SsheldonhThe
44282501Ssheldonh.Fl g
44382501Ssheldonhoption overrides this check and the
444285612Sdelphijclock will be set to the server time regardless of the chip time
445285612Sdelphij(up to 68 years in the past or future \(em
446285612Sdelphijthis is a limitation of the NTPv4 protocol).
44782501SsheldonhHowever, and to protect against broken hardware, such as when the
44882501SsheldonhCMOS battery fails or the clock counter becomes defective, once the
449285612Sdelphijclock has been set an error greater than 1000s will cause
45082501Ssheldonh.Nm
45182501Ssheldonhto exit anyway.
45282501Ssheldonh.Pp
45397735SschweikhUnder ordinary conditions,
45482501Ssheldonh.Nm
45582501Ssheldonhadjusts the clock in
45682501Ssheldonhsmall steps so that the timescale is effectively continuous and
45782501Ssheldonhwithout discontinuities.
45882501SsheldonhUnder conditions of extreme network
45982501Ssheldonhcongestion, the roundtrip delay jitter can exceed three seconds and
460285612Sdelphijthe synchronization distance, which is equal to one\-half the
46182501Ssheldonhroundtrip delay plus error budget terms, can become very large.
46282501SsheldonhThe
46382501Ssheldonh.Nm
46482501Ssheldonhalgorithms discard sample offsets exceeding 128 ms,
46582501Ssheldonhunless the interval during which no sample offset is less than 128
46682501Ssheldonhms exceeds 900s.
46782501SsheldonhThe first sample after that, no matter what the
46882501Ssheldonhoffset, steps the clock to the indicated time.
46982501SsheldonhIn practice this
47082501Ssheldonhreduces the false alarm rate where the clock is stepped in error to
47182501Ssheldonha vanishingly low incidence.
47282501Ssheldonh.Pp
473285612SdelphijAs the result of this behavior, once the clock has been set it
474285612Sdelphijvery rarely strays more than 128 ms even under extreme cases of
47582501Ssheldonhnetwork path congestion and jitter.
47682501SsheldonhSometimes, in particular when
47782501Ssheldonh.Nm
478285612Sdelphijis first started without a valid drift file
479285612Sdelphijon a system with a large intrinsic drift
480285612Sdelphijthe error might grow to exceed 128 ms,
481285612Sdelphijwhich would cause the clock to be set backwards
482285612Sdelphijif the local clock time is more than 128 s
483285612Sdelphijin the future relative to the server.
48482501SsheldonhIn some applications, this behavior may be unacceptable.
485285612SdelphijThere are several solutions, however.
48682501SsheldonhIf the
48782501Ssheldonh.Fl x
48882501Ssheldonhoption is included on the command line, the clock will
48982501Ssheldonhnever be stepped and only slew corrections will be used.
490285612SdelphijBut this choice comes with a cost that
491285612Sdelphijshould be carefully explored before deciding to use
49282501Ssheldonhthe
49382501Ssheldonh.Fl x
49482501Ssheldonhoption.
49582501SsheldonhThe maximum slew rate possible is limited
496285612Sdelphijto 500 parts\-per\-million (PPM) as a consequence of the correctness
49782501Ssheldonhprinciples on which the NTP protocol and algorithm design are
49882501Ssheldonhbased.
49982501SsheldonhAs a result, the local clock can take a long time to
50082501Ssheldonhconverge to an acceptable offset, about 2,000 s for each second the
50182501Ssheldonhclock is outside the acceptable range.
50282501SsheldonhDuring this interval the
50382501Ssheldonhlocal clock will not be consistent with any other network clock and
50482501Ssheldonhthe system cannot be used for distributed applications that require
50582501Ssheldonhcorrectly synchronized network time.
50682501Ssheldonh.Pp
50782501SsheldonhIn spite of the above precautions, sometimes when large
50882501Ssheldonhfrequency errors are present the resulting time offsets stray
509285612Sdelphijoutside the 128\-ms range and an eventual step or slew time
51082501Ssheldonhcorrection is required.
51182501SsheldonhIf following such a correction the
51282501Ssheldonhfrequency error is so large that the first sample is outside the
51382501Ssheldonhacceptable range,
51482501Ssheldonh.Nm
51582501Ssheldonhenters the same state as when the
51682501Ssheldonh.Pa ntp.drift
51782501Ssheldonhfile is not present.
51882501SsheldonhThe intent of this behavior
51982501Ssheldonhis to quickly correct the frequency and restore operation to the
52082501Ssheldonhnormal tracking mode.
52182501SsheldonhIn the most extreme cases
522285612Sdelphij(the host
523158688Spav.Cm time.ien.it
524158688Spavcomes to mind), there may be occasional
52582501Ssheldonhstep/slew corrections and subsequent frequency corrections.
52682501SsheldonhIt
52782501Ssheldonhhelps in these cases to use the
52882501Ssheldonh.Cm burst
52982501Ssheldonhkeyword when
530285612Sdelphijconfiguring the server, but
531285612SdelphijONLY
532285612Sdelphijwhen you have permission to do so from the owner of the target host.
533285612Sdelphij.Pp
534285612SdelphijFinally,
535285612Sdelphijin the past many startup scripts would run
536285612Sdelphij.Xr ntpdate 8
537289997Sglebiusor
538289997Sglebius.Xr sntp 8
539285612Sdelphijto get the system clock close to correct before starting
540285612Sdelphij.Xr ntpd 8 ,
541285612Sdelphijbut this was never more than a mediocre hack and is no longer needed.
542285612SdelphijIf you are following the instructions in
543285612Sdelphij.Sx "Starting NTP (Best Current Practice)"
544285612Sdelphijand you still need to set the system time before starting
545285612Sdelphij.Nm ,
546285612Sdelphijplease open a bug report and document what is going on,
547285612Sdelphijand then look at using
548289997Sglebius.Xr sntp 8
549289997Sglebiusif you really need to set the clock before starting
550289997Sglebius.Nm .
551285612Sdelphij.Pp
552285612SdelphijThere is a way to start
553285612Sdelphij.Xr ntpd 8
554285612Sdelphijthat often addresses all of the problems mentioned above.
555285612Sdelphij.Ss "Starting NTP (Best Current Practice)"
556285612SdelphijFirst, use the
557285612Sdelphij.Cm iburst
558285612Sdelphijoption on your
559285612Sdelphij.Cm server
560285612Sdelphijentries.
561285612Sdelphij.Pp
562285612SdelphijIf you can also keep a good
563285612Sdelphij.Pa ntp.drift
564285612Sdelphijfile then
565285612Sdelphij.Xr ntpd 8
566285612Sdelphijwill effectively "warm\-start" and your system's clock will
567285612Sdelphijbe stable in under 11 seconds' time.
568285612Sdelphij.Pp
569285612SdelphijAs soon as possible in the startup sequence, start
570285612Sdelphij.Xr ntpd 8
571285612Sdelphijwith at least the
572285612Sdelphij.Fl g
573285612Sdelphijand perhaps the
574285612Sdelphij.Fl N
575285612Sdelphijoptions.
576285612SdelphijThen,
577285612Sdelphijstart the rest of your "normal" processes.
578285612SdelphijThis will give
579285612Sdelphij.Xr ntpd 8
580285612Sdelphijas much time as possible to get the system's clock synchronized and stable.
581285612Sdelphij.Pp
582285612SdelphijFinally,
583285612Sdelphijif you have processes like
584285612Sdelphij.Cm dovecot
585285612Sdelphijor database servers
586285612Sdelphijthat require
587285612Sdelphijmonotonically\-increasing time,
588285612Sdelphijrun
589285612Sdelphij.Xr ntp\-wait 1ntp\-waitmdoc
590285612Sdelphijas late as possible in the boot sequence
591285612Sdelphij(perhaps with the
592285612Sdelphij.Fl v
593285612Sdelphijflag)
594285612Sdelphijand after
595285612Sdelphij.Xr ntp\-wait 1ntp\-waitmdoc
596285612Sdelphijexits successfully
597285612Sdelphijit is as safe as it will ever be to start any process that require
598285612Sdelphijstable time.
59982501Ssheldonh.Ss "Frequency Discipline"
60082501SsheldonhThe
60182501Ssheldonh.Nm
60282501Ssheldonhbehavior at startup depends on whether the
60382501Ssheldonhfrequency file, usually
60482501Ssheldonh.Pa ntp.drift ,
60582501Ssheldonhexists.
60682501SsheldonhThis file
60782501Ssheldonhcontains the latest estimate of clock frequency error.
60882501SsheldonhWhen the
60982501Ssheldonh.Nm
61082501Ssheldonhis started and the file does not exist, the
61182501Ssheldonh.Nm
61282501Ssheldonhenters a special mode designed to quickly adapt to
61382501Ssheldonhthe particular system clock oscillator time and frequency error.
61482501SsheldonhThis takes approximately 15 minutes, after which the time and
61582501Ssheldonhfrequency are set to nominal values and the
61682501Ssheldonh.Nm
61782501Ssheldonhenters
61882501Ssheldonhnormal mode, where the time and frequency are continuously tracked
61982501Ssheldonhrelative to the server.
62082501SsheldonhAfter one hour the frequency file is
62182501Ssheldonhcreated and the current frequency offset written to it.
62282501SsheldonhWhen the
62382501Ssheldonh.Nm
62482501Ssheldonhis started and the file does exist, the
62582501Ssheldonh.Nm
62682501Ssheldonhfrequency is initialized from the file and enters normal mode
62782501Ssheldonhimmediately.
62882501SsheldonhAfter that the current frequency offset is written to
62982501Ssheldonhthe file at hourly intervals.
63082501Ssheldonh.Ss "Operating Modes"
63199968ScharnierThe
63282501Ssheldonh.Nm
63399968Scharnierutility can operate in any of several modes, including
63482501Ssheldonhsymmetric active/passive, client/server broadcast/multicast and
63582501Ssheldonhmanycast, as described in the
63682501Ssheldonh.Qq Association Management
63782501Ssheldonhpage
63882501Ssheldonh(available as part of the HTML documentation
63982501Ssheldonhprovided in
64082501Ssheldonh.Pa /usr/share/doc/ntp ) .
64182501SsheldonhIt normally operates continuously while
64282501Ssheldonhmonitoring for small changes in frequency and trimming the clock
64382501Ssheldonhfor the ultimate precision.
644285612SdelphijHowever, it can operate in a one\-time
64582501Ssheldonhmode where the time is set from an external server and frequency is
64682501Ssheldonhset from a previously recorded frequency file.
64782501SsheldonhA
64882501Ssheldonhbroadcast/multicast or manycast client can discover remote servers,
649285612Sdelphijcompute server\-client propagation delay correction factors and
65082501Ssheldonhconfigure itself automatically.
65182501SsheldonhThis makes it possible to deploy a
65282501Ssheldonhfleet of workstations without specifying configuration details
65382501Ssheldonhspecific to the local environment.
65482501Ssheldonh.Pp
65582501SsheldonhBy default,
65682501Ssheldonh.Nm
65782501Ssheldonhruns in continuous mode where each of
65882501Ssheldonhpossibly several external servers is polled at intervals determined
65982501Ssheldonhby an intricate state machine.
66082501SsheldonhThe state machine measures the
66182501Ssheldonhincidental roundtrip delay jitter and oscillator frequency wander
66282501Ssheldonhand determines the best poll interval using a heuristic algorithm.
66382501SsheldonhOrdinarily, and in most operating environments, the state machine
66482501Ssheldonhwill start with 64s intervals and eventually increase in steps to
66582501Ssheldonh1024s.
66682501SsheldonhA small amount of random variation is introduced in order to
66782501Ssheldonhavoid bunching at the servers.
66882501SsheldonhIn addition, should a server become
66982501Ssheldonhunreachable for some time, the poll interval is increased in steps
67082501Ssheldonhto 1024s in order to reduce network overhead.
67182501Ssheldonh.Pp
67282501SsheldonhIn some cases it may not be practical for
67382501Ssheldonh.Nm
674285612Sdelphijto run continuously.
67582501SsheldonhA common workaround has been to run the
67682501Ssheldonh.Xr ntpdate 8
677285612Sdelphijor
678285612Sdelphij.Xr sntp 8
679285612Sdelphijprograms from a
68082501Ssheldonh.Xr cron 8
68182501Ssheldonhjob at designated
68282501Ssheldonhtimes.
683285612SdelphijHowever, these programs do not have the crafted signal
684285612Sdelphijprocessing, error checking or mitigation algorithms of
68582501Ssheldonh.Nm .
68682501SsheldonhThe
68782501Ssheldonh.Fl q
68882501Ssheldonhoption is intended for this purpose.
68982501SsheldonhSetting this option will cause
69082501Ssheldonh.Nm
69182501Ssheldonhto exit just after
69282501Ssheldonhsetting the clock for the first time.
69382501SsheldonhThe procedure for initially
69482501Ssheldonhsetting the clock is the same as in continuous mode; most
69582501Ssheldonhapplications will probably want to specify the
69682501Ssheldonh.Cm iburst
69782501Ssheldonhkeyword with the
69882501Ssheldonh.Ic server
69982501Ssheldonhconfiguration command.
70082501SsheldonhWith this
70182501Ssheldonhkeyword a volley of messages are exchanged to groom the data and
702158688Spavthe clock is set in about 10 s.
70382501SsheldonhIf nothing is heard after a
70482501Ssheldonhcouple of minutes, the daemon times out and exits.
70582501SsheldonhAfter a suitable
70682501Ssheldonhperiod of mourning, the
70782501Ssheldonh.Xr ntpdate 8
708285612Sdelphijprogram will be
70982501Ssheldonhretired.
71082501Ssheldonh.Pp
71182501SsheldonhWhen kernel support is available to discipline the clock
71282501Ssheldonhfrequency, which is the case for stock Solaris, Tru64, Linux and
71382501Ssheldonh.Fx ,
71482501Ssheldonha useful feature is available to discipline the clock
71582501Ssheldonhfrequency.
71682501SsheldonhFirst,
71782501Ssheldonh.Nm
71882501Ssheldonhis run in continuous mode with
71982501Ssheldonhselected servers in order to measure and record the intrinsic clock
72082501Ssheldonhfrequency offset in the frequency file.
72182501SsheldonhIt may take some hours for
72282501Ssheldonhthe frequency and offset to settle down.
72382501SsheldonhThen the
72482501Ssheldonh.Nm
72582501Ssheldonhis
726285612Sdelphijstopped and run in one\-time mode as required.
72782501SsheldonhAt each startup, the
72882501Ssheldonhfrequency is read from the file and initializes the kernel
72982501Ssheldonhfrequency.
73082501Ssheldonh.Ss "Poll Interval Control"
73182501SsheldonhThis version of NTP includes an intricate state machine to
73282501Ssheldonhreduce the network load while maintaining a quality of
73382501Ssheldonhsynchronization consistent with the observed jitter and wander.
73482501SsheldonhThere are a number of ways to tailor the operation in order enhance
73582501Ssheldonhaccuracy by reducing the interval or to reduce network overhead by
73682501Ssheldonhincreasing it.
73782501SsheldonhHowever, the user is advised to carefully consider
73897735Sschweikhthe consequences of changing the poll adjustment range from the
73982501Ssheldonhdefault minimum of 64 s to the default maximum of 1,024 s.
74082501SsheldonhThe
74182501Ssheldonhdefault minimum can be changed with the
74282501Ssheldonh.Ic tinker
74382501Ssheldonh.Cm minpoll
74482501Ssheldonhcommand to a value not less than 16 s.
74582501SsheldonhThis value is used for all
74697735Sschweikhconfigured associations, unless overridden by the
74782501Ssheldonh.Cm minpoll
74882501Ssheldonhoption on the configuration command.
74982501SsheldonhNote that most device drivers
75082501Ssheldonhwill not operate properly if the poll interval is less than 64 s
75182501Ssheldonhand that the broadcast server and manycast client associations will
75297735Sschweikhalso use the default, unless overridden.
75382501Ssheldonh.Pp
75482501SsheldonhIn some cases involving dial up or toll services, it may be
75582501Ssheldonhuseful to increase the minimum interval to a few tens of minutes
75682501Ssheldonhand maximum interval to a day or so.
75782501SsheldonhUnder normal operation
75882501Ssheldonhconditions, once the clock discipline loop has stabilized the
75997735Sschweikhinterval will be increased in steps from the minimum to the
76082501Ssheldonhmaximum.
76182501SsheldonhHowever, this assumes the intrinsic clock frequency error
76282501Ssheldonhis small enough for the discipline loop correct it.
76382501SsheldonhThe capture
76482501Ssheldonhrange of the loop is 500 PPM at an interval of 64s decreasing by a
76582501Ssheldonhfactor of two for each doubling of interval.
76682501SsheldonhAt a minimum of 1,024
76782501Ssheldonhs, for example, the capture range is only 31 PPM.
76882501SsheldonhIf the intrinsic
76982501Ssheldonherror is greater than this, the drift file
77082501Ssheldonh.Pa ntp.drift
77182501Ssheldonhwill
77282501Ssheldonhhave to be specially tailored to reduce the residual error below
77382501Ssheldonhthis limit.
77482501SsheldonhOnce this is done, the drift file is automatically
77582501Ssheldonhupdated once per hour and is available to initialize the frequency
77682501Ssheldonhon subsequent daemon restarts.
777285612Sdelphij.Ss "The huff\-n'\-puff Filter"
77882501SsheldonhIn scenarios where a considerable amount of data are to be
77982501Ssheldonhdownloaded or uploaded over telephone modems, timekeeping quality
78082501Ssheldonhcan be seriously degraded.
78182501SsheldonhThis occurs because the differential
78282501Ssheldonhdelays on the two directions of transmission can be quite large.
78382501SsheldonhIn
78482501Ssheldonhmany cases the apparent time errors are so large as to exceed the
78582501Ssheldonhstep threshold and a step correction can occur during and after the
78682501Ssheldonhdata transfer is in progress.
78782501Ssheldonh.Pp
788285612SdelphijThe huff\-n'\-puff filter is designed to correct the apparent time
78982501Ssheldonhoffset in these cases.
79082501SsheldonhIt depends on knowledge of the propagation
79182501Ssheldonhdelay when no other traffic is present.
79282501SsheldonhIn common scenarios this
79382501Ssheldonhoccurs during other than work hours.
79482501SsheldonhThe filter maintains a shift
79582501Ssheldonhregister that remembers the minimum delay over the most recent
79682501Ssheldonhinterval measured usually in hours.
79782501SsheldonhUnder conditions of severe
79882501Ssheldonhdelay, the filter corrects the apparent offset using the sign of
79982501Ssheldonhthe offset and the difference between the apparent delay and
80082501Ssheldonhminimum delay.
80182501SsheldonhThe name of the filter reflects the negative (huff)
80282501Ssheldonhand positive (puff) correction, which depends on the sign of the
80382501Ssheldonhoffset.
80482501Ssheldonh.Pp
80582501SsheldonhThe filter is activated by the
806158688Spav.Ic tinker
807158688Spavcommand and
80882501Ssheldonh.Cm huffpuff
80982501Ssheldonhkeyword, as described in
81082501Ssheldonh.Xr ntp.conf 5 .
811285612Sdelphij.Sh "ENVIRONMENT"
812285612SdelphijSee \fBOPTION PRESETS\fP for configuration environment variables.
81355896Ssheldonh.Sh FILES
81455896Ssheldonh.Bl -tag -width /etc/ntp.drift -compact
81555896Ssheldonh.It Pa /etc/ntp.conf
81655896Ssheldonhthe default name of the configuration file
81755896Ssheldonh.It Pa /etc/ntp.drift
81855896Ssheldonhthe default name of the drift file
81955896Ssheldonh.It Pa /etc/ntp.keys
82055896Ssheldonhthe default name of the key file
82155896Ssheldonh.El
822285612Sdelphij.Sh "EXIT STATUS"
823285612SdelphijOne of the following exit values will be returned:
824285612Sdelphij.Bl -tag
825285612Sdelphij.It 0 " (EXIT_SUCCESS)"
826285612SdelphijSuccessful program execution.
827285612Sdelphij.It 1 " (EXIT_FAILURE)"
828285612SdelphijThe operation failed or the command syntax was not valid.
829285612Sdelphij.It 70 " (EX_SOFTWARE)"
830285612Sdelphijlibopts had an internal operational error.  Please report
831285612Sdelphijit to autogen\-users@lists.sourceforge.net.  Thank you.
832285612Sdelphij.El
833285612Sdelphij.Sh "SEE ALSO"
83455895Ssheldonh.Xr ntp.conf 5 ,
83555857Ssheldonh.Xr ntpdate 8 ,
83655857Ssheldonh.Xr ntpdc 8 ,
837285612Sdelphij.Xr ntpq 8 ,
838285612Sdelphij.Xr sntp 8
83955857Ssheldonh.Pp
84055857SsheldonhIn addition to the manual pages provided,
84155857Ssheldonhcomprehensive documentation is available on the world wide web
84255857Ssheldonhat
84355857Ssheldonh.Li http://www.ntp.org/ .
84455857SsheldonhA snapshot of this documentation is available in HTML format in
84555857Ssheldonh.Pa /usr/share/doc/ntp .
84655857Ssheldonh.Rs
84755857Ssheldonh.%A David L. Mills
84855857Ssheldonh.%T Network Time Protocol (Version 1)
84955857Ssheldonh.%O RFC1059
85055857Ssheldonh.Re
85155857Ssheldonh.Rs
85255857Ssheldonh.%A David L. Mills
85355857Ssheldonh.%T Network Time Protocol (Version 2)
85455857Ssheldonh.%O RFC1119
85555857Ssheldonh.Re
85655857Ssheldonh.Rs
85755857Ssheldonh.%A David L. Mills
85855857Ssheldonh.%T Network Time Protocol (Version 3)
85955857Ssheldonh.%O RFC1305
86055857Ssheldonh.Re
861285612Sdelphij.Rs
862285612Sdelphij.%A David L. Mills
863285612Sdelphij.%A J. Martin, Ed.
864285612Sdelphij.%A J. Burbank
865285612Sdelphij.%A W. Kasch
866285612Sdelphij.%T Network Time Protocol Version 4: Protocol and Algorithms Specification
867285612Sdelphij.%O RFC5905
868285612Sdelphij.Re
869285612Sdelphij.Rs
870285612Sdelphij.%A David L. Mills
871285612Sdelphij.%A B. Haberman, Ed.
872285612Sdelphij.%T Network Time Protocol Version 4: Autokey Specification
873285612Sdelphij.%O RFC5906
874285612Sdelphij.Re
875285612Sdelphij.Rs
876285612Sdelphij.%A H. Gerstung
877285612Sdelphij.%A C. Elliott
878285612Sdelphij.%A B. Haberman, Ed.
879285612Sdelphij.%T Definitions of Managed Objects for Network Time Protocol Version 4: (NTPv4)
880285612Sdelphij.%O RFC5907
881285612Sdelphij.Re
882285612Sdelphij.Rs
883285612Sdelphij.%A R. Gayraud
884285612Sdelphij.%A B. Lourdelet
885285612Sdelphij.%T Network Time Protocol (NTP) Server Option for DHCPv6
886285612Sdelphij.%O RFC5908
887285612Sdelphij.Re
888285612Sdelphij.Sh "AUTHORS"
889285612SdelphijThe University of Delaware and Network Time Foundation
890285612Sdelphij.Sh "COPYRIGHT"
891316722SdelphijCopyright (C) 1992\-2017 The University of Delaware and Network Time Foundation all rights reserved.
892285612SdelphijThis program is released under the terms of the NTP license, <http://ntp.org/license>.
89355857Ssheldonh.Sh BUGS
89499968ScharnierThe
89555857Ssheldonh.Nm
89699968Scharnierutility has gotten rather fat.
89782501SsheldonhWhile not huge, it has gotten
898285612Sdelphijlarger than might be desirable for an elevated\-priority
89982501Ssheldonh.Nm
90082501Ssheldonhrunning on a workstation, particularly since many of
90182501Ssheldonhthe fancy features which consume the space were designed more with
90282501Ssheldonha busy primary server, rather than a high stratum workstation in
90382501Ssheldonhmind.
904285612Sdelphij.Pp
905285612SdelphijPlease send bug reports to: http://bugs.ntp.org, bugs@ntp.org
906285612Sdelphij.Sh NOTES
907285612SdelphijPortions of this document came from FreeBSD.
908285612Sdelphij.Pp
909285612SdelphijThis manual page was \fIAutoGen\fP\-erated from the \fBntpd\fP
910285612Sdelphijoption definitions.
911