source: networking/netprogs/ntp.xml@ 45029cb

10.0 10.1 11.0 11.1 11.2 11.3 12.0 12.1 8.2 8.3 8.4 9.0 9.1 basic bdubbs/svn elogind kea ken/TL2024 ken/inkscape-core-mods ken/tuningfonts lazarus lxqt perl-modules 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 45029cb was 45029cb, checked in by Pierre Labastie <pieere@…>, 7 years ago

role="runtime" in networking

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

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