[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 "&gentoo-ftp-repo;/ntp-&ntp-version;.tar.gz">-->
|
---|
| 9 | <!ENTITY ntp-download-ftp " ">
|
---|
| 10 | <!ENTITY ntp-md5sum "65d8cdfae4722226fbe29863477641ed">
|
---|
[78b797d] | 11 | <!ENTITY ntp-size "6.5 MB">
|
---|
| 12 | <!ENTITY ntp-buildsize "59 MB">
|
---|
| 13 | <!ENTITY ntp-time "0.7 SBU">
|
---|
[d47e7ea9] | 14 | ]>
|
---|
| 15 |
|
---|
[286c613d] | 16 | <sect1 id="ntp" xreflabel="ntp-&ntp-version;">
|
---|
[dc6715a] | 17 | <?dbhtml filename="ntp.html"?>
|
---|
[56ab82c] | 18 |
|
---|
[dc6715a] | 19 | <sect1info>
|
---|
| 20 | <othername>$LastChangedBy$</othername>
|
---|
| 21 | <date>$Date$</date>
|
---|
| 22 | </sect1info>
|
---|
[56ab82c] | 23 |
|
---|
[286c613d] | 24 | <title>ntp-&ntp-version;</title>
|
---|
[56ab82c] | 25 |
|
---|
[dc6715a] | 26 | <indexterm zone="ntp">
|
---|
[286c613d] | 27 | <primary sortas="a-ntp">ntp</primary>
|
---|
[dc6715a] | 28 | </indexterm>
|
---|
| 29 |
|
---|
| 30 | <sect2 role="package">
|
---|
[286c613d] | 31 | <title>Introduction to ntp</title>
|
---|
[56ab82c] | 32 |
|
---|
[286c613d] | 33 | <para>The <application>ntp</application> package contains a
|
---|
[56ab82c] | 34 | client and server to keep the time synchronized between various computers over
|
---|
| 35 | a network. This package is the official reference implementation of the
|
---|
[dc6715a] | 36 | NTP protocol.</para>
|
---|
[56ab82c] | 37 |
|
---|
[56d38b8] | 38 | &lfs77_checked;
|
---|
[6564aa1] | 39 |
|
---|
[dc6715a] | 40 | <bridgehead renderas="sect3">Package Information</bridgehead>
|
---|
| 41 | <itemizedlist spacing="compact">
|
---|
| 42 | <listitem>
|
---|
| 43 | <para>Download (HTTP): <ulink url="&ntp-download-http;"/></para>
|
---|
| 44 | </listitem>
|
---|
| 45 | <listitem>
|
---|
| 46 | <para>Download (FTP): <ulink url="&ntp-download-ftp;"/></para>
|
---|
| 47 | </listitem>
|
---|
| 48 | <listitem>
|
---|
| 49 | <para>Download MD5 sum: &ntp-md5sum;</para>
|
---|
| 50 | </listitem>
|
---|
| 51 | <listitem>
|
---|
| 52 | <para>Download size: &ntp-size;</para>
|
---|
| 53 | </listitem>
|
---|
| 54 | <listitem>
|
---|
| 55 | <para>Estimated disk space required: &ntp-buildsize;</para>
|
---|
| 56 | </listitem>
|
---|
| 57 | <listitem>
|
---|
[2174baa] | 58 | <para>Estimated build time: &ntp-time;</para>
|
---|
| 59 | </listitem>
|
---|
[dc6715a] | 60 | </itemizedlist>
|
---|
[56ab82c] | 61 |
|
---|
[286c613d] | 62 | <bridgehead renderas="sect3">ntp Dependencies</bridgehead>
|
---|
[56ab82c] | 63 |
|
---|
[e3cbfaf] | 64 | <bridgehead renderas="sect4">Required</bridgehead>
|
---|
| 65 | <para role="required">
|
---|
| 66 | <xref linkend="which"/>
|
---|
| 67 | </para>
|
---|
| 68 |
|
---|
[dc6715a] | 69 | <bridgehead renderas="sect4">Optional</bridgehead>
|
---|
[03f32bb] | 70 | <para role="optional">
|
---|
[56605b9] | 71 | <xref linkend="libcap-pam"/>,
|
---|
[e3cbfaf] | 72 | <xref linkend="libevent"/>,
|
---|
| 73 | <xref linkend="openssl"/>,
|
---|
| 74 | <ulink url="http://www.thrysoee.dk/editline/">libedit</ulink>, and
|
---|
| 75 | <ulink url="https://www.gnu.org/software/autogen/">libopts from
|
---|
| 76 | AutoGen</ulink>
|
---|
[03f32bb] | 77 | </para>
|
---|
[56ab82c] | 78 |
|
---|
[061ec9d] | 79 | <para condition="html" role="usernotes">User Notes:
|
---|
| 80 | <ulink url="&blfs-wiki;/ntp"/></para>
|
---|
| 81 |
|
---|
[dc6715a] | 82 | </sect2>
|
---|
[56ab82c] | 83 |
|
---|
[dc6715a] | 84 | <sect2 role="installation">
|
---|
[286c613d] | 85 | <title>Installation of ntp</title>
|
---|
[dc6715a] | 86 |
|
---|
[e38cfca] | 87 | <para>
|
---|
| 88 | There should be a dedicated user and group to take control
|
---|
| 89 | of the <command>ntpd</command> daemon after it is
|
---|
| 90 | started. Issue the following commands as the
|
---|
| 91 | <systemitem class="username">root</systemitem> user:
|
---|
| 92 | </para>
|
---|
| 93 |
|
---|
| 94 | <screen role="root"><userinput>groupadd -g 87 ntp &&
|
---|
| 95 | useradd -c "Network Time Protocol" -d /var/lib/ntp -u 87 \
|
---|
| 96 | -g ntp -s /bin/false ntp</userinput></screen>
|
---|
| 97 |
|
---|
[286c613d] | 98 | <para>Install <application>ntp</application> by running
|
---|
[dc6715a] | 99 | the following commands:</para>
|
---|
| 100 |
|
---|
[f82ac3f] | 101 | <screen><userinput>./configure --prefix=/usr \
|
---|
[78b797d] | 102 | --bindir=/usr/sbin \
|
---|
[2dcc08c0] | 103 | --sysconfdir=/etc \
|
---|
| 104 | --enable-linuxcaps \
|
---|
[78b797d] | 105 | --with-lineeditlibs=readline \
|
---|
| 106 | --docdir=/usr/share/doc/ntp-&ntp-version; &&
|
---|
[11cf9f2] | 107 | make</userinput></screen>
|
---|
| 108 |
|
---|
| 109 | <para>To test the results, issue: <command>make check</command>.</para>
|
---|
[56ab82c] | 110 |
|
---|
[11cf9f2] | 111 | <para>Now, as the <systemitem class="username">root</systemitem> user:</para>
|
---|
[56ab82c] | 112 |
|
---|
[339fbfb9] | 113 | <screen role="root"><userinput>make install &&
|
---|
[78b797d] | 114 | install -v -o ntp -g ntp -d /var/lib/ntp</userinput></screen>
|
---|
[36474cb] | 115 |
|
---|
| 116 | </sect2>
|
---|
| 117 |
|
---|
| 118 | <sect2 role="commands">
|
---|
| 119 | <title>Command Explanations</title>
|
---|
| 120 |
|
---|
[78b797d] | 121 | <para><parameter>--bindir=/usr/sbin</parameter>: This parameter places
|
---|
[36474cb] | 122 | the administrative programs in <filename
|
---|
| 123 | class="directory">/usr/sbin</filename>.</para>
|
---|
[11cf9f2] | 124 |
|
---|
[2dcc08c0] | 125 | <para><parameter>--enable-linuxcaps</parameter>: ntpd is run as user
|
---|
| 126 | ntp, so use Linux capabilities for non-root clock control.</para>
|
---|
| 127 |
|
---|
[a01b1bf] | 128 | <para><option>--with-lineeditlibs=readline</option>: This option enables
|
---|
| 129 | <application>Readline</application> support for <command>ntpdc</command>
|
---|
| 130 | and <command>ntpq</command> programs. If omitted,
|
---|
| 131 | <application>libedit</application> will be used if installed, otherwise no
|
---|
| 132 | readline capabilites will be compiled.</para>
|
---|
| 133 |
|
---|
[dc6715a] | 134 | </sect2>
|
---|
[56ab82c] | 135 |
|
---|
[dc6715a] | 136 | <sect2 role="configuration">
|
---|
[286c613d] | 137 | <title>Configuring ntp</title>
|
---|
[56ab82c] | 138 |
|
---|
[dc6715a] | 139 | <sect3 id="ntp-config">
|
---|
| 140 | <title>Config Files</title>
|
---|
[56ab82c] | 141 |
|
---|
[dc6715a] | 142 | <para><filename>/etc/ntp.conf</filename></para>
|
---|
[56ab82c] | 143 |
|
---|
[dc6715a] | 144 | <indexterm zone="ntp ntp-config">
|
---|
| 145 | <primary sortas="e-etc-ntp.conf">/etc/ntp.conf</primary>
|
---|
| 146 | </indexterm>
|
---|
[56ab82c] | 147 |
|
---|
[dc6715a] | 148 | </sect3>
|
---|
[56ab82c] | 149 |
|
---|
[dc6715a] | 150 | <sect3>
|
---|
| 151 | <title>Configuration Information</title>
|
---|
| 152 |
|
---|
[286c613d] | 153 | <para>The following configuration file defines various ntp servers
|
---|
[a88b03e] | 154 | with open access from different continents. It also creates a
|
---|
| 155 | drift file where <command>ntpd</command> stores the frequency
|
---|
| 156 | offset and a pid file to store the <command>ntpd</command> process
|
---|
| 157 | ID. Since the documentation included with the package is sparse,
|
---|
[286c613d] | 158 | visit the ntp website at <ulink url="http://www.ntp.org/"/> and
|
---|
[a88b03e] | 159 | <ulink url="http://www.pool.ntp.org/"/> for more information.</para>
|
---|
[dc6715a] | 160 |
|
---|
| 161 | <screen role="root"><userinput>cat > /etc/ntp.conf << "EOF"
|
---|
[6e26273] | 162 | <literal># Asia
|
---|
[bca6dfb6] | 163 | server 0.asia.pool.ntp.org
|
---|
[d47e7ea9] | 164 |
|
---|
| 165 | # Australia
|
---|
[bca6dfb6] | 166 | server 0.oceania.pool.ntp.org
|
---|
[56ab82c] | 167 |
|
---|
[d47e7ea9] | 168 | # Europe
|
---|
[ea57941f] | 169 | server 0.europe.pool.ntp.org
|
---|
[d47e7ea9] | 170 |
|
---|
| 171 | # North America
|
---|
[ea57941f] | 172 | server 0.north-america.pool.ntp.org
|
---|
| 173 |
|
---|
| 174 | # South America
|
---|
[bca6dfb6] | 175 | server 2.south-america.pool.ntp.org
|
---|
[d47e7ea9] | 176 |
|
---|
[1e72251e] | 177 | driftfile /var/lib/ntp/ntp.drift
|
---|
[a5d7e29] | 178 | pidfile /var/run/ntpd.pid</literal>
|
---|
[78b797d] | 179 | EOF</userinput></screen>
|
---|
| 180 |
|
---|
[39159bf] | 181 | <para>
|
---|
| 182 | You may wish to add a <quote>Security session</quote>. For
|
---|
| 183 | explanations, see
|
---|
[f4a1b66] | 184 | <ulink url="https://www.eecis.udel.edu/~mills/ntp/html/accopt.html#restrict"/>.
|
---|
[39159bf] | 185 | </para>
|
---|
[78b797d] | 186 |
|
---|
| 187 | <screen role="root"><userinput>cat >> /etc/ntp.conf << "EOF"
|
---|
| 188 | <literal># Security session
|
---|
| 189 | restrict default limited kod nomodify notrap nopeer noquery
|
---|
| 190 | restrict -6 default limited kod nomodify notrap nopeer noquery
|
---|
| 191 |
|
---|
| 192 | restrict 127.0.0.1
|
---|
| 193 | restrict ::1</literal>
|
---|
[dc6715a] | 194 | EOF</userinput></screen>
|
---|
| 195 |
|
---|
| 196 | </sect3>
|
---|
[56ab82c] | 197 |
|
---|
[dc6715a] | 198 | <sect3 id="ntp-init">
|
---|
| 199 | <title>Synchronizing the Time</title>
|
---|
| 200 |
|
---|
| 201 | <para>There are two options. Option one is to run <command>ntpd</command>
|
---|
[56ab82c] | 202 | continuously and allow it to synchronize the time in a gradual manner. The
|
---|
[dc6715a] | 203 | other option is to run <command>ntpd</command> periodically (using cron)
|
---|
| 204 | and update the time each time <command>ntpd</command> is scheduled.</para>
|
---|
[56ab82c] | 205 |
|
---|
| 206 | <para>If you choose Option one, then install the
|
---|
[dc6715a] | 207 | <filename>/etc/rc.d/init.d/ntp</filename>
|
---|
| 208 | init script included in the
|
---|
[5254d12] | 209 | <xref linkend="bootscripts"/> package.</para>
|
---|
[56ab82c] | 210 |
|
---|
| 211 | <indexterm zone="ntp ntp-init">
|
---|
[dc6715a] | 212 | <primary sortas="f-ntp">ntp</primary>
|
---|
[56ab82c] | 213 | </indexterm>
|
---|
[dc6715a] | 214 |
|
---|
[286c613d] | 215 | <screen role="root"><userinput>make install-ntpd</userinput></screen>
|
---|
[dc6715a] | 216 |
|
---|
[56ab82c] | 217 | <para>If you prefer to run <command>ntpd</command> periodically, add the
|
---|
| 218 | following command to <systemitem class="username">root</systemitem>'s
|
---|
[dc6715a] | 219 | <filename>crontab</filename>:</para>
|
---|
[56ab82c] | 220 |
|
---|
[dc6715a] | 221 | <screen><literal>ntpd -q</literal></screen>
|
---|
| 222 |
|
---|
| 223 | <para>Execute the following command if you would like to set the
|
---|
[339fbfb9] | 224 | hardware clock to the current system time at shutdown and reboot:</para>
|
---|
[dc6715a] | 225 |
|
---|
[e3353b3] | 226 | <screen role="root"><userinput>ln -v -sf ../init.d/setclock /etc/rc.d/rc0.d/K46setclock &&
|
---|
| 227 | ln -v -sf ../init.d/setclock /etc/rc.d/rc6.d/K46setclock</userinput></screen>
|
---|
[dc6715a] | 228 |
|
---|
| 229 | <para>The other way around is already set up by LFS.</para>
|
---|
[56ab82c] | 230 |
|
---|
[dc6715a] | 231 | </sect3>
|
---|
[56ab82c] | 232 |
|
---|
[dc6715a] | 233 | </sect2>
|
---|
[56ab82c] | 234 |
|
---|
[dc6715a] | 235 | <sect2 role="content">
|
---|
| 236 | <title>Contents</title>
|
---|
[56ab82c] | 237 |
|
---|
[dc6715a] | 238 | <segmentedlist>
|
---|
| 239 | <segtitle>Installed Programs</segtitle>
|
---|
| 240 | <segtitle>Installed Libraries</segtitle>
|
---|
[78b797d] | 241 | <segtitle>Installed Directories</segtitle>
|
---|
[56ab82c] | 242 |
|
---|
[dc6715a] | 243 | <seglistitem>
|
---|
[78b797d] | 244 | <seg>calc_tickadj, ntp-keygen, ntp-wait, ntpd, ntpdate, ntpdc, ntpq,
|
---|
[36474cb] | 245 | ntptime, ntptrace, sntp and tickadj</seg>
|
---|
[dc6715a] | 246 | <seg>None</seg>
|
---|
[78b797d] | 247 | <seg>/usr/share/ntp,
|
---|
| 248 | /usr/share/doc/ntp-4.2.8 and
|
---|
| 249 | /var/lib/ntp</seg>
|
---|
[dc6715a] | 250 | </seglistitem>
|
---|
| 251 | </segmentedlist>
|
---|
[56ab82c] | 252 |
|
---|
[dc6715a] | 253 | <variablelist>
|
---|
| 254 | <bridgehead renderas="sect3">Short Descriptions</bridgehead>
|
---|
| 255 | <?dbfo list-presentation="list"?>
|
---|
| 256 | <?dbhtml list-presentation="table"?>
|
---|
[56ab82c] | 257 |
|
---|
[78b797d] | 258 | <varlistentry id="calc_tickadj">
|
---|
| 259 | <term><command>calc_tickadj</command></term>
|
---|
| 260 | <listitem>
|
---|
| 261 | <para>calculates optimal value for tick given ntp drift file.</para>
|
---|
| 262 | <indexterm zone="ntp calc_tickadj">
|
---|
| 263 | <primary sortas="b-calc_tickadj">calc_tickadj</primary>
|
---|
| 264 | </indexterm>
|
---|
| 265 | </listitem>
|
---|
| 266 | </varlistentry>
|
---|
| 267 |
|
---|
[dc6715a] | 268 | <varlistentry id="ntp-keygen">
|
---|
| 269 | <term><command>ntp-keygen</command></term>
|
---|
| 270 | <listitem>
|
---|
[56ab82c] | 271 | <para>generates cryptographic data files used by the NTPv4 authentication
|
---|
[dc6715a] | 272 | and identification schemes.</para>
|
---|
| 273 | <indexterm zone="ntp ntp-keygen">
|
---|
| 274 | <primary sortas="b-ntp-keygen">ntp-keygen</primary>
|
---|
| 275 | </indexterm>
|
---|
| 276 | </listitem>
|
---|
| 277 | </varlistentry>
|
---|
[56ab82c] | 278 |
|
---|
[dc6715a] | 279 | <varlistentry id="ntp-wait">
|
---|
| 280 | <term><command>ntp-wait</command></term>
|
---|
| 281 | <listitem>
|
---|
[56ab82c] | 282 | <para>is useful at boot time, to delay the boot sequence until
|
---|
[dc6715a] | 283 | <command>ntpd</command> has set the time.</para>
|
---|
| 284 | <indexterm zone="ntp ntp-wait">
|
---|
| 285 | <primary sortas="b-ntp-wait">ntp-wait</primary>
|
---|
| 286 | </indexterm>
|
---|
| 287 | </listitem>
|
---|
| 288 | </varlistentry>
|
---|
[56ab82c] | 289 |
|
---|
[dc6715a] | 290 | <varlistentry id="ntpd">
|
---|
| 291 | <term><command>ntpd</command></term>
|
---|
| 292 | <listitem>
|
---|
[286c613d] | 293 | <para>is a ntp daemon that runs in the background and keeps
|
---|
[56ab82c] | 294 | the date and time synchronized based on response from configured
|
---|
[286c613d] | 295 | ntp servers. It also functions as a ntp server.</para>
|
---|
[dc6715a] | 296 | <indexterm zone="ntp ntpd">
|
---|
| 297 | <primary sortas="b-ntpd">ntpd</primary>
|
---|
| 298 | </indexterm>
|
---|
| 299 | </listitem>
|
---|
| 300 | </varlistentry>
|
---|
[56ab82c] | 301 |
|
---|
[dc6715a] | 302 | <varlistentry id="ntpdate">
|
---|
| 303 | <term><command>ntpdate</command></term>
|
---|
| 304 | <listitem>
|
---|
[56ab82c] | 305 | <para>is a client program that sets the date and time based on
|
---|
[286c613d] | 306 | the response from an ntp server. This command is deprecated.</para>
|
---|
[dc6715a] | 307 | <indexterm zone="ntp ntpdate">
|
---|
| 308 | <primary sortas="b-ntpdate">ntpdate</primary>
|
---|
| 309 | </indexterm>
|
---|
| 310 | </listitem>
|
---|
| 311 | </varlistentry>
|
---|
[56ab82c] | 312 |
|
---|
[dc6715a] | 313 | <varlistentry id="ntpdc">
|
---|
| 314 | <term><command>ntpdc</command></term>
|
---|
| 315 | <listitem>
|
---|
[286c613d] | 316 | <para>is used to query the ntp daemon about its current state
|
---|
[dc6715a] | 317 | and to request changes in that state.</para>
|
---|
| 318 | <indexterm zone="ntp ntpdc">
|
---|
| 319 | <primary sortas="b-ntpdc">ntpdc</primary>
|
---|
| 320 | </indexterm>
|
---|
| 321 | </listitem>
|
---|
| 322 | </varlistentry>
|
---|
[56ab82c] | 323 |
|
---|
[dc6715a] | 324 | <varlistentry id="ntpq">
|
---|
| 325 | <term><command>ntpq</command></term>
|
---|
| 326 | <listitem>
|
---|
[56ab82c] | 327 | <para>is an utility program used to monitor <command>ntpd</command>
|
---|
[dc6715a] | 328 | operations and determine performance.</para>
|
---|
| 329 | <indexterm zone="ntp ntpq">
|
---|
| 330 | <primary sortas="b-ntpq">ntpq</primary>
|
---|
| 331 | </indexterm>
|
---|
| 332 | </listitem>
|
---|
| 333 | </varlistentry>
|
---|
[56ab82c] | 334 |
|
---|
[dc6715a] | 335 | <varlistentry id="ntptime">
|
---|
| 336 | <term><command>ntptime</command></term>
|
---|
| 337 | <listitem>
|
---|
| 338 | <para>reads and displays time-related kernel variables.</para>
|
---|
| 339 | <indexterm zone="ntp ntptime">
|
---|
| 340 | <primary sortas="b-ntptime">ntptime</primary>
|
---|
| 341 | </indexterm>
|
---|
| 342 | </listitem>
|
---|
| 343 | </varlistentry>
|
---|
[56ab82c] | 344 |
|
---|
[dc6715a] | 345 | <varlistentry id="ntptrace">
|
---|
| 346 | <term><command>ntptrace</command></term>
|
---|
| 347 | <listitem>
|
---|
[286c613d] | 348 | <para>traces a chain of ntp servers back to the primary source.</para>
|
---|
[dc6715a] | 349 | <indexterm zone="ntp ntptrace">
|
---|
[56ab82c] | 350 | <primary sortas="b-ntptrace">ntptrace</primary>
|
---|
[dc6715a] | 351 | </indexterm>
|
---|
| 352 | </listitem>
|
---|
| 353 | </varlistentry>
|
---|
[56ab82c] | 354 |
|
---|
[36474cb] | 355 | <varlistentry id="sntp">
|
---|
| 356 | <term><command>sntp</command></term>
|
---|
| 357 | <listitem>
|
---|
| 358 | <para>is a Simple Network Time Protocol (SNTP) client.</para>
|
---|
| 359 | <indexterm zone="ntp sntp">
|
---|
| 360 | <primary sortas="b-sntp">sntp</primary>
|
---|
| 361 | </indexterm>
|
---|
| 362 | </listitem>
|
---|
| 363 | </varlistentry>
|
---|
| 364 |
|
---|
[dc6715a] | 365 | <varlistentry id="tickadj">
|
---|
| 366 | <term><command>tickadj</command></term>
|
---|
| 367 | <listitem>
|
---|
[56ab82c] | 368 | <para>reads, and optionally modifies, several timekeeping-related
|
---|
| 369 | variables in older kernels that do not have support for precision
|
---|
[dc6715a] | 370 | timekeeping.</para>
|
---|
| 371 | <indexterm zone="ntp tickadj">
|
---|
| 372 | <primary sortas="b-tickadj">tickadj</primary>
|
---|
| 373 | </indexterm>
|
---|
| 374 | </listitem>
|
---|
| 375 | </varlistentry>
|
---|
[56ab82c] | 376 |
|
---|
[dc6715a] | 377 | </variablelist>
|
---|
[56ab82c] | 378 |
|
---|
[dc6715a] | 379 | </sect2>
|
---|
[56ab82c] | 380 |
|
---|
[39f01ca] | 381 | </sect1>
|
---|