source: networking/netprogs/ntp.xml@ 0d0f150

10.0 10.1 11.0 11.1 11.2 8.4 9.0 9.1 bdubbs/svn elogind lazarus plabs/python-mods qt5new trunk upgradedb xry111/intltool xry111/soup3 xry111/test-20220226
Last change on this file since 0d0f150 was 0d0f150, checked in by Ken Moffat <ken@…>, 4 years ago

Trunk: use system certificates with perl modules.

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

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