2004-07-27 10:39:31 -04:00
|
|
|
Several steps need to be taken to properly configure the NTP daemon.
|
|
|
|
|
2009-01-26 18:26:02 -05:00
|
|
|
1) First, create or update the file /etc/ntp.conf. Several
|
2004-07-27 10:39:31 -04:00
|
|
|
example configuration files can be found here:
|
|
|
|
|
2009-02-11 14:36:27 -05:00
|
|
|
${TRUEPREFIX}/share/examples/ntp
|
2004-07-27 10:39:31 -04:00
|
|
|
|
|
|
|
2) Next, several command scripts for system startup need to be
|
|
|
|
modified.
|
|
|
|
|
|
|
|
(a) Add the following to /etc/rc.securelevel:
|
|
|
|
|
|
|
|
# Securelevel > 1 does not allow the clock to be set backwards
|
|
|
|
if [ $securelevel -gt 1 -a X"${xntpdate_flags}" != X"NO" \
|
2009-02-11 14:36:27 -05:00
|
|
|
-a -x ${TRUEPREFIX}/sbin/ntpdate ]; then
|
2004-07-27 10:39:31 -04:00
|
|
|
echo -n ' ntpdate'
|
2009-02-11 14:36:27 -05:00
|
|
|
${TRUEPREFIX}/sbin/ntpdate -b ${xntpdate_flags} >/dev/null
|
2004-07-27 10:39:31 -04:00
|
|
|
fi
|
|
|
|
|
2009-01-26 18:26:02 -05:00
|
|
|
# tickadj is not always needed
|
2009-02-11 14:36:27 -05:00
|
|
|
if [ X"${xntpd}" == X"YES" -a -x ${TRUEPREFIX}/sbin/tickadj \
|
2004-07-27 10:39:31 -04:00
|
|
|
-a -e /etc/ntp.conf ]; then
|
2009-02-11 14:36:27 -05:00
|
|
|
echo -n ' tickadj'; ${TRUEPREFIX}/sbin/tickadj -Aq
|
2004-07-27 10:39:31 -04:00
|
|
|
fi
|
|
|
|
|
|
|
|
(b) Add the following to /etc/rc.local:
|
|
|
|
|
|
|
|
# run ntpdate prior to ntpd
|
|
|
|
if [ $securelevel -le 1 -a X"${xntpdate_flags}" != X"NO" \
|
2009-02-11 14:36:27 -05:00
|
|
|
-a -x ${TRUEPREFIX}/sbin/ntpdate ]; then
|
2004-07-27 10:39:31 -04:00
|
|
|
echo -n ' ntpdate'
|
2009-02-11 14:36:27 -05:00
|
|
|
${TRUEPREFIX}/sbin/ntpdate -b ${xntpdate_flags} >/dev/null
|
2004-07-27 10:39:31 -04:00
|
|
|
fi
|
|
|
|
|
2009-02-11 14:36:27 -05:00
|
|
|
if [ X"${xntpd}" == X"YES" -a -x ${TRUEPREFIX}/sbin/ntpd \
|
2004-07-27 10:39:31 -04:00
|
|
|
-a -e /etc/ntp.conf ]; then
|
|
|
|
xntpd_flags="-p /var/run/ntpd.pid"
|
|
|
|
if [ $securelevel -ge 1 ]; then
|
|
|
|
xntpd_flags="${xntpd_flags} -x"
|
|
|
|
fi
|
2009-02-11 14:36:27 -05:00
|
|
|
echo -n ' ntpd'; ${TRUEPREFIX}/sbin/ntpd ${xntpd_flags}
|
2004-07-27 10:39:31 -04:00
|
|
|
fi
|
|
|
|
|
2009-01-26 18:26:02 -05:00
|
|
|
(c) Then, in /etc/rc.conf.local, set the following variables accordingly.
|
2004-07-27 10:39:31 -04:00
|
|
|
|
|
|
|
xntpd=YES # change to NO to disable
|
|
|
|
xntpdate_flags="pool.ntp.org" # set to list of NTP servers
|
|
|
|
|
2007-09-17 13:20:44 -04:00
|
|
|
(refer to rc.conf(8) for more information regarding its use)
|
2004-07-27 10:39:31 -04:00
|
|
|
|
|
|
|
3) Finally, restart your system. The system restart is necessary as
|
|
|
|
tickadj is run from /etc/rc.securelevel before the system securelevel
|
|
|
|
is raised.
|
|
|
|
|