1 | <?xml version="1.0" encoding="ISO-8859-1"?>
|
---|
2 | <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
|
---|
3 | "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
---|
4 | <!ENTITY % general-entities SYSTEM "../../general.ent">
|
---|
5 | %general-entities;
|
---|
6 |
|
---|
7 | <!ENTITY ntp-download-http "https://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ntp-4.2/ntp-&ntp-version;.tar.gz">
|
---|
8 | <!-- <!ENTITY ntp-download-ftp "&gentoo-ftp-repo;/ntp-&ntp-version;.tar.gz">-->
|
---|
9 | <!ENTITY ntp-download-ftp " ">
|
---|
10 | <!ENTITY ntp-md5sum "857452b05f5f2e033786f77ade1974ed">
|
---|
11 | <!ENTITY ntp-size "6.9 MB">
|
---|
12 | <!ENTITY ntp-buildsize "96 MB (with tests)">
|
---|
13 | <!ENTITY ntp-time "0.7 SBU (with tests)">
|
---|
14 | ]>
|
---|
15 |
|
---|
16 | <sect1 id="ntp" xreflabel="ntp-&ntp-version;">
|
---|
17 | <?dbhtml filename="ntp.html"?>
|
---|
18 |
|
---|
19 | <sect1info>
|
---|
20 | <othername>$LastChangedBy$</othername>
|
---|
21 | <date>$Date$</date>
|
---|
22 | </sect1info>
|
---|
23 |
|
---|
24 | <title>ntp-&ntp-version;</title>
|
---|
25 |
|
---|
26 | <indexterm zone="ntp">
|
---|
27 | <primary sortas="a-ntp">ntp</primary>
|
---|
28 | </indexterm>
|
---|
29 |
|
---|
30 | <sect2 role="package">
|
---|
31 | <title>Introduction to ntp</title>
|
---|
32 |
|
---|
33 | <para>The <application>ntp</application> package contains a
|
---|
34 | client and server to keep the time synchronized between various computers over
|
---|
35 | a network. This package is the official reference implementation of the
|
---|
36 | NTP protocol.</para>
|
---|
37 |
|
---|
38 | &lfs7a_checked;
|
---|
39 |
|
---|
40 | <bridgehead renderas="sect3">Package Information</bridgehead>
|
---|
41 | <itemizedlist spacing="compact">
|
---|
42 | <listitem>
|
---|
43 | <para>Download (HTTP): <ulink url="&ntp-download-http;"/></para>
|
---|
44 | </listitem>
|
---|
45 | <listitem>
|
---|
46 | <para>Download (FTP): <ulink url="&ntp-download-ftp;"/></para>
|
---|
47 | </listitem>
|
---|
48 | <listitem>
|
---|
49 | <para>Download MD5 sum: &ntp-md5sum;</para>
|
---|
50 | </listitem>
|
---|
51 | <listitem>
|
---|
52 | <para>Download size: &ntp-size;</para>
|
---|
53 | </listitem>
|
---|
54 | <listitem>
|
---|
55 | <para>Estimated disk space required: &ntp-buildsize;</para>
|
---|
56 | </listitem>
|
---|
57 | <listitem>
|
---|
58 | <para>Estimated build time: &ntp-time;</para>
|
---|
59 | </listitem>
|
---|
60 | </itemizedlist>
|
---|
61 |
|
---|
62 | <bridgehead renderas="sect3">ntp Dependencies</bridgehead>
|
---|
63 |
|
---|
64 | <bridgehead renderas="sect4">Required</bridgehead>
|
---|
65 | <para role="required">
|
---|
66 | <xref linkend="wget"/> (runtime, for <command>update-leap</command>) and
|
---|
67 | <xref linkend="which"/>
|
---|
68 | </para>
|
---|
69 |
|
---|
70 | <bridgehead renderas="sect4">Optional</bridgehead>
|
---|
71 | <para role="optional">
|
---|
72 | <xref linkend="libcap-pam"/>,
|
---|
73 | <xref linkend="libevent"/>,
|
---|
74 | <xref linkend="openssl"/>,
|
---|
75 | <ulink url="http://www.thrysoee.dk/editline/">libedit</ulink>, and
|
---|
76 | <ulink url="https://www.gnu.org/software/autogen/">libopts from
|
---|
77 | AutoGen</ulink>
|
---|
78 | </para>
|
---|
79 |
|
---|
80 | <para condition="html" role="usernotes">User Notes:
|
---|
81 | <ulink url="&blfs-wiki;/ntp"/></para>
|
---|
82 |
|
---|
83 | </sect2>
|
---|
84 |
|
---|
85 | <sect2 role="installation">
|
---|
86 | <title>Installation of ntp</title>
|
---|
87 |
|
---|
88 | <para>
|
---|
89 | There should be a dedicated user and group to take control
|
---|
90 | of the <command>ntpd</command> daemon after it is
|
---|
91 | started. Issue the following commands as the
|
---|
92 | <systemitem class="username">root</systemitem> user:
|
---|
93 | </para>
|
---|
94 |
|
---|
95 | <screen role="root"><userinput>groupadd -g 87 ntp &&
|
---|
96 | useradd -c "Network Time Protocol" -d /var/lib/ntp -u 87 \
|
---|
97 | -g ntp -s /bin/false ntp</userinput></screen>
|
---|
98 |
|
---|
99 | <para>Install <application>ntp</application> by running
|
---|
100 | the following commands:</para>
|
---|
101 |
|
---|
102 | <screen><userinput>./configure --prefix=/usr \
|
---|
103 | --bindir=/usr/sbin \
|
---|
104 | --sysconfdir=/etc \
|
---|
105 | --enable-linuxcaps \
|
---|
106 | --with-lineeditlibs=readline \
|
---|
107 | --docdir=/usr/share/doc/ntp-&ntp-version; &&
|
---|
108 | make</userinput></screen>
|
---|
109 |
|
---|
110 | <para>To test the results, issue: <command>make check</command>.</para>
|
---|
111 |
|
---|
112 | <para>Now, as the <systemitem class="username">root</systemitem> user:</para>
|
---|
113 |
|
---|
114 | <screen role="root"><userinput>make install &&
|
---|
115 | install -v -o ntp -g ntp -d /var/lib/ntp</userinput></screen>
|
---|
116 |
|
---|
117 | </sect2>
|
---|
118 |
|
---|
119 | <sect2 role="commands">
|
---|
120 | <title>Command Explanations</title>
|
---|
121 |
|
---|
122 | <para><parameter>--bindir=/usr/sbin</parameter>: This parameter places
|
---|
123 | the administrative programs in <filename
|
---|
124 | class="directory">/usr/sbin</filename>.</para>
|
---|
125 |
|
---|
126 | <para><parameter>--enable-linuxcaps</parameter>: ntpd is run as user
|
---|
127 | ntp, so use Linux capabilities for non-root clock control.</para>
|
---|
128 |
|
---|
129 | <para><parameter>--with-lineeditlibs=readline</parameter>: This switch
|
---|
130 | enables <application>Readline</application> support for
|
---|
131 | <command>ntpdc</command> and <command>ntpq</command> programs. If omitted,
|
---|
132 | <application>libedit</application> will be used if installed, otherwise no
|
---|
133 | readline capabilites will be compiled.</para>
|
---|
134 |
|
---|
135 | </sect2>
|
---|
136 |
|
---|
137 | <sect2 role="configuration">
|
---|
138 | <title>Configuring ntp</title>
|
---|
139 |
|
---|
140 | <sect3 id="ntp-config">
|
---|
141 | <title>Config Files</title>
|
---|
142 |
|
---|
143 | <para><filename>/etc/ntp.conf</filename></para>
|
---|
144 |
|
---|
145 | <indexterm zone="ntp ntp-config">
|
---|
146 | <primary sortas="e-etc-ntp.conf">/etc/ntp.conf</primary>
|
---|
147 | </indexterm>
|
---|
148 |
|
---|
149 | </sect3>
|
---|
150 |
|
---|
151 | <sect3>
|
---|
152 | <title>Configuration Information</title>
|
---|
153 |
|
---|
154 | <para>The following configuration file first defines various ntp
|
---|
155 | servers with open access from different continents. Second, it
|
---|
156 | creates a drift file where <command>ntpd</command> stores the
|
---|
157 | frequency offset and a pid file to store the
|
---|
158 | <command>ntpd</command> process ID. Third, it defines the location
|
---|
159 | for the leap-second definition file
|
---|
160 | <filename>/etc/ntp.leapseconds</filename>, that the
|
---|
161 | <command>update-leap</command> script checks and updates, when
|
---|
162 | necessary. This script can be run as a cron job and the
|
---|
163 | <application>ntp</application> developers recommend a frequency of
|
---|
164 | about three weeks for the updates. Since the documentation included
|
---|
165 | with the package is sparse, visit the ntp website at
|
---|
166 | <ulink url="http://www.ntp.org/"/> and
|
---|
167 | <ulink url="http://www.pool.ntp.org/"/> for more information.</para>
|
---|
168 |
|
---|
169 | <screen role="root"><userinput>cat > /etc/ntp.conf << "EOF"
|
---|
170 | <literal># Asia
|
---|
171 | server 0.asia.pool.ntp.org
|
---|
172 |
|
---|
173 | # Australia
|
---|
174 | server 0.oceania.pool.ntp.org
|
---|
175 |
|
---|
176 | # Europe
|
---|
177 | server 0.europe.pool.ntp.org
|
---|
178 |
|
---|
179 | # North America
|
---|
180 | server 0.north-america.pool.ntp.org
|
---|
181 |
|
---|
182 | # South America
|
---|
183 | server 2.south-america.pool.ntp.org
|
---|
184 |
|
---|
185 | driftfile /var/lib/ntp/ntp.drift
|
---|
186 | pidfile /var/run/ntpd.pid
|
---|
187 |
|
---|
188 | leapfile /etc/ntp.leapseconds</literal>
|
---|
189 | EOF</userinput></screen>
|
---|
190 |
|
---|
191 | <para>
|
---|
192 | You may wish to add a <quote>Security session</quote>. For
|
---|
193 | explanations, see
|
---|
194 | <ulink url="https://www.eecis.udel.edu/~mills/ntp/html/accopt.html#restrict"/>.
|
---|
195 | </para>
|
---|
196 |
|
---|
197 | <screen role="root"><userinput>cat >> /etc/ntp.conf << "EOF"
|
---|
198 | <literal># Security session
|
---|
199 | restrict default limited kod nomodify notrap nopeer noquery
|
---|
200 | restrict -6 default limited kod nomodify notrap nopeer noquery
|
---|
201 |
|
---|
202 | restrict 127.0.0.1
|
---|
203 | restrict ::1</literal>
|
---|
204 | EOF</userinput></screen>
|
---|
205 |
|
---|
206 | </sect3>
|
---|
207 |
|
---|
208 | <sect3 id="ntp-init">
|
---|
209 | <title>Synchronizing the Time</title>
|
---|
210 |
|
---|
211 | <para>There are two options. Option one is to run <command>ntpd</command>
|
---|
212 | continuously and allow it to synchronize the time in a gradual manner. The
|
---|
213 | other option is to run <command>ntpd</command> periodically (using cron)
|
---|
214 | and update the time each time <command>ntpd</command> is scheduled.</para>
|
---|
215 |
|
---|
216 | <para>If you choose Option one, then install the
|
---|
217 | <phrase revision="sysv"><filename>/etc/rc.d/init.d/ntp</filename>
|
---|
218 | init script</phrase>
|
---|
219 | <phrase revision="systemd"><filename>ntpd.service</filename> unit</phrase>
|
---|
220 | included in the
|
---|
221 | <xref linkend="bootscripts" revision="sysv"/>
|
---|
222 | <xref linkend="systemd-units" revision="systemd"/> package.</para>
|
---|
223 |
|
---|
224 | <indexterm zone="ntp ntp-init" revision="sysv">
|
---|
225 | <primary sortas="f-ntp">ntp</primary>
|
---|
226 | </indexterm>
|
---|
227 |
|
---|
228 | <indexterm zone="ntp ntp-init" revision="systemd">
|
---|
229 | <primary sortas="f-ntpd">ntpd.service</primary>
|
---|
230 | </indexterm>
|
---|
231 |
|
---|
232 | <screen role="root"><userinput>make install-ntpd</userinput></screen>
|
---|
233 |
|
---|
234 | <para>If you prefer to run <command>ntpd</command> periodically, add the
|
---|
235 | following command to <systemitem class="username">root</systemitem>'s
|
---|
236 | <filename>crontab</filename>:</para>
|
---|
237 |
|
---|
238 | <screen><literal>ntpd -q</literal></screen>
|
---|
239 |
|
---|
240 | <para revision="sysv">Execute the following command if you would like to
|
---|
241 | set the hardware clock to the current system time at shutdown and
|
---|
242 | reboot:</para>
|
---|
243 |
|
---|
244 | <screen role="root" revision="sysv"><userinput>ln -v -sf ../init.d/setclock /etc/rc.d/rc0.d/K46setclock &&
|
---|
245 | ln -v -sf ../init.d/setclock /etc/rc.d/rc6.d/K46setclock</userinput></screen>
|
---|
246 |
|
---|
247 | <para revision="sysv">The other way around is already set up by
|
---|
248 | LFS.</para>
|
---|
249 |
|
---|
250 | </sect3>
|
---|
251 |
|
---|
252 | </sect2>
|
---|
253 |
|
---|
254 | <sect2 role="content">
|
---|
255 | <title>Contents</title>
|
---|
256 |
|
---|
257 | <segmentedlist>
|
---|
258 | <segtitle>Installed Programs</segtitle>
|
---|
259 | <segtitle>Installed Libraries</segtitle>
|
---|
260 | <segtitle>Installed Directories</segtitle>
|
---|
261 |
|
---|
262 | <seglistitem>
|
---|
263 | <seg>calc_tickadj, ntp-keygen, ntp-wait, ntpd, ntpdate, ntpdc, ntpq,
|
---|
264 | ntptime, ntptrace, sntp, tickadj and update-leap</seg>
|
---|
265 | <seg>None</seg>
|
---|
266 | <seg>/usr/share/ntp,
|
---|
267 | /usr/share/doc/ntp-4.2.8 and
|
---|
268 | /var/lib/ntp</seg>
|
---|
269 | </seglistitem>
|
---|
270 | </segmentedlist>
|
---|
271 |
|
---|
272 | <variablelist>
|
---|
273 | <bridgehead renderas="sect3">Short Descriptions</bridgehead>
|
---|
274 | <?dbfo list-presentation="list"?>
|
---|
275 | <?dbhtml list-presentation="table"?>
|
---|
276 |
|
---|
277 | <varlistentry id="calc_tickadj">
|
---|
278 | <term><command>calc_tickadj</command></term>
|
---|
279 | <listitem>
|
---|
280 | <para>calculates optimal value for tick given ntp drift file.</para>
|
---|
281 | <indexterm zone="ntp calc_tickadj">
|
---|
282 | <primary sortas="b-calc_tickadj">calc_tickadj</primary>
|
---|
283 | </indexterm>
|
---|
284 | </listitem>
|
---|
285 | </varlistentry>
|
---|
286 |
|
---|
287 | <varlistentry id="ntp-keygen">
|
---|
288 | <term><command>ntp-keygen</command></term>
|
---|
289 | <listitem>
|
---|
290 | <para>generates cryptographic data files used by the NTPv4 authentication
|
---|
291 | and identification schemes.</para>
|
---|
292 | <indexterm zone="ntp ntp-keygen">
|
---|
293 | <primary sortas="b-ntp-keygen">ntp-keygen</primary>
|
---|
294 | </indexterm>
|
---|
295 | </listitem>
|
---|
296 | </varlistentry>
|
---|
297 |
|
---|
298 | <varlistentry id="ntp-wait">
|
---|
299 | <term><command>ntp-wait</command></term>
|
---|
300 | <listitem>
|
---|
301 | <para>is useful at boot time, to delay the boot sequence until
|
---|
302 | <command>ntpd</command> has set the time.</para>
|
---|
303 | <indexterm zone="ntp ntp-wait">
|
---|
304 | <primary sortas="b-ntp-wait">ntp-wait</primary>
|
---|
305 | </indexterm>
|
---|
306 | </listitem>
|
---|
307 | </varlistentry>
|
---|
308 |
|
---|
309 | <varlistentry id="ntpd">
|
---|
310 | <term><command>ntpd</command></term>
|
---|
311 | <listitem>
|
---|
312 | <para>is a ntp daemon that runs in the background and keeps
|
---|
313 | the date and time synchronized based on response from configured
|
---|
314 | ntp servers. It also functions as a ntp server.</para>
|
---|
315 | <indexterm zone="ntp ntpd">
|
---|
316 | <primary sortas="b-ntpd">ntpd</primary>
|
---|
317 | </indexterm>
|
---|
318 | </listitem>
|
---|
319 | </varlistentry>
|
---|
320 |
|
---|
321 | <varlistentry id="ntpdate">
|
---|
322 | <term><command>ntpdate</command></term>
|
---|
323 | <listitem>
|
---|
324 | <para>is a client program that sets the date and time based on
|
---|
325 | the response from an ntp server. This command is deprecated.</para>
|
---|
326 | <indexterm zone="ntp ntpdate">
|
---|
327 | <primary sortas="b-ntpdate">ntpdate</primary>
|
---|
328 | </indexterm>
|
---|
329 | </listitem>
|
---|
330 | </varlistentry>
|
---|
331 |
|
---|
332 | <varlistentry id="ntpdc">
|
---|
333 | <term><command>ntpdc</command></term>
|
---|
334 | <listitem>
|
---|
335 | <para>is used to query the ntp daemon about its current state
|
---|
336 | and to request changes in that state.</para>
|
---|
337 | <indexterm zone="ntp ntpdc">
|
---|
338 | <primary sortas="b-ntpdc">ntpdc</primary>
|
---|
339 | </indexterm>
|
---|
340 | </listitem>
|
---|
341 | </varlistentry>
|
---|
342 |
|
---|
343 | <varlistentry id="ntpq">
|
---|
344 | <term><command>ntpq</command></term>
|
---|
345 | <listitem>
|
---|
346 | <para>is a utility program used to monitor <command>ntpd</command>
|
---|
347 | operations and determine performance.</para>
|
---|
348 | <indexterm zone="ntp ntpq">
|
---|
349 | <primary sortas="b-ntpq">ntpq</primary>
|
---|
350 | </indexterm>
|
---|
351 | </listitem>
|
---|
352 | </varlistentry>
|
---|
353 |
|
---|
354 | <varlistentry id="ntptime">
|
---|
355 | <term><command>ntptime</command></term>
|
---|
356 | <listitem>
|
---|
357 | <para>reads and displays time-related kernel variables.</para>
|
---|
358 | <indexterm zone="ntp ntptime">
|
---|
359 | <primary sortas="b-ntptime">ntptime</primary>
|
---|
360 | </indexterm>
|
---|
361 | </listitem>
|
---|
362 | </varlistentry>
|
---|
363 |
|
---|
364 | <varlistentry id="ntptrace">
|
---|
365 | <term><command>ntptrace</command></term>
|
---|
366 | <listitem>
|
---|
367 | <para>traces a chain of ntp servers back to the primary source.</para>
|
---|
368 | <indexterm zone="ntp ntptrace">
|
---|
369 | <primary sortas="b-ntptrace">ntptrace</primary>
|
---|
370 | </indexterm>
|
---|
371 | </listitem>
|
---|
372 | </varlistentry>
|
---|
373 |
|
---|
374 | <varlistentry id="sntp">
|
---|
375 | <term><command>sntp</command></term>
|
---|
376 | <listitem>
|
---|
377 | <para>is a Simple Network Time Protocol (SNTP) client.</para>
|
---|
378 | <indexterm zone="ntp sntp">
|
---|
379 | <primary sortas="b-sntp">sntp</primary>
|
---|
380 | </indexterm>
|
---|
381 | </listitem>
|
---|
382 | </varlistentry>
|
---|
383 |
|
---|
384 | <varlistentry id="tickadj">
|
---|
385 | <term><command>tickadj</command></term>
|
---|
386 | <listitem>
|
---|
387 | <para>reads, and optionally modifies, several timekeeping-related
|
---|
388 | variables in older kernels that do not have support for precision
|
---|
389 | timekeeping.</para>
|
---|
390 | <indexterm zone="ntp tickadj">
|
---|
391 | <primary sortas="b-tickadj">tickadj</primary>
|
---|
392 | </indexterm>
|
---|
393 | </listitem>
|
---|
394 | </varlistentry>
|
---|
395 |
|
---|
396 | <varlistentry id="update-leap">
|
---|
397 | <term><command>update-leap</command></term>
|
---|
398 | <listitem>
|
---|
399 | <para>is a script to verify and, if necessary, update the leap-second
|
---|
400 | definition file.</para>
|
---|
401 | <indexterm zone="ntp update-leap">
|
---|
402 | <primary sortas="b-update-leap">update-leap</primary>
|
---|
403 | </indexterm>
|
---|
404 | </listitem>
|
---|
405 | </varlistentry>
|
---|
406 |
|
---|
407 | </variablelist>
|
---|
408 |
|
---|
409 | </sect2>
|
---|
410 |
|
---|
411 | </sect1>
|
---|