source: networking/netprogs/ntp.xml@ 2b2ddc17

11.3 12.0 12.1 kea ken/TL2024 ken/inkscape-core-mods ken/tuningfonts lazarus lxqt plabs/newcss python3.11 qt5new rahul/power-profiles-daemon renodr/vulkan-addition trunk xry111/llvm18 xry111/xf86-video-removal
Last change on this file since 2b2ddc17 was 8761710, checked in by Xi Ruoyao <xry111@…>, 19 months ago

ntp: the test suite does not work for now

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