[ntp:questions] Configuring Expert GPS CLOCK with Linux RedHat

Giuseppe Salerno gsppslrn at libero.it
Tue Nov 11 01:06:58 UTC 2003


Hello.

I have a problem configuring Expert GPS CLOCK with Linux RedHat.
It don't sincronize with the time-server,
I'm using ntp-4.2.0; when I use the ntpd daemon, I receive an error message:
-------------------------------------------------------------------------------------------------
[root at localhost gsalerno]# /etc/rc.d/init.d/ntpd start
ntpd: Aprendo firewall per input da 127.127.20.0 porta 123     [  OK  ]
ntpd: Sincronizzazione con l'ora del server:
[FALLITO]
Avvio di ntpd:
                       [  OK  ]
-------------------------------------------------------------------------------------------------
Trying manually to force time using ntpdate I receive:
-------------------------------------------------------------------------------------------------
[root at localhost gsalerno]# ntpdate -s -b -d -p 8 127.127.20.0
addto_syslog: ntpdate 4.2.0 at 1.1161-r Sat Nov  1 02:18:04 CET 2003 (1)
Looking for host 127.127.20.0 and service ntp
host found : 127.127.20.0
transmit(127.127.20.0)
receive(127.127.20.0)
transmit(127.127.20.0)
receive(127.127.20.0)
transmit(127.127.20.0)
receive(127.127.20.0)
transmit(127.127.20.0)
receive(127.127.20.0)
transmit(127.127.20.0)
receive(127.127.20.0)
transmit(127.127.20.0)
receive(127.127.20.0)
transmit(127.127.20.0)
receive(127.127.20.0)
transmit(127.127.20.0)
receive(127.127.20.0)
transmit(127.127.20.0)
127.127.20.0: Server dropped: strata too high
server 127.127.20.0, port 123
stratum 16, precision -16, leap 11, trust 000
refid [127.127.20.0], delay 0.02568, dispersion 0.00000
transmitted 8, in filter 8
reference time:    00000000.00000000  Thu, Feb  7 2036  7:28:16.000
originate timestamp: c354f602.c3365881  Thu, Nov  6 2003 17:32:02.762
transmit timestamp:  c354f602.c3338716  Thu, Nov  6 2003 17:32:02.762
filter delay:  0.02682  0.02568  0.02568  0.02568
            0.02568  0.02568  0.02568  0.02568
filter offset: 0.000540 0.000005 0.000002 0.000002
            0.000002 0.000002 0.000002 0.000002
delay 0.02568, dispersion 0.00000
offset 0.000005

addto_syslog: no server suitable for synchronization found
------------------------------------------------------------------------------------------------
the ntpd daemon is:
------------------------------------------------------------------------------------------------
#!/bin/bash
#
# ntpd          This shell script takes care of starting and stopping
#               ntpd (NTPv4 daemon).
#
# chkconfig: - 58 74
# description: ntpd is the NTPv4 daemon. \
# The Network Time Protocol (NTP) is used to synchronize the time of \
# a computer client or server to another server or reference time source, \
# such as a radio or satellite receiver or modem.



# Source function library.
. /etc/init.d/functions



# Source networking configuration.
. /etc/sysconfig/network



if [ -f /etc/sysconfig/ntpd ];then
           . /etc/sysconfig/ntpd
fi



# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0



ntpconf=/etc/ntp.conf
ntpstep=/etc/ntp/step-tickers



[ -x /usr/sbin/ntpd -a -f $ntpconf ] || exit 0



RETVAL=0
prog="ntpd"



# Is there a firewall running, and does it look like one we configured?
FWACTIVE=''


if iptables -L -n 2>/dev/null | grep -q RH-Lokkit-0-50-INPUT ; then
       FWACTIVE=1
fi


start() {
           # get the servers from step-ticker
           tickers=''
           if [ -s "$ntpstep" ]; then
               tickers=`/bin/sed -e 's/\#.*$//g' $ntpstep`
           fi
           timeservers=`/bin/sed \
                    -n -e 's/\#.*$//;/127.*/d' \
                    -e
's/^[[:blank:]]*server[[:blank:]][[:blank:]]*\(.*\)/\1/p' \
                    -e
's/^[[:blank:]]*server[[:blank:]]+\([[:alnum:].]+\)[[:blank:]]*.*/\1/p' \
                    -e
's/^[[:blank:]]*peer[[:blank:]]+\([[:alnum:].]+\)[[:blank:]]*.*/\1/p' \
                    $ntpconf`


           # check for -x
           OPTIND=0
           dostep=''
           while getopts ":aAbc:dD:f:gk:l:LmnN:p:P:qr:s:t:v:V:xU:T:" args
$OPTIONS;
           do
             if [ "$args" = "x" ]; then
                 dostep='yes'
                 break
             fi
           done
           OPTIND=0


           # Open the firewall for ntp
           if [ -n "$FWACTIVE" -a "$FIREWALL_MODS" != "no" ]; then
             for server in $tickers $timeservers; do
               echo -n $"$prog: Opening firewall for input from $server
port 123"
               iptables -I RH-Lokkit-0-50-INPUT -m udp -p udp -s
$server/32  \
                   --sport 123 -d 0/0 --dport 123 -j ACCEPT \
                   && success || failure
               echo
             done
           fi


           if [ -z "$tickers" ]; then
               tickers=$timeservers
           fi


           if [ -s "$ntpstep" -o -n "$dostep" ]; then
               # Synchronize with servers if step-tickers exists
               # or the -x option is used
               echo -n $"$prog: Synchronizing with time server: "
               /usr/sbin/ntpdate -s -b -p 8 $tickers
               RETVAL=$?
               [ $RETVAL -eq 0 ] && success || failure
               echo
               if [ $RETVAL -ne 0 ]; then
                       OPTIONS="$OPTIONS -g"
               fi
           else
               # -g can replace the grep for time servers
               # as it permits ntpd to violate its 1000s limit once.
               OPTIONS="$OPTIONS -g"
           fi
           # Start daemons.
           echo -n $"Starting $prog: "
           daemon ntpd $OPTIONS
           RETVAL=$?
           echo
           [ $RETVAL -eq 0 ] && touch /var/lock/subsys/ntpd
           return $RETVAL
}


