xref: /freebsd/contrib/ntp/html/ntpd.html (revision 7d8f797b725e3efc0a4256554654780df83c456c)
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2<html>
3<head>
4<meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
5<meta name="generator" content="HTML Tidy, see www.w3.org">
6<title>ntpd - Network Time Protocol (NTP) daemon</title>
7<!-- Changed by: Harlan &, 10-Feb-2014 -->
8<link href="scripts/style.css" type="text/css" rel="stylesheet">
9</head>
10<body>
11<h3><tt>ntpd</tt> - Network Time Protocol (NTP) Daemon</h3>
12<img src="pic/wingdorothy.gif" alt="gif" align="left"><a href="http://www.eecis.udel.edu/~mills/pictures.html">from <i>The Wizard of Oz</i>, L. Frank Baum</a>
13<p>You need help from the monkeys.</p>
14<p>Last update:
15  <!-- #BeginDate format:En2m -->10-Mar-2014  05:14<!-- #EndDate -->
16    UTC</p>
17<br clear="left">
18<h4>Related Links</h4>
19<script type="text/javascript" language="javascript" src="scripts/command.txt"></script>
20<h4>Table of Contents</h4>
21<ul>
22  <li class="inline"><a href="#synop">Synopsis</a></li>
23  <li class="inline"><a href="#descr">Description</a></li>
24  <li class="inline"><a href="#cmd">Command Line Options</a></li>
25  <li class="inline"><a href="#cfg">The Configuration File</a></li>
26  <li class="inline"><a href="#files">Files</a></li>
27</ul>
28<hr>
29<h4 id="synop">Synopsis</h4>
30<tt>ntpd [ -46aAbdDgLmnNqx ] [ -c <i>conffile</i> ] [ -f <i>driftfile</i> ] [ -i <i>jaildir</i> ] [ -I <i>InterfaceOrAddress</i> ] [ -k <i>keyfile</i> ] [ -l <i>logfile</i> ] [ -p <i>pidfile</i> ] [ -P <i>priority</i> ] [ -r <i>broadcastdelay</i> ] [ -s <i>statsdir</i> ] [ -t <i>key</i> ] [ -u <i>user</i>[:<i>group</i>] ] [ -U <i>interface_update_interval</i> ] [ -v <i>variable</i> ] [ -V <i>variable</i> ]</tt>
31<h4 id="descr">Description</h4>
32<p>The <tt>ntpd</tt> program is an operating system daemon that synchronizes the system clock to remote NTP time servers or local reference clocks. It is a complete implementation of  NTP version 4 defined by RFC-5905, but also retains compatible with version 3 defined by RFC-1305 and versions 1 and 2,  defined by RFC-1059 and RFC-1119, respectively. The program can operate in any of several modes, including client/server, symmetric and broadcast modes, and with both symmetric-key and public key-cryptography</p>
33<p>The <tt>ntpd</tt> program ordinarily requires a configuration file described on this page. It contains configuration commands described on the pages listed above. However a client can discover remote servers and configure them automatically. This makes it possible to deploy a fleet of workstations without specifying configuration details specific to the local environment. Further details are on the </p>
34<p>The <tt>ntpd</tt> program normally operates continuously while adjusting the system time and frequency, but in some cases this might not be practical. With the <tt>-q</tt> option <tt>ntpd</tt> operates as in continuous mode, but exits just after setting the clock for the first time. Most applications will probably want to specify the <tt>iburst</tt> option with the <tt>server</tt> command. With this option a volley of messages is exchanged to groom the data and set the clock in about ten seconds. If nothing is heard after a few minutes, the daemon times out and exits without setting the clock.</p>
35<h4 id="cmd">Command Line Options</h4>
36<dl>
37  <dt><tt>-4</tt>
38  <dd>Force DNS resolution of host names to the IPv4 namespace.
39  <dt><tt>-6</tt>
40  <dd>Force DNS resolution of host names to the IPv6 namespace.
41  <dt><tt>-a</tt></dt>
42  <dd>Require cryptographic authentication for broadcast client, multicast client and symmetric passive associations. This is the same operation as the <tt>enable auth</tt> command and is the default.</dd>
43  <dt><tt>-A</tt></dt>
44  <dd>Do not require cryptographic authentication for broadcast client, multicast client and symmetric passive associations. This is the same operation as the <tt>disable auth</tt> command and almost never a good idea.</dd>
45  <dt><tt>-b</tt></dt>
46  <dd>Enable the client to synchronize to broadcast servers.</dd>
47  <dt><tt>-c <i>conffile</i></tt></dt>
48  <dd>Specify the name and path of the configuration file. Without the option the default is <tt>/etc/ntp.conf</tt>.</dd>
49  <dt><tt>-d</tt></dt>
50  <dd> Disable switching into daemon mode, so <tt>ntpd</tt> stays   attached to the starting terminal which will get all the debugging printout.    Also, ^C will kill it. This option may occur more than once, with each occurrence indicating greater detail of display.</dd>
51  <dt><tt>-D <i>level</i></tt></dt>
52  <dd>Specify debugging level directly, with <tt>level</tt> corresponding to the numbe of <tt>-d</tt> options..</dd>
53  <dt><tt>-f <i>driftfile</i></tt></dt>
54  <dd>Specify the name and path of the frequency file. This is the same operation as the <tt>driftfile <i>driftfile</i></tt> configuration command.
55  <dt><tt>-g</tt></dt>
56  <dd>Normally, <tt>ntpd</tt> exits 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, <tt>ntpd</tt> will exit with a message to the system log. This option can be used with the <tt>-q</tt> and <tt>-x</tt> options. See the <tt>tinker</tt> command for other options.</dd>
57  <dt><tt>-i <i>jaildir</i></tt></dt>
58  <dd>Chroot the server to the directory <i><tt>jaildir</tt></i>. This option also implies that the server attempts to drop root privileges at startup (otherwise, chroot gives very little additional security), and it is only available if the OS supports to run the server without full root privileges. You may need to also specify a <tt>-u</tt> option.</dd>
59  <dt id="--interface"><tt>-I [<i>address</i> | <i>interface name</i>]</tt></dt>
60  <dd>Open the network address given, or all the addresses associated with the given interface name. This option may appear multiple times. This option also implies not opening other addresses, except wildcard and localhost. This option is deprecated. Please consider using the configuration file <a href="miscopt.html#interface">interface</a> command, which is more versatile.</dd>
61  <dt><tt>-k <i>keyfile</i></tt></dt>
62  <dd>Specify the name and path of the symmetric key file. This is the same operation as the <tt>keys <i>keyfile</i></tt> command.</dd>
63  <dt><tt>-l <i>logfile</i></tt></dt>
64  <dd>Specify the name and path of the log file. The default is the system log file. This is the same operation as the <tt>logfile <i>logfile</i></tt> command.</dd>
65  <dt id="--mdns"><tt>-m</tt></dt>
66  <dd>Once the system clock is synchronized, register with mDNS as an available server.</dd>
67  <dt id="--novirtualips"><tt>-L</tt></dt>
68  <dd>Do not listen to virtual interfaces, defined as those with names containing a colon. This option is deprecated. Please consider using the configuration file <a href="miscopt.html#interface">interface</a> command, which is more versatile.</dd>
69  <dt><tt>-M</tt></dt>
70  <dd>Raise scheduler precision to its maximum (1 ms) using timeBeginPeriod. (Windows only)</dd>
71  <dt><tt>-n</tt></dt>
72  <dd>Don't fork.</dd>
73  <dt><tt>-N</tt></dt>
74  <dd>To the extent permitted by the operating system, run the <tt>ntpd</tt> at the highest priority.</dd>
75  <dt><tt>-p <i>pidfile</i></tt></dt>
76  <dd>Specify the name and path of the file used to record the <tt>ntpd</tt> process ID. This is the same operation as the <tt>pidfile <i>pidfile</i></tt> command.</dd>
77  <dt><tt>-P <i>priority</i></tt></dt>
78  <dd>To the extent permitted by the operating system, run the <tt>ntpd</tt> at the specified priority.</dd>
79  <dt><tt>-q</tt></dt>
80  <dd>Exit the <tt>ntpd</tt> just after the first time the clock is set. This behavior mimics that of the <tt>ntpdate</tt> program, which is to be retired. The <tt>-g</tt> and <tt>-x</tt> options can be used with this option. Note: The kernel time discipline is disabled with this option.</dd>
81  <dt><tt>-r <i>broadcastdelay</i></tt></dt>
82  <dd>Specify 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.</dd>
83  <dt><tt>-s <i>statsdir</i></tt></dt>
84  <dd>Specify the directory path for files created by the statistics facility. This is the same operation as the <tt>statsdir <i>statsdir</i></tt> command.</dd>
85  <dt><tt>-t <i>key</i></tt></dt>
86  <dd>Add a key number to the trusted key list. This option can occur more than once. This is the same operation as the <tt>trustedkey <i>key</i></tt> command.</dd>
87  <dt><tt>-u <i>user[:group]</i> </tt></dt>
88  <dd>Specify a user, and optionally a group, to switch to. This option is only available if the OS supports running the server without full root privileges. Currently, this option is supported under NetBSD (configure with <tt>--enable-clockctl</tt>) and Linux (configure with --<tt>enable-linuxcaps</tt>).</dd>
89  <dt><tt>-U <i>interface update interval</i></tt></dt>
90  <dd>Number of seconds to wait between interface list scans to pick up old and delete network interface. Set to 0 to disable dynamic interface list updating. The default is to scan every 5 minutes.</dd>
91  <dt><tt>-v <i>variable</i></tt><br>
92    <tt>-V <i>variable</i></tt></dt>
93  <dd>Add a system variable listed by default.</dd>
94  <dt><tt>-x</tt></dt>
95  <dd>Normally, 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. This option sets the threshold to 600 s, which is well within the accuracy window to set the clock manually. Note: 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. Thus, an adjustment as much as 600 s will take almost 14 days to complete. This option can be used with the <tt>-g</tt> and <tt>-q</tt> options. See the <tt>tinker</tt> command for other options. Note: The kernel time discipline is disabled with this option.</dd>
96  <dt><tt>--pccfreq <i>frequency</i></tt></dt>
97  <dd>Substitute processor cycle counter for QueryPerformanceCounter unconditionally
98    using the given frequency (in Hz). <tt>--pccfreq</tt> can be used on systems
99    which do not use the PCC to implement QueryPerformanceCounter
100    and have a fixed PCC frequency. The frequency specified must
101    be accurate within 0.5 percent. <tt>--usepcc</tt> is equivalent on many systems and should
102    be tried first, as it does not require determining the frequency
103    of the processor cycle counter. For x86-compatible processors, the PCC is
104    also referred to as <tt>RDTSC</tt>, which is the assembly-language instruction to retrieve
105    the current value.&nbsp; (Windows only)</dd>
106  <dt><tt>--usepcc</tt></dt>
107  <dd>Substitute processor cycle counter for QueryPerformanceCounter if they
108    appear equivalent. This option should be used only if the PCC
109    frequency is fixed. Power-saving functionality on many laptops varies the
110    PCC frequency. (Windows only)</dd>
111</dl>
112<h4 id="cfg">The Configuration File</h4>
113<p>Ordinarily, <tt>ntpd</tt> reads the <tt>ntp.conf</tt> configuration file at startup in order to determine the synchronization sources and operating modes. It is also possible to specify a working, although limited, configuration entirely on the command line, obviating the need for a configuration file. This may be particularly useful when the local host is to be configured as a broadcast client, with servers determined by listening to broadcasts at run time.</p>
114<p>Usually, the configuration file is installed as<tt>/etc/ntp.conf</tt>, but could be installed elsewhere (see the <tt>-c <i>conffile</i></tt> command line option). The file format is similar to other Unix configuration files - comments begin with a <tt>#</tt> character and extend to the end of the line; blank lines are ignored.</p>
115<p>Configuration commands consist of an initial command keyword followed by a list of option keywords separated by whitespace. Commands may not be continued over multiple lines. Options may be host names, host addresses written in numeric, dotted-quad form, integers, floating point numbers (when specifying times in seconds) and text strings. Optional arguments are delimited by <tt>[ ]</tt> in the options pages, while alternatives are separated by <tt>|</tt>. The notation <tt>[ ... ]</tt> means an optional, indefinite repetition of the last item before the <tt>[ ... ]</tt>.</p>
116<h4 id="files">Files</h4>
117<table width="100%" border="1">
118  <tr>
119    <td width="30%">File</td>
120    <td width="30%">Default</td>
121    <td width="20%">Option</td>
122    <td width="20%">Option</td>
123  </tr>
124  <tr>
125    <td width="30%">configuration file</td>
126    <td width="30%"><tt>/etc/ntp.conf</tt></td>
127    <td width="20%"><tt>-c</tt></td>
128    <td width="20%"><tt>conffile</tt></td>
129  </tr>
130  <tr>
131    <td width="30%">frequency file</td>
132    <td width="30%">none</td>
133    <td width="20%"><tt>-f</tt></td>
134    <td width="20%"><tt>driftfile</tt></td>
135  </tr>
136  <tr>
137    <td width="30%">leapseconds file</td>
138    <td width="30%">none</td>
139    <td width="20%"></td>
140    <td width="20%"><tt>leapfile</tt></td>
141  </tr>
142  <tr>
143    <td width="30%">process ID file</td>
144    <td width="30%">none</td>
145    <td width="20%"><tt>-p</tt></td>
146    <td width="20%"><tt>pidfile</tt></td>
147  </tr>
148  <tr>
149    <td width="30%">log file</td>
150    <td width="30%">system log</td>
151    <td width="20%"><tt>-l</tt></td>
152    <td width="20%"><tt>logfile</tt></td>
153  </tr>
154  <tr>
155    <td width="30%">include file</td>
156    <td width="30%">none</td>
157    <td width="20%">none</td>
158    <td width="20%"><tt>includefile</tt></td>
159  </tr>
160  <tr>
161    <td width="30%">statistics path</td>
162    <td width="30%"><tt>/var/NTP</tt></td>
163    <td width="20%"><tt>-s</tt></td>
164    <td width="20%"><tt>statsdir</tt></td>
165  </tr>
166  <tr>
167    <td width="30%">keys path</td>
168    <td width="30%"><tt>/usr/local/etc</tt></td>
169    <td width="20%">none</td>
170    <td width="20%"><tt>keysdir</tt></td>
171  </tr>
172</table>
173<hr>
174<script type="text/javascript" language="javascript" src="scripts/footer.txt"></script>
175</body>
176</html>
177