ntp

der.hans PLUGd at LuftHans.com
Sat Sep 5 12:37:23 MST 2015


Am 04. Sep, 2015 schwätzte Tejeev Patel so:

moin moin TJ,

what James said in regards to debugging ntp :).

Here are some other things to check.

Is there some ntp process already running?

ps auxw | grep ntp

Is there a config file in /etc/default/ that has an entry to not start
ntp?

Is ntpdate installed and configured to prevent ntpd from starting?

As James mentioned, ntp will refuse to change the time if it's off too
much. Check to see if the systems are within a couple of minutes of the
actual time.

Verify your hardware clock is set to UTC.

Make sure your OS is set at the proper offset from UTC, e.g. you're set to
now and AZ time zone, rather than now and eastern time zone.

If the boxen are servers they should be set to UTC. Star date blah, blah,
blah and all that.

cioa,

der.hans

> I've got all of my servers running ntp to sync time, and though most are
> running fine without a hitch, I seem to have an issue where for some reason
> the service just doesn't start on some of them.  Same install procedure on
> all servers.  No errors in syslog or ntp for days, even when server has
> been rebooted in that time.
> The service just isn't running and I don't know why.  I've included the
> ntp.conf and the init script below.
>
> Any help would be appreciated.
>
> Thanks,
> TJ
>
> ##############################################################################################
> *ntp.conf*
> ##############################################################################################
>
> # This file has been modified by adding our two ntp servers. commenting out
> all the pool servers
> # and redirecting ntp logs to an ntp logfile.  File is distributed via
> # cp.get_file salt command and then the ntp service is restarted via a
> cmd.run
> #  -TJ 2015/08/14
>
>
> # /etc/ntp.conf, configuration for ntpd; see ntp.conf(5) for help
> driftfile /var/lib/ntp/ntp.drift
> logfile /var/log/ntpd.log
>
> # Enable this if you want statistics to be logged.
> #statsdir /var/log/ntpstats/
>
> statistics loopstats peerstats clockstats
> filegen loopstats file loopstats type day enable
> filegen peerstats file peerstats type day enable
> filegen clockstats file clockstats type day enable
>
> # You do need to talk to an NTP server or two (or three).
> #server 67.40.67.44 iburst
>
> # pool.ntp.org maps to about 1000 low-stratum NTP servers.  Your server will
> # pick a different set every time it starts up.  Please consider joining the
> # pool: <http://www.pool.ntp.org/join.html>
> #server 0.debian.pool.ntp.org iburst dynamic
> #server 1.debian.pool.ntp.org iburst dynamic
> #server 2.debian.pool.ntp.org iburst dynamic
> #server 3.debian.pool.ntp.org iburst dynamic
>
> server *[Our central ntp server ip] *dynamic prefer
> server *[Our backup ntp server ip] *dynamic
>
>
> # Access control configuration; see /usr/share/doc/ntp-doc/html/accopt.html
> for
> # details.  The web page <
> http://support.ntp.org/bin/view/Support/AccessRestrictions>
> # might also be helpful.
> #
> # Note that "restrict" applies to both servers and clients, so a
> configuration
> # that might be intended to block requests from certain clients could also
> end
> # up blocking replies from your own upstream servers.
> # By default, exchange time with everybody, but don't allow configuration.
> restrict -4 default kod notrap nomodify nopeer noquery
> restrict -6 default kod notrap nomodify nopeer noquery
>
> # Local users may interrogate the ntp server more closely.
> restrict 127.0.0.1
> restrict ::1
>
> # Clients from this (example!) subnet have unlimited access, but only if
> # cryptographically authenticated.
> #restrict 192.168.123.0 mask 255.255.255.0 notrust
>
> # If you want to provide time to your local subnet, change the next line.
> # (Again, the address is an example only.)
> #broadcast 192.168.123.255
>
> # If you want to listen to time broadcasts on your local subnet, de-comment
> the
> # next lines.  Please do this only if you trust everybody on the network!
> #disable auth
> #broadcastclient
>
>
>
>
>
>
>
> ##############################################################################################
> *init.d/ntp*
> ##############################################################################################
>
>  GNU nano 2.2.6                                                   File:
> /etc/init.d/ntp
>
>
> #!/bin/sh
>
> ### BEGIN INIT INFO
> # Provides:        ntp
> # Required-Start:  $network $remote_fs $syslog
> # Required-Stop:   $network $remote_fs $syslog
> # Default-Start:   2 3 4 5
> # Default-Stop:
> # Short-Description: Start NTP daemon
> ### END INIT INFO
>
> PATH=/sbin:/bin:/usr/sbin:/usr/bin
>
> . /lib/lsb/init-functions
>
> DAEMON=/usr/sbin/ntpd
> PIDFILE=/var/run/ntpd.pid
>
> test -x $DAEMON || exit 5
>
> if [ -r /etc/default/ntp ]; then
>        . /etc/default/ntp
> fi
>
> if [ -e /var/lib/ntp/ntp.conf.dhcp ]; then
>        NTPD_OPTS="$NTPD_OPTS -c /var/lib/ntp/ntp.conf.dhcp"
> fi
>
>
> LOCKFILE=/var/lock/ntpdate
>
> lock_ntpdate() {
>        if [ -x /usr/bin/lockfile-create ]; then
>                lockfile-create $LOCKFILE
>                lockfile-touch $LOCKFILE &
>                LOCKTOUCHPID="$!"
>        fi
> }
>
> unlock_ntpdate() {
>        if [ -x /usr/bin/lockfile-create ] ; then
>                kill $LOCKTOUCHPID
>                lockfile-remove $LOCKFILE
>        fi
> }
>
> RUNASUSER=ntp
> UGID=$(getent passwd $RUNASUSER | cut -f 3,4 -d:) || true
> if test "$(uname -s)" = "Linux"; then
>        NTPD_OPTS="$NTPD_OPTS -u $UGID"
> fi
>
> case $1 in
>        start)
>                log_daemon_msg "Starting NTP server" "ntpd"
>                if [ -z "$UGID" ]; then
>                        log_failure_msg "user \"$RUNASUSER\" does not exist"
>                        exit 1
>                fi
>                lock_ntpdate
>                start-stop-daemon --start --quiet --oknodo --pidfile
> $PIDFILE --startas $DAEMON -- -p $PIDFILE $NTPD_OPTS
>                status=$?
>                unlock_ntpdate
>                log_end_msg $status
>                ;;
>        stop)
>                log_daemon_msg "Stopping NTP server" "ntpd"
>                start-stop-daemon --stop --quiet --oknodo --pidfile $PIDFILE
>                log_end_msg $?
>                rm -f $PIDFILE
>                ;;
>        restart|force-reload)
>                $0 stop && sleep 2 && $0 start
>                ;;
>        try-restart)
>                if $0 status >/dev/null; then
>                        $0 restart
>                else
>                        exit 0
>                fi
>                ;;
>        reload)
>                exit 3
>                ;;
>        status)
>                status_of_proc $DAEMON "NTP server"
>                ;;
>        *)
>                echo "Usage: $0
> {start|stop|restart|try-restart|force-reload|status}"
>                exit 2
>                ;;
> esac
>

-- 
#  http://www.LuftHans.com/        http://www.PhxLinux.org/
#  "The Constitution is not an instrument for the government to restrain the
#  people, it is an instrument for the people to restrain the government -
#  lest it come to dominate our lives and interests." -- Patrick Henry


More information about the PLUG-discuss mailing list