source: networking/netprogs/ntp.xml@ 6c183b5

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 6c183b5 was 6c183b5, checked in by Pierre Labastie <pieere@…>, 4 years ago

Add user CFLAGS to CFLAGS=-fcommon

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

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