source: networking/netprogs/ntp.xml@ 3f2db3a6

11.3 12.0 12.1 kea ken/TL2024 ken/inkscape-core-mods ken/tuningfonts lazarus lxqt plabs/newcss plabs/python-mods python3.11 qt5new rahul/power-profiles-daemon renodr/vulkan-addition trunk xry111/llvm18 xry111/xf86-video-removal
Last change on this file since 3f2db3a6 was 3f2db3a6, checked in by Pierre Labastie <pierre.labastie@…>, 17 months ago

Remove sect1info tags

They only contain a date tag that is nowhere used.

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