source: networking/netprogs/ntp.xml

trunk
Last change on this file was b9874725, checked in by Bruce Dubbs <bdubbs@…>, 2 months ago

Many tags.

Mostly Programming and Xorg sections and dependencies.

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