Difference between revisions of "NTP"

From CBLFS
Jump to navigationJump to search
(I updated the "Configuring" section with information about crontab.)
 
(12 intermediate revisions by 6 users not shown)
Line 2: Line 2:
 
|-valign="top"
 
|-valign="top"
 
!Download Source:
 
!Download Source:
| http://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ntp-{{NTP-Version}}.tar.gz
+
| http://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ntp-4.2/ntp-{{NTP-Version}}.tar.gz
 
|}
 
|}
  
 
----
 
----
  
== Introduction to NTP ==
+
{{Package-Introduction|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.|http://www.ntp.org/}}
 
 
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.
 
 
 
'''Project Home Page''': http://www.ntp.org/
 
  
 
== Dependencies ==
 
== Dependencies ==
Line 31: Line 27:
  
 
  ./configure --prefix=/usr --bindir=/usr/sbin \
 
  ./configure --prefix=/usr --bindir=/usr/sbin \
     --sysconfdir=/etc --cache-file=config.cache &&
+
     --sysconfdir=/etc --with-binsubdir=sbin \
 +
    --enable-shared --cache-file=config.cache &&
 
  make
 
  make
  
Line 41: Line 38:
  
 
== Multilib ==
 
== Multilib ==
 +
 
'''''This package does not provide any libraries so only one installation is needed.'''''
 
'''''This package does not provide any libraries so only one installation is needed.'''''
 
=== 32Bit ===
 
 
[[Silc-toolkit]] provides a md5.h that is incompatible with NTP. Add the following entry to config.cache to make sure the header isn't used:
 
 
echo "ac_cv_header_md5_h=no" > config.cache
 
 
Compile the package:
 
 
CC="gcc ${BUILD32}" USE_ARCH=32 ./configure  --prefix=/usr \
 
--bindir=/usr/sbin --sysconfdir=/etc --cache-file=config.cache &&
 
make
 
 
Install the package
 
 
make install &&
 
install -dv -m755 /usr/share/doc/ntp-{{NTP-Version}} &&
 
cp -Rv html /usr/share/doc/ntp-{{NTP-Version}}/
 
 
=== N32 ===
 
 
[[Silc-toolkit]] provides a md5.h that is incompatible with NTP. Add the following entry to config.cache to make sure the header isn't used:
 
 
echo "ac_cv_header_md5_h=no" > config.cache
 
 
Compile the package:
 
 
CC="gcc ${BUILDN32}" USE_ARCH=n32 ./configure  --prefix=/usr \
 
--bindir=/usr/sbin --sysconfdir=/etc --cache-file=config.cache &&
 
make
 
 
Install the package
 
 
make install &&
 
install -dv -m755 /usr/share/doc/ntp-{{NTP-Version}} &&
 
cp -Rv html /usr/share/doc/ntp-{{NTP-Version}}/
 
  
 
=== 64Bit ===
 
=== 64Bit ===
Line 88: Line 50:
 
   
 
   
 
  CC="gcc ${BUILD64}" USE_ARCH=64 ./configure  --prefix=/usr \
 
  CC="gcc ${BUILD64}" USE_ARCH=64 ./configure  --prefix=/usr \
     --bindir=/usr/sbin --sysconfdir=/etc --cache-file=config.cache &&
+
     --bindir=/usr/sbin --sysconfdir=/etc --with-binsubdir=sbin \
 +
    --enable-shared --cache-file=config.cache &&
 
  make
 
  make
  
Line 122: Line 85:
 
=== Bootscript ===
 
=== Bootscript ===
  
If you want '''ntp''' to always be running, nstall the init script provided by the [[blfs-bootscripts]] package:
+
If you want '''ntp''' to always be running, install the init script provided by the [[bootscripts]] package:
  
 
  make install-ntp
 
  make install-ntp
  
If you want '''ntp''' to run only periodically, then add the following line to root's crontab (see [[Fcron]]):
+
If you want '''ntp''' to run only periodically, then add the following line to root's crontab (see [[Fcron]] or [[Vixie-Cron]]):
  
 
  ntpd -q
 
  ntpd -q
  
'''Note:'''
+
{{Note|If your computer will not always have an active internet connection on boot, then you should use the crontab approach. If you do not have an active internet connection when blfs-bootscripts' ntp script runs, then your computer will not finish booting. It will sit there attempting to contact one of the ntp servers and it's not smart enough to figure out that you do not have an active internet connection. It's a problem similar to if you have [[dhcpcd]] installed without either [[ifplugd]] or [[netplug]].}}
If your computer will not always have an active internet
 
connection on boot, then you should use the crontab approach.
 
If you do not have an active internet connection when
 
blfs-bootscripts' ntp script runs, then your computer will
 
not finish booting. It will sit there attempting to contact
 
one of the ntp servers and it's not smart enough to figure
 
out that you do not have an active internet connection.
 
It's a problem similar to if you have [[dhcpcd]] installed
 
without either [[ifplugd]] or [[netplug]].
 
  
 
Link over clfs-bootscripts' setclock script so that the hardware clock is set when the computer shuts down or reboots.
 
Link over clfs-bootscripts' setclock script so that the hardware clock is set when the computer shuts down or reboots.
Line 145: Line 99:
 
  ln -svf ../init.d/setclock /etc/rc.d/rc0.d/K46setclock &&
 
  ln -svf ../init.d/setclock /etc/rc.d/rc0.d/K46setclock &&
 
  ln -svf ../init.d/setclock /etc/rc.d/rc6.d/K46setclock
 
  ln -svf ../init.d/setclock /etc/rc.d/rc6.d/K46setclock
 +
 +
== Contents ==
 +
 +
{| style="text-align: left;"
 +
|-valign="top"
 +
!Installed Directories:
 +
|None
 +
|-valign="top"
 +
!Installed Programs:
 +
|ntp-keygen, ntp-wait, ntpd, ntpdate, ntpdc, ntpq, ntptime, ntptrace, sntp, tickadj
 +
|-valign="top"
 +
!Installed Libraries:
 +
|None
 +
|}
 +
 +
[[Category:Network Applications]]

Latest revision as of 06:27, 12 January 2014

Download Source: http://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ntp-4.2/ntp-4.2.8p10.tar.gz

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.

Project Homepage: http://www.ntp.org/

Dependencies

Optional

Additional Configuration Options

--with-crypto: Enables OpenSSL support.

Non-Multilib

Silc-toolkit provides a md5.h that is incompatible with NTP. Add the following entry to config.cache to make sure the header isn't used:

echo "ac_cv_header_md5_h=no" > config.cache

Compile the package:

./configure --prefix=/usr --bindir=/usr/sbin \
    --sysconfdir=/etc --with-binsubdir=sbin \
    --enable-shared --cache-file=config.cache &&
make

Install the package

make install
install -dv -m755 /usr/share/doc/ntp-4.2.8p10 &&
cp -Rv html /usr/share/doc/ntp-4.2.8p10/

Multilib

This package does not provide any libraries so only one installation is needed.

64Bit

Silc-toolkit provides a md5.h that is incompatible with NTP. Add the following entry to config.cache to make sure the header isn't used:

echo "ac_cv_header_md5_h=no" > config.cache

Compile the package:

CC="gcc ${BUILD64}" USE_ARCH=64 ./configure  --prefix=/usr \
    --bindir=/usr/sbin --sysconfdir=/etc --with-binsubdir=sbin \
    --enable-shared --cache-file=config.cache &&
make

Install the package

make install &&
install -dv -m755 /usr/share/doc/ntp-4.2.8p10 &&
cp -Rv html /usr/share/doc/ntp-4.2.8p10/

Configuring

Configuration File

/etc/ntp.conf

Configuration Information

You will need to create an ntp.conf file so that ntp knows where to go find ntp servers from which it can get the current time. Here is a sample ntp.conf file suitable for the United States:

cat > /etc/ntp.conf << "EOF"
server 0.us.pool.ntp.org
server 1.us.pool.ntp.org
server 2.us.pool.ntp.org
driftfile /var/cache/ntp.drift
EOF

Of course, if you live elsewhere, you are going to want to list servers closer to home - though ntp should be able to work just fine with any server that you choose. A list of servers can be found at http://www.pool.ntp.org/. Just click on your continent on the right and you'll find your way to a list of servers for your area. You can then replace the server .... lines with servers closer to home.

The ntp.drift file allows ntp to compute the error in the intrinsic frequency of the clock on the computer it is running on, helping to keep the time on the computer correct.

Also, if you want more detailed documentation, have a look at http://www.ntp.org/.

Bootscript

If you want ntp to always be running, install the init script provided by the bootscripts package:

make install-ntp

If you want ntp to run only periodically, then add the following line to root's crontab (see Fcron or Vixie-Cron):

ntpd -q
Caution.png

Note

If your computer will not always have an active internet connection on boot, then you should use the crontab approach. If you do not have an active internet connection when blfs-bootscripts' ntp script runs, then your computer will not finish booting. It will sit there attempting to contact one of the ntp servers and it's not smart enough to figure out that you do not have an active internet connection. It's a problem similar to if you have dhcpcd installed without either ifplugd or netplug.

Link over clfs-bootscripts' setclock script so that the hardware clock is set when the computer shuts down or reboots.

ln -svf ../init.d/setclock /etc/rc.d/rc0.d/K46setclock &&
ln -svf ../init.d/setclock /etc/rc.d/rc6.d/K46setclock

Contents

Installed Directories: None
Installed Programs: ntp-keygen, ntp-wait, ntpd, ntpdate, ntpdc, ntpq, ntptime, ntptrace, sntp, tickadj
Installed Libraries: None
Retrieved from "?title=NTP&oldid=21598"