Several steps need to be taken to properly configure the NTP daemon.
1) First, create or update the file /etc/ntp.conf. Several
example configuration files can be found here:
${TRUEPREFIX}/share/examples/ntp
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" \
-a -x ${TRUEPREFIX}/sbin/ntpdate ]; then
echo -n ' ntpdate'
${TRUEPREFIX}/sbin/ntpdate -b ${xntpdate_flags} >/dev/null
fi
# tickadj is not always needed
if [ X"${xntpd}" == X"YES" -a -x ${TRUEPREFIX}/sbin/tickadj \
-a -e /etc/ntp.conf ]; then
echo -n ' tickadj'; ${TRUEPREFIX}/sbin/tickadj -Aq
fi
(b) Add the following to /etc/rc.local:
# run ntpdate prior to ntpd
if [ $securelevel -le 1 -a X"${xntpdate_flags}" != X"NO" \
-a -x ${TRUEPREFIX}/sbin/ntpdate ]; then
echo -n ' ntpdate'
${TRUEPREFIX}/sbin/ntpdate -b ${xntpdate_flags} >/dev/null
fi
if [ X"${xntpd}" == X"YES" -a -x ${TRUEPREFIX}/sbin/ntpd \
-a -e /etc/ntp.conf ]; then
xntpd_flags="-p /var/run/ntpd.pid"
if [ $securelevel -ge 1 ]; then
xntpd_flags="${xntpd_flags} -x"
fi
echo -n ' ntpd'; ${TRUEPREFIX}/sbin/ntpd ${xntpd_flags}
fi
(c) Then, in /etc/rc.conf.local, set the following variables accordingly.
xntpd=YES # change to NO to disable
xntpdate_flags="pool.ntp.org" # set to list of NTP servers
(refer to rc.conf(8) for more information regarding its use)
3) Finally, restart your system. The system restart is necessary as
tickadj is run from /etc/rc.securelevel before the system securelevel
is raised.