source: networking/netprogs/ntp.xml@ ce8d2890

10.0 10.1 11.0 11.1 11.2 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 upgradedb xry111/intltool xry111/llvm18 xry111/soup3 xry111/test-20220226 xry111/xf86-video-removal
Last change on this file since ce8d2890 was b51fe6e, checked in by Pierre Labastie <pieere@…>, 4 years ago

Format netprogs

git-svn-id: svn://svn.linuxfromscratch.org/BLFS/trunk/BOOK@22874 af4574ff-66df-0310-9fd7-8a98e5e911e0

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