source: networking/netprogs/ntp.xml@ fa5f6e9

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 fa5f6e9 was a99fd228, checked in by Bruce Dubbs <bdubbs@…>, 9 months ago

Removed most references to the update-leap script in ntp.

  • Property mode set to 100644
File size: 15.8 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 " ">
[8c2e1c4]9 <!ENTITY ntp-md5sum "a15558df580bd1b955a105a8b91c078f">
[5bdf4ce]10 <!ENTITY ntp-size "6.8 MB">
[8c2e1c4]11 <!ENTITY ntp-buildsize "99 MB (with tests)">
[5bdf4ce]12 <!ENTITY ntp-time "0.8 SBU (With tests; both using parallelism=4)">
[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
[2314cd7]35 &lfs120_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
[42ddc30]96 <para condition="html" role="usernotes">Editor Notes:
[061ec9d]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
[a99fd228]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
[b3dc2ba]121 <para>
122 The <command>update-leap</command> command needs to be fixed in order
123 to run properly:
124 </para>
125
[77882028]126<screen><userinput>sed -e 's/"(\\S+)"/"?([^\\s"]+)"?/' \
[b3dc2ba]127 -i scripts/update-leap/update-leap.in</userinput></screen>
[a99fd228]128-->
[ab7470e]129
[b3dc2ba]130 <para>
131 Install <application>ntp</application> by running
132 the following commands:
133 </para>
[dc6715a]134
[544939d]135<screen><userinput>./configure --prefix=/usr \
[78b797d]136 --bindir=/usr/sbin \
[2dcc08c0]137 --sysconfdir=/etc \
138 --enable-linuxcaps \
[78b797d]139 --with-lineeditlibs=readline \
140 --docdir=/usr/share/doc/ntp-&ntp-version; &amp;&amp;
[11cf9f2]141make</userinput></screen>
142
[b3dc2ba]143 <para>
144 To test the results, issue: <command>make check</command>.
145 </para>
[56ab82c]146
[b3dc2ba]147 <para>
148 Now, as the <systemitem class="username">root</systemitem> user:
149 </para>
[56ab82c]150
[339fbfb9]151<screen role="root"><userinput>make install &amp;&amp;
[78b797d]152install -v -o ntp -g ntp -d /var/lib/ntp</userinput></screen>
[36474cb]153
154 </sect2>
155
156 <sect2 role="commands">
157 <title>Command Explanations</title>
158
[b51fe6e]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>
[eecae1f9]164
[b51fe6e]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>
[11cf9f2]170
[b51fe6e]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>
[2dcc08c0]175
[b51fe6e]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
[2c87187]181 readline capabilities will be compiled.
[b51fe6e]182 </para>
[a01b1bf]183
[dc6715a]184 </sect2>
[56ab82c]185
[dc6715a]186 <sect2 role="configuration">
[286c613d]187 <title>Configuring ntp</title>
[56ab82c]188
[dc6715a]189 <sect3 id="ntp-config">
190 <title>Config Files</title>
[56ab82c]191
[b51fe6e]192 <para>
193 <filename>/etc/ntp.conf</filename>
194 </para>
[56ab82c]195
[dc6715a]196 <indexterm zone="ntp ntp-config">
197 <primary sortas="e-etc-ntp.conf">/etc/ntp.conf</primary>
198 </indexterm>
[56ab82c]199
[dc6715a]200 </sect3>
[56ab82c]201
[dc6715a]202 <sect3>
203 <title>Configuration Information</title>
204
[b51fe6e]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
[a99fd228]210 <command>ntpd</command> process ID. <!--Third, it defines the location
[b51fe6e]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
[a99fd228]216 about three weeks for the updates.--> Since the documentation included
[b51fe6e]217 with the package is sparse, visit the ntp website at
[75e3e09]218 <ulink url="https://www.ntp.org/"/> and
219 <ulink url="https://www.ntppool.org/"/> for more information.
[b51fe6e]220 </para>
[dc6715a]221
222<screen role="root"><userinput>cat &gt; /etc/ntp.conf &lt;&lt; "EOF"
[6e26273]223<literal># Asia
[bca6dfb6]224server 0.asia.pool.ntp.org
[d47e7ea9]225
226# Australia
[bca6dfb6]227server 0.oceania.pool.ntp.org
[56ab82c]228
[d47e7ea9]229# Europe
[ea57941f]230server 0.europe.pool.ntp.org
[d47e7ea9]231
232# North America
[ea57941f]233server 0.north-america.pool.ntp.org
234
235# South America
[bca6dfb6]236server 2.south-america.pool.ntp.org
[d47e7ea9]237
[1e72251e]238driftfile /var/lib/ntp/ntp.drift
[a99fd228]239pidfile /run/ntpd.pid</literal>
[78b797d]240EOF</userinput></screen>
241
[39159bf]242 <para>
243 You may wish to add a <quote>Security session</quote>. For
[b51fe6e]244 explanations, see <ulink url=
245 "https://www.eecis.udel.edu/~mills/ntp/html/accopt.html#restrict"/>.
[39159bf]246 </para>
[78b797d]247
248<screen role="root"><userinput>cat &gt;&gt; /etc/ntp.conf &lt;&lt; "EOF"
249<literal># Security session
[e5bb823]250restrict default limited kod nomodify notrap nopeer noquery
[78b797d]251restrict -6 default limited kod nomodify notrap nopeer noquery
252
253restrict 127.0.0.1
254restrict ::1</literal>
[dc6715a]255EOF</userinput></screen>
256
257 </sect3>
[56ab82c]258
[dc6715a]259 <sect3 id="ntp-init">
260 <title>Synchronizing the Time</title>
261
[b51fe6e]262 <para>
263 There are two options. Option one is to run <command>ntpd</command>
264 continuously and allow it to synchronize the time in a gradual manner.
265 The other option is to run <command>ntpd</command> periodically (using
266 cron) and update the time each time <command>ntpd</command> is
267 scheduled.
268 </para>
[56ab82c]269
[b51fe6e]270 <para>
271 If you choose Option one, then install the
272 <phrase revision="sysv"><filename>/etc/rc.d/init.d/ntp</filename>
273 init script</phrase>
274 <phrase revision="systemd"><filename>ntpd.service</filename>
275 unit</phrase>
276 included in the
277 <xref linkend="bootscripts" revision="sysv"/>
278 <xref linkend="systemd-units" revision="systemd"/> package.
279 </para>
[56ab82c]280
[7b478500]281 <indexterm zone="ntp ntp-init" revision="sysv">
[dc6715a]282 <primary sortas="f-ntp">ntp</primary>
[56ab82c]283 </indexterm>
[dc6715a]284
[7b478500]285 <indexterm zone="ntp ntp-init" revision="systemd">
286 <primary sortas="f-ntpd">ntpd.service</primary>
287 </indexterm>
288
[286c613d]289<screen role="root"><userinput>make install-ntpd</userinput></screen>
[dc6715a]290
[b51fe6e]291 <para>
292 If you prefer to run <command>ntpd</command> periodically, add the
293 following command to <systemitem class="username">root</systemitem>'s
294 <filename>crontab</filename>:
295 </para>
[56ab82c]296
[dc6715a]297<screen><literal>ntpd -q</literal></screen>
298
[b51fe6e]299 <para revision="sysv">
300 Execute the following command if you would like to set the hardware
301 clock to the current system time at shutdown and reboot:
302 </para>
[dc6715a]303
[7b478500]304<screen role="root" revision="sysv"><userinput>ln -v -sf ../init.d/setclock /etc/rc.d/rc0.d/K46setclock &amp;&amp;
[e3353b3]305ln -v -sf ../init.d/setclock /etc/rc.d/rc6.d/K46setclock</userinput></screen>
[dc6715a]306
[b51fe6e]307 <para revision="sysv">
308 The other way around is already set up by LFS.
309 </para>
[56ab82c]310
[dc6715a]311 </sect3>
[56ab82c]312
[dc6715a]313 </sect2>
[56ab82c]314
[dc6715a]315 <sect2 role="content">
316 <title>Contents</title>
[56ab82c]317
[dc6715a]318 <segmentedlist>
319 <segtitle>Installed Programs</segtitle>
320 <segtitle>Installed Libraries</segtitle>
[78b797d]321 <segtitle>Installed Directories</segtitle>
[56ab82c]322
[dc6715a]323 <seglistitem>
[78b797d]324 <seg>calc_tickadj, ntp-keygen, ntp-wait, ntpd, ntpdate, ntpdc, ntpq,
[a99fd228]325 ntptime, ntptrace, sntp, tickadj, and update-leap</seg>
[dc6715a]326 <seg>None</seg>
[78b797d]327 <seg>/usr/share/ntp,
328 /usr/share/doc/ntp-4.2.8 and
329 /var/lib/ntp</seg>
[dc6715a]330 </seglistitem>
331 </segmentedlist>
[56ab82c]332
[dc6715a]333 <variablelist>
334 <bridgehead renderas="sect3">Short Descriptions</bridgehead>
335 <?dbfo list-presentation="list"?>
336 <?dbhtml list-presentation="table"?>
[56ab82c]337
[78b797d]338 <varlistentry id="calc_tickadj">
339 <term><command>calc_tickadj</command></term>
340 <listitem>
[b51fe6e]341 <para>
[4c24eb0a]342 calculates optimal value for tick given ntp drift file
[b51fe6e]343 </para>
[78b797d]344 <indexterm zone="ntp calc_tickadj">
345 <primary sortas="b-calc_tickadj">calc_tickadj</primary>
346 </indexterm>
347 </listitem>
348 </varlistentry>
349
[dc6715a]350 <varlistentry id="ntp-keygen">
351 <term><command>ntp-keygen</command></term>
352 <listitem>
[b51fe6e]353 <para>
354 generates cryptographic data files used by the NTPv4 authentication
[4c24eb0a]355 and identification schemes
[b51fe6e]356 </para>
[dc6715a]357 <indexterm zone="ntp ntp-keygen">
358 <primary sortas="b-ntp-keygen">ntp-keygen</primary>
359 </indexterm>
360 </listitem>
361 </varlistentry>
[56ab82c]362
[dc6715a]363 <varlistentry id="ntp-wait">
364 <term><command>ntp-wait</command></term>
365 <listitem>
[b51fe6e]366 <para>
367 is useful at boot time, to delay the boot sequence until
[4c24eb0a]368 <command>ntpd</command> has set the time
[b51fe6e]369 </para>
[dc6715a]370 <indexterm zone="ntp ntp-wait">
371 <primary sortas="b-ntp-wait">ntp-wait</primary>
372 </indexterm>
373 </listitem>
374 </varlistentry>
[56ab82c]375
[dc6715a]376 <varlistentry id="ntpd">
377 <term><command>ntpd</command></term>
378 <listitem>
[b51fe6e]379 <para>
380 is a ntp daemon that runs in the background and keeps
381 the date and time synchronized based on response from configured
[4c24eb0a]382 ntp servers. It also functions as a ntp server
[b51fe6e]383 </para>
[dc6715a]384 <indexterm zone="ntp ntpd">
385 <primary sortas="b-ntpd">ntpd</primary>
386 </indexterm>
387 </listitem>
388 </varlistentry>
[56ab82c]389
[dc6715a]390 <varlistentry id="ntpdate">
391 <term><command>ntpdate</command></term>
392 <listitem>
[b51fe6e]393 <para>
394 is a client program that sets the date and time based on
[4c24eb0a]395 the response from an ntp server. This command is deprecated
[b51fe6e]396 </para>
[dc6715a]397 <indexterm zone="ntp ntpdate">
398 <primary sortas="b-ntpdate">ntpdate</primary>
399 </indexterm>
400 </listitem>
401 </varlistentry>
[56ab82c]402
[dc6715a]403 <varlistentry id="ntpdc">
404 <term><command>ntpdc</command></term>
405 <listitem>
[b51fe6e]406 <para>
407 is used to query the ntp daemon about its current state
[4c24eb0a]408 and to request changes in that state
[b51fe6e]409 </para>
[dc6715a]410 <indexterm zone="ntp ntpdc">
411 <primary sortas="b-ntpdc">ntpdc</primary>
412 </indexterm>
413 </listitem>
414 </varlistentry>
[56ab82c]415
[dc6715a]416 <varlistentry id="ntpq">
417 <term><command>ntpq</command></term>
418 <listitem>
[b51fe6e]419 <para>
420 is a utility program used to monitor <command>ntpd</command>
[4c24eb0a]421 operations and determine performance
[b51fe6e]422 </para>
[dc6715a]423 <indexterm zone="ntp ntpq">
424 <primary sortas="b-ntpq">ntpq</primary>
425 </indexterm>
426 </listitem>
427 </varlistentry>
[56ab82c]428
[dc6715a]429 <varlistentry id="ntptime">
430 <term><command>ntptime</command></term>
431 <listitem>
[b51fe6e]432 <para>
[4c24eb0a]433 reads and displays time-related kernel variables
[b51fe6e]434 </para>
[dc6715a]435 <indexterm zone="ntp ntptime">
436 <primary sortas="b-ntptime">ntptime</primary>
437 </indexterm>
438 </listitem>
439 </varlistentry>
[56ab82c]440
[dc6715a]441 <varlistentry id="ntptrace">
442 <term><command>ntptrace</command></term>
443 <listitem>
[b51fe6e]444 <para>
[4c24eb0a]445 traces a chain of ntp servers back to the primary source
[b51fe6e]446 </para>
[dc6715a]447 <indexterm zone="ntp ntptrace">
[56ab82c]448 <primary sortas="b-ntptrace">ntptrace</primary>
[dc6715a]449 </indexterm>
450 </listitem>
451 </varlistentry>
[56ab82c]452
[36474cb]453 <varlistentry id="sntp">
454 <term><command>sntp</command></term>
455 <listitem>
[b51fe6e]456 <para>
[4c24eb0a]457 is a Simple Network Time Protocol (SNTP) client
[b51fe6e]458 </para>
[36474cb]459 <indexterm zone="ntp sntp">
460 <primary sortas="b-sntp">sntp</primary>
461 </indexterm>
462 </listitem>
463 </varlistentry>
464
[dc6715a]465 <varlistentry id="tickadj">
466 <term><command>tickadj</command></term>
467 <listitem>
[b51fe6e]468 <para>
469 reads, and optionally modifies, several timekeeping-related
470 variables in older kernels that do not have support for precision
[4c24eb0a]471 timekeeping
[b51fe6e]472 </para>
[dc6715a]473 <indexterm zone="ntp tickadj">
474 <primary sortas="b-tickadj">tickadj</primary>
475 </indexterm>
476 </listitem>
477 </varlistentry>
[56ab82c]478
[ab6a3f3]479 <varlistentry id="update-leap">
480 <term><command>update-leap</command></term>
481 <listitem>
[b51fe6e]482 <para>
483 is a script to verify and, if necessary, update the leap-second
[a99fd228]484 definition file.
485
486 <note>
487 <para>
488 In November 2022, at the 27th General Conference on Weights and
489 Measures, it was decided to abandon the leap second. In addition
490 this script hardcodes a URL for an update file that no longer
491 exists. The last time a leap second was declared was January 2017.
492 This script will probably be removed in a future release.
493 </para>
494 </note>
[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.