source: networking/netprogs/ntp.xml@ 6397333

basic
Last change on this file since 6397333 was 6397333, checked in by Bruce Dubbs <bdubbs@…>, 6 years ago

Convert internal like to external links for BLFS packages not in
the Basic book.

Reorder some chapters.

Merge System V and systemd sections so both are always displayed
with proper attribution for system type.

git-svn-id: svn://svn.linuxfromscratch.org/BLFS/branches/basic@20524 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-lwp-protocol-https"/>
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 <ulink url="&blfs-book;postlfs/libcap.html">libcap with PAM</ulink>,
81 <ulink url="&blfs-book;basicnet/libevent.html">libevent</ulink>,
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 <filename>/etc/rc.d/init.d/ntp</filename>
245 init script (System V based systems) or the
246 <filename>ntpd.service</filename> unit (systemd based systems)
247 included in the
248 <xref linkend="bootscripts"/> or
249 <xref linkend="systemd-units"/> packages respectively.</para>
250
251 <indexterm zone="ntp ntp-init">
252 <primary sortas="f-ntp">ntp</primary>
253 </indexterm>
254
255 <indexterm zone="ntp ntp-init">
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>For System V systems, 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"><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>The other way around is already set up by LFS.</para>
275
276 </sect3>
277
278 </sect2>
279
280 <sect2 role="content">
281 <title>Contents</title>
282
283 <segmentedlist>
284 <segtitle>Installed Programs</segtitle>
285 <segtitle>Installed Libraries</segtitle>
286 <segtitle>Installed Directories</segtitle>
287
288 <seglistitem>
289 <seg>calc_tickadj, ntp-keygen, ntp-wait, ntpd, ntpdate, ntpdc, ntpq,
290 ntptime, ntptrace, sntp, tickadj and update-leap</seg>
291 <seg>None</seg>
292 <seg>/usr/share/ntp,
293 /usr/share/doc/ntp-4.2.8 and
294 /var/lib/ntp</seg>
295 </seglistitem>
296 </segmentedlist>
297
298 <variablelist>
299 <bridgehead renderas="sect3">Short Descriptions</bridgehead>
300 <?dbfo list-presentation="list"?>
301 <?dbhtml list-presentation="table"?>
302
303 <varlistentry id="calc_tickadj">
304 <term><command>calc_tickadj</command></term>
305 <listitem>
306 <para>calculates optimal value for tick given ntp drift file.</para>
307 <indexterm zone="ntp calc_tickadj">
308 <primary sortas="b-calc_tickadj">calc_tickadj</primary>
309 </indexterm>
310 </listitem>
311 </varlistentry>
312
313 <varlistentry id="ntp-keygen">
314 <term><command>ntp-keygen</command></term>
315 <listitem>
316 <para>generates cryptographic data files used by the NTPv4 authentication
317 and identification schemes.</para>
318 <indexterm zone="ntp ntp-keygen">
319 <primary sortas="b-ntp-keygen">ntp-keygen</primary>
320 </indexterm>
321 </listitem>
322 </varlistentry>
323
324 <varlistentry id="ntp-wait">
325 <term><command>ntp-wait</command></term>
326 <listitem>
327 <para>is useful at boot time, to delay the boot sequence until
328 <command>ntpd</command> has set the time.</para>
329 <indexterm zone="ntp ntp-wait">
330 <primary sortas="b-ntp-wait">ntp-wait</primary>
331 </indexterm>
332 </listitem>
333 </varlistentry>
334
335 <varlistentry id="ntpd">
336 <term><command>ntpd</command></term>
337 <listitem>
338 <para>is a ntp daemon that runs in the background and keeps
339 the date and time synchronized based on response from configured
340 ntp servers. It also functions as a ntp server.</para>
341 <indexterm zone="ntp ntpd">
342 <primary sortas="b-ntpd">ntpd</primary>
343 </indexterm>
344 </listitem>
345 </varlistentry>
346
347 <varlistentry id="ntpdate">
348 <term><command>ntpdate</command></term>
349 <listitem>
350 <para>is a client program that sets the date and time based on
351 the response from an ntp server. This command is deprecated.</para>
352 <indexterm zone="ntp ntpdate">
353 <primary sortas="b-ntpdate">ntpdate</primary>
354 </indexterm>
355 </listitem>
356 </varlistentry>
357
358 <varlistentry id="ntpdc">
359 <term><command>ntpdc</command></term>
360 <listitem>
361 <para>is used to query the ntp daemon about its current state
362 and to request changes in that state.</para>
363 <indexterm zone="ntp ntpdc">
364 <primary sortas="b-ntpdc">ntpdc</primary>
365 </indexterm>
366 </listitem>
367 </varlistentry>
368
369 <varlistentry id="ntpq">
370 <term><command>ntpq</command></term>
371 <listitem>
372 <para>is a utility program used to monitor <command>ntpd</command>
373 operations and determine performance.</para>
374 <indexterm zone="ntp ntpq">
375 <primary sortas="b-ntpq">ntpq</primary>
376 </indexterm>
377 </listitem>
378 </varlistentry>
379
380 <varlistentry id="ntptime">
381 <term><command>ntptime</command></term>
382 <listitem>
383 <para>reads and displays time-related kernel variables.</para>
384 <indexterm zone="ntp ntptime">
385 <primary sortas="b-ntptime">ntptime</primary>
386 </indexterm>
387 </listitem>
388 </varlistentry>
389
390 <varlistentry id="ntptrace">
391 <term><command>ntptrace</command></term>
392 <listitem>
393 <para>traces a chain of ntp servers back to the primary source.</para>
394 <indexterm zone="ntp ntptrace">
395 <primary sortas="b-ntptrace">ntptrace</primary>
396 </indexterm>
397 </listitem>
398 </varlistentry>
399
400 <varlistentry id="sntp">
401 <term><command>sntp</command></term>
402 <listitem>
403 <para>is a Simple Network Time Protocol (SNTP) client.</para>
404 <indexterm zone="ntp sntp">
405 <primary sortas="b-sntp">sntp</primary>
406 </indexterm>
407 </listitem>
408 </varlistentry>
409
410 <varlistentry id="tickadj">
411 <term><command>tickadj</command></term>
412 <listitem>
413 <para>reads, and optionally modifies, several timekeeping-related
414 variables in older kernels that do not have support for precision
415 timekeeping.</para>
416 <indexterm zone="ntp tickadj">
417 <primary sortas="b-tickadj">tickadj</primary>
418 </indexterm>
419 </listitem>
420 </varlistentry>
421
422 <varlistentry id="update-leap">
423 <term><command>update-leap</command></term>
424 <listitem>
425 <para>is a script to verify and, if necessary, update the leap-second
426 definition file.</para>
427 <indexterm zone="ntp update-leap">
428 <primary sortas="b-update-leap">update-leap</primary>
429 </indexterm>
430 </listitem>
431 </varlistentry>
432
433 </variablelist>
434
435 </sect2>
436
437</sect1>
Note: See TracBrowser for help on using the repository browser.