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