stop() {
           # Stop daemons.


           # get the servers from step-ticker
           tickers=''
           if [ -s "$ntpstep" ]; then
               tickers=`/bin/sed -e 's/\#.*$//g' $ntpstep`
           fi
           timeservers=`/bin/sed \
                    -n -e 's/\#.*$//;/127.*/d' \
                    -e
's/^[[:blank:]]*server[[:blank:]][[:blank:]]*\(.*\)/\1/p' \
                    $ntpconf`


           # Remove the firewall opening for ntp
           if [ -n "$FWACTIVE" -a "$FIREWALL_MODS" != "no" ]; then
             for server in $tickers $timeservers; do
               echo -n $"$prog: Removing firewall opening for $server port
123"
               iptables -D RH-Lokkit-0-50-INPUT -m udp -p udp -s
$server/32  --sport 123 -d 0/0 --dport 123 -j ACCEPT\
                   && success || failure
               echo
             done
           fi
           echo -n $"Shutting down $prog: "
           killproc ntpd
           RETVAL=$?
           echo
           [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/ntpd
           return $RETVAL
}


# See how we were called.
case "$1" in
     start)
           start
           ;;
     stop)
           stop
           ;;
     status)
           status ntpd
           RETVAL=$?
           ;;
     restart|reload)
           stop
           start
           RETVAL=$?
           ;;
     condrestart)
           if [ -f /var/lock/subsys/ntpd ]; then
               stop
               start
               RETVAL=$?
           fi
           ;;
     *)
           echo $"Usage: $0 {start|stop|restart|condrestart|status}"
           exit 1
esac


exit $RETVAL
------------------------------------------------------------------------------
the configuration file is:
# Prohibit general access to this service.
##restrict default ignore

# Permit all access over the loopback interface.  This could
# be tightened as well, but to do so would effect some of
# the administrative functions.
##restrict 127.0.0.1


# -- CLIENT NETWORK -------
# Permit systems on this network to synchronize with this
# time service.  Do not permit those systems to modify the
# configuration of this service.  Also, do not use those
# systems as peers for synchronization.
# restrict 192.168.1.0 mask 255.255.255.0 notrust nomodify notrap


# --- OUR TIMESERVERS -----
# or remove the default restrict line
# Permit time synchronization with our time source, but do not
# permit the source to query or modify the service on this system.

# restrict mytrustedtimeserverip mask 255.255.255.255 nomodify notrap
noquery
# server mytrustedtimeserverip



# --- NTP MULTICASTCLIENT ---
# multicastclient            # listen on default 224.0.1.1
# restrict 224.0.1.1 mask 255.255.255.255 notrust nomodify notrap
# restrict 192.168.1.0 mask 255.255.255.0 notrust nomodify notrap



# --- GENERAL CONFIGURATION ---
#
# Undisciplined Local Clock. This is a fake driver intended for backup
# and when no outside source of synchronized time is available. The
# default stratum is usually 3, but in this case we elect to use stratum
# 0. Since the server line does not have the prefer keyword, this driver
# is never used for synchronization, unless no other other
# synchronization source is available. In case the local host is
# controlled by some external source, such as an external oscillator or
# another protocol, the prefer keyword would cause the local host to
# disregard all other synchronization sources, unless the kernel
# modifications are in use and declare an unsynchronized condition.
#
##server    127.127.1.0    # local clock
server 127.127.20.0 prefer
fudge 127.127.20.0 stratum 0
##fudge    127.127.1.0 stratum 10

#
# Drift file.  Put this in a directory which the daemon can write to.
# No symbolic links allowed, either, since the daemon updates the file
# by creating a temporary in the same directory and then rename()'ing
# it to the file.
#
##driftfile /etc/ntp/drift
driftfile /var/log/ntp.drift
##broadcastdelay    0.008

#
# Authentication delay.  If you use, or plan to use someday, the
# authentication facility you should make the programs in the auth_stuff
# directory and figure out what this number should be on your machine.
#
##authenticate yes

#
# Keys file.  If you want to diddle your server at run time, make a
# keys file (mode 600 for sure) and define the key number to be
# used for making requests.

# PLEASE DO NOT USE THE DEFAULT VALUES HERE. Pick your own, or remote
# systems might be able to reset your clock at will. Note also that
# ntpd is started with a -A flag, disabling authentication, that
# will have to be removed as well.
#
##keys        /etc/ntp/keys
logfile /var/log/ntp
logconfig =all
---------------------------------------------------------------------------------------------------------
Attach Script file ntpd and config file ntp.conf

Thanks for the help.







More information about the questions mailing list