Introduction to ntp
The ntp package contains a client
and server to keep the time synchronized between various computers
over a network. This package is the official reference
implementation of the NTP protocol.
This package is known to build and work properly using an LFS-7.5
libcap-2.24 with PAM, OpenSSL-1.0.1i, and libedit
User Notes: http://wiki.linuxfromscratch.org/blfs/wiki/ntp
Installation of ntp
There should be a dedicated user and group to take control of the
ntpd daemon after it
is started. Issue the following commands as the
groupadd -g 87 ntp &&
useradd -c "Network Time Protocol" -d /var/lib/ntp -u 87 \
-g ntp -s /bin/false ntp
Install ntp by running the
./configure --prefix=/usr \
To test the results, issue: make
Now, as the
make install &&
install -v -o ntp -g ntp -d /var/lib/ntp &&
install -v -m755 -d /usr/share/doc/ntp-4.2.6p5 &&
cp -v -R html/* /usr/share/doc/ntp-4.2.6p5/
parameter places the administrative programs in
--enable-linuxcaps: ntpd is
run as user ntp, so use Linux capabilities for non-root clock
option enables Readline support
for ntpdc and
ntpq programs. If
omitted, libedit will be used if
installed, otherwise no readline capabilites will be compiled.
The following configuration file defines various ntp servers with
open access from different continents. It also creates a drift
file where ntpd
stores the frequency offset and a pid file to store the
ntpd process ID.
Since the documentation included with the package is sparse,
visit the ntp website at http://www.ntp.org/ and http://www.pool.ntp.org/ for more
cat > /etc/ntp.conf << "EOF"
# North America
# South America
Synchronizing the Time
There are two options. Option one is to run ntpd continuously and allow it
to synchronize the time in a gradual manner. The other option is
to run ntpd
periodically (using cron) and update the time each time
ntpd is scheduled.
If you choose Option one, then install the
/etc/rc.d/init.d/ntp init script included in
the blfs-bootscripts-20140827 package.
If you prefer to run ntpd periodically, add the
following command to
Execute the following command if you would like to set the
hardware clock to the current system time at shutdown and reboot:
ln -v -sf ../init.d/setclock /etc/rc.d/rc0.d/K46setclock &&
ln -v -sf ../init.d/setclock /etc/rc.d/rc6.d/K46setclock
The other way around is already set up by LFS.
ntp-keygen, ntp-wait, ntpd, ntpdate,
ntpdc, ntpq, ntptime, ntptrace, sntp and tickadj
generates cryptographic data files used by the NTPv4
authentication and identification schemes.
is useful at boot time, to delay the boot sequence until
set the time.
is a ntp daemon that runs in the background and keeps the
date and time synchronized based on response from
configured ntp servers. It also functions as a ntp
is a client program that sets the date and time based on
the response from an ntp server. This command is
is used to query the ntp daemon about its current state
and to request changes in that state.
is an utility program used to monitor ntpd operations and
reads and displays time-related kernel variables.
traces a chain of ntp servers back to the primary source.
is a Simple Network Time Protocol (SNTP) client.
reads, and optionally modifies, several
timekeeping-related variables in older kernels that do
not have support for precision timekeeping.
Last updated on 2014-04-28 21:13:36 +0000