source: networking/netprogs/ntp.xml@ c5d6597

12.0 12.1 ken/TL2024 ken/tuningfonts lazarus plabs/newcss python3.11 rahul/power-profiles-daemon renodr/vulkan-addition trunk xry111/llvm18
Last change on this file since c5d6597 was 42ddc30, checked in by Xi Ruoyao <xry111@…>, 11 months ago

treewide: Replace "User Notes" with "Editor Notes"

  • Property mode set to 100644
File size: 15.7 KB
Line 
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 "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 &lfs113_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 <para>
118 The <command>update-leap</command> command needs to be fixed in order
119 to run properly:
120 </para>
121
122<screen><userinput>sed -e 's/"(\\S+)"/"?([^\\s"]+)"?/' \
123 -i scripts/update-leap/update-leap.in</userinput></screen>
124
125 <para>
126 Now fix an issue introduced with glibc-2.34:
127 </para>
128
129<screen><userinput>sed -e 's/#ifndef __sun/#if !defined(__sun) \&amp;\&amp; !defined(__GLIBC__)/' \
130 -i libntp/work_thread.c</userinput></screen>
131
132 <para>
133 Install <application>ntp</application> by running
134 the following commands:
135 </para>
136
137<screen><userinput>./configure --prefix=/usr \
138 --bindir=/usr/sbin \
139 --sysconfdir=/etc \
140 --enable-linuxcaps \
141 --with-lineeditlibs=readline \
142 --docdir=/usr/share/doc/ntp-&ntp-version; &amp;&amp;
143make</userinput></screen>
144
145 <!-- https://bugs.ntp.org/show_bug.cgi?id=3688
146 It should be fixed in the next ntp release. -->
147 <!--<para>The test suite of this package is broken with GCC 10 or later.</para>
148 Now works OK-->
149
150 <para>
151 To test the results, issue: <command>make check</command>.
152 </para>
153
154 <para>
155 Now, as the <systemitem class="username">root</systemitem> user:
156 </para>
157
158<screen role="root"><userinput>make install &amp;&amp;
159install -v -o ntp -g ntp -d /var/lib/ntp</userinput></screen>
160
161 </sect2>
162
163 <sect2 role="commands">
164 <title>Command Explanations</title>
165
166 <para>
167 <envar>CFLAGS="-O2 -g -fPIC"</envar>: This environment variable
168 is necessary to generate Position Independent Code needed for
169 use in the package libraries.
170 </para>
171
172 <para>
173 <parameter>--bindir=/usr/sbin</parameter>: This parameter places
174 the administrative programs in <filename
175 class="directory">/usr/sbin</filename>.
176 </para>
177
178 <para>
179 <parameter>--enable-linuxcaps</parameter>: ntpd is run as user
180 ntp, so use Linux capabilities for non-root clock control.
181 </para>
182
183 <para>
184 <parameter>--with-lineeditlibs=readline</parameter>: This switch
185 enables <application>Readline</application> support for
186 <command>ntpdc</command> and <command>ntpq</command> programs. If omitted,
187 <application>libedit</application> will be used if installed, otherwise no
188 readline capabilities will be compiled.
189 </para>
190
191 </sect2>
192
193 <sect2 role="configuration">
194 <title>Configuring ntp</title>
195
196 <sect3 id="ntp-config">
197 <title>Config Files</title>
198
199 <para>
200 <filename>/etc/ntp.conf</filename>
201 </para>
202
203 <indexterm zone="ntp ntp-config">
204 <primary sortas="e-etc-ntp.conf">/etc/ntp.conf</primary>
205 </indexterm>
206
207 </sect3>
208
209 <sect3>
210 <title>Configuration Information</title>
211
212 <para>
213 The following configuration file first defines various ntp
214 servers with open access from different continents. Second, it
215 creates a drift file where <command>ntpd</command> stores the
216 frequency offset and a pid file to store the
217 <command>ntpd</command> process ID. Third, it defines the location
218 for the leap-second definition file
219 <filename>/etc/ntp.leapseconds</filename>, that the
220 <command>update-leap</command> script checks and updates, when
221 necessary. This script can be run as a cron job and the
222 <application>ntp</application> developers recommend a frequency of
223 about three weeks for the updates. Since the documentation included
224 with the package is sparse, visit the ntp website at
225 <ulink url="https://www.ntp.org/"/> and
226 <ulink url="https://www.ntppool.org/"/> for more information.
227 </para>
228
229<screen role="root"><userinput>cat &gt; /etc/ntp.conf &lt;&lt; "EOF"
230<literal># Asia
231server 0.asia.pool.ntp.org
232
233# Australia
234server 0.oceania.pool.ntp.org
235
236# Europe
237server 0.europe.pool.ntp.org
238
239# North America
240server 0.north-america.pool.ntp.org
241
242# South America
243server 2.south-america.pool.ntp.org
244
245driftfile /var/lib/ntp/ntp.drift
246pidfile /run/ntpd.pid
247
248leapfile /var/lib/ntp/ntp.leapseconds</literal>
249EOF</userinput></screen>
250
251 <para>
252 You may wish to add a <quote>Security session</quote>. For
253 explanations, see <ulink url=
254 "https://www.eecis.udel.edu/~mills/ntp/html/accopt.html#restrict"/>.
255 </para>
256
257<screen role="root"><userinput>cat &gt;&gt; /etc/ntp.conf &lt;&lt; "EOF"
258<literal># Security session
259restrict default limited kod nomodify notrap nopeer noquery
260restrict -6 default limited kod nomodify notrap nopeer noquery
261
262restrict 127.0.0.1
263restrict ::1</literal>
264EOF</userinput></screen>
265
266 </sect3>
267
268 <sect3 id="ntp-init">
269 <title>Synchronizing the Time</title>
270
271 <para>
272 There are two options. Option one is to run <command>ntpd</command>
273 continuously and allow it to synchronize the time in a gradual manner.
274 The other option is to run <command>ntpd</command> periodically (using
275 cron) and update the time each time <command>ntpd</command> is
276 scheduled.
277 </para>
278
279 <para>
280 If you choose Option one, then install the
281 <phrase revision="sysv"><filename>/etc/rc.d/init.d/ntp</filename>
282 init script</phrase>
283 <phrase revision="systemd"><filename>ntpd.service</filename>
284 unit</phrase>
285 included in the
286 <xref linkend="bootscripts" revision="sysv"/>
287 <xref linkend="systemd-units" revision="systemd"/> package.
288 </para>
289
290 <indexterm zone="ntp ntp-init" revision="sysv">
291 <primary sortas="f-ntp">ntp</primary>
292 </indexterm>
293
294 <indexterm zone="ntp ntp-init" revision="systemd">
295 <primary sortas="f-ntpd">ntpd.service</primary>
296 </indexterm>
297
298<screen role="root"><userinput>make install-ntpd</userinput></screen>
299
300 <para>
301 If you prefer to run <command>ntpd</command> periodically, add the
302 following command to <systemitem class="username">root</systemitem>'s
303 <filename>crontab</filename>:
304 </para>
305
306<screen><literal>ntpd -q</literal></screen>
307
308 <para revision="sysv">
309 Execute the following command if you would like to set the hardware
310 clock to the current system time at shutdown and reboot:
311 </para>
312
313<screen role="root" revision="sysv"><userinput>ln -v -sf ../init.d/setclock /etc/rc.d/rc0.d/K46setclock &amp;&amp;
314ln -v -sf ../init.d/setclock /etc/rc.d/rc6.d/K46setclock</userinput></screen>
315
316 <para revision="sysv">
317 The other way around is already set up by LFS.
318 </para>
319
320 </sect3>
321
322 </sect2>
323
324 <sect2 role="content">
325 <title>Contents</title>
326
327 <segmentedlist>
328 <segtitle>Installed Programs</segtitle>
329 <segtitle>Installed Libraries</segtitle>
330 <segtitle>Installed Directories</segtitle>
331
332 <seglistitem>
333 <seg>calc_tickadj, ntp-keygen, ntp-wait, ntpd, ntpdate, ntpdc, ntpq,
334 ntptime, ntptrace, sntp, tickadj and update-leap</seg>
335 <seg>None</seg>
336 <seg>/usr/share/ntp,
337 /usr/share/doc/ntp-4.2.8 and
338 /var/lib/ntp</seg>
339 </seglistitem>
340 </segmentedlist>
341
342 <variablelist>
343 <bridgehead renderas="sect3">Short Descriptions</bridgehead>
344 <?dbfo list-presentation="list"?>
345 <?dbhtml list-presentation="table"?>
346
347 <varlistentry id="calc_tickadj">
348 <term><command>calc_tickadj</command></term>
349 <listitem>
350 <para>
351 calculates optimal value for tick given ntp drift file
352 </para>
353 <indexterm zone="ntp calc_tickadj">
354 <primary sortas="b-calc_tickadj">calc_tickadj</primary>
355 </indexterm>
356 </listitem>
357 </varlistentry>
358
359 <varlistentry id="ntp-keygen">
360 <term><command>ntp-keygen</command></term>
361 <listitem>
362 <para>
363 generates cryptographic data files used by the NTPv4 authentication
364 and identification schemes
365 </para>
366 <indexterm zone="ntp ntp-keygen">
367 <primary sortas="b-ntp-keygen">ntp-keygen</primary>
368 </indexterm>
369 </listitem>
370 </varlistentry>
371
372 <varlistentry id="ntp-wait">
373 <term><command>ntp-wait</command></term>
374 <listitem>
375 <para>
376 is useful at boot time, to delay the boot sequence until
377 <command>ntpd</command> has set the time
378 </para>
379 <indexterm zone="ntp ntp-wait">
380 <primary sortas="b-ntp-wait">ntp-wait</primary>
381 </indexterm>
382 </listitem>
383 </varlistentry>
384
385 <varlistentry id="ntpd">
386 <term><command>ntpd</command></term>
387 <listitem>
388 <para>
389 is a ntp daemon that runs in the background and keeps
390 the date and time synchronized based on response from configured
391 ntp servers. It also functions as a ntp server
392 </para>
393 <indexterm zone="ntp ntpd">
394 <primary sortas="b-ntpd">ntpd</primary>
395 </indexterm>
396 </listitem>
397 </varlistentry>
398
399 <varlistentry id="ntpdate">
400 <term><command>ntpdate</command></term>
401 <listitem>
402 <para>
403 is a client program that sets the date and time based on
404 the response from an ntp server. This command is deprecated
405 </para>
406 <indexterm zone="ntp ntpdate">
407 <primary sortas="b-ntpdate">ntpdate</primary>
408 </indexterm>
409 </listitem>
410 </varlistentry>
411
412 <varlistentry id="ntpdc">
413 <term><command>ntpdc</command></term>
414 <listitem>
415 <para>
416 is used to query the ntp daemon about its current state
417 and to request changes in that state
418 </para>
419 <indexterm zone="ntp ntpdc">
420 <primary sortas="b-ntpdc">ntpdc</primary>
421 </indexterm>
422 </listitem>
423 </varlistentry>
424
425 <varlistentry id="ntpq">
426 <term><command>ntpq</command></term>
427 <listitem>
428 <para>
429 is a utility program used to monitor <command>ntpd</command>
430 operations and determine performance
431 </para>
432 <indexterm zone="ntp ntpq">
433 <primary sortas="b-ntpq">ntpq</primary>
434 </indexterm>
435 </listitem>
436 </varlistentry>
437
438 <varlistentry id="ntptime">
439 <term><command>ntptime</command></term>
440 <listitem>
441 <para>
442 reads and displays time-related kernel variables
443 </para>
444 <indexterm zone="ntp ntptime">
445 <primary sortas="b-ntptime">ntptime</primary>
446 </indexterm>
447 </listitem>
448 </varlistentry>
449
450 <varlistentry id="ntptrace">
451 <term><command>ntptrace</command></term>
452 <listitem>
453 <para>
454 traces a chain of ntp servers back to the primary source
455 </para>
456 <indexterm zone="ntp ntptrace">
457 <primary sortas="b-ntptrace">ntptrace</primary>
458 </indexterm>
459 </listitem>
460 </varlistentry>
461
462 <varlistentry id="sntp">
463 <term><command>sntp</command></term>
464 <listitem>
465 <para>
466 is a Simple Network Time Protocol (SNTP) client
467 </para>
468 <indexterm zone="ntp sntp">
469 <primary sortas="b-sntp">sntp</primary>
470 </indexterm>
471 </listitem>
472 </varlistentry>
473
474 <varlistentry id="tickadj">
475 <term><command>tickadj</command></term>
476 <listitem>
477 <para>
478 reads, and optionally modifies, several timekeeping-related
479 variables in older kernels that do not have support for precision
480 timekeeping
481 </para>
482 <indexterm zone="ntp tickadj">
483 <primary sortas="b-tickadj">tickadj</primary>
484 </indexterm>
485 </listitem>
486 </varlistentry>
487
488 <varlistentry id="update-leap">
489 <term><command>update-leap</command></term>
490 <listitem>
491 <para>
492 is a script to verify and, if necessary, update the leap-second
493 definition file
494 </para>
495 <indexterm zone="ntp update-leap">
496 <primary sortas="b-update-leap">update-leap</primary>
497 </indexterm>
498 </listitem>
499 </varlistentry>
500
501 </variablelist>
502
503 </sect2>
504
505</sect1>
Note: See TracBrowser for help on using the repository browser.