NTP fails synchronization with server at startup

Nigel Henry cave.dnb at tiscali.fr
Wed Dec 5 17:17:33 UTC 2007


On Wednesday 05 December 2007 15:24, Paul Smith wrote:
> On Dec 5, 2007 2:09 PM, Mikkel L. Ellertson <mikkel at infinity-ltd.com> wrote:
> > > Yes, Craig, I did reboot the computer after having turned off ipv6,
> > > but it did not solve the problem. It is rather strange that
> > > '/sbin/service ntpd restart' works perfectly and that NTP cannot
> > > synchronize with the server at booting.
> >
> > This is not strange at all. When it tries to connect at boot, it can
> > not make the connection. When the network is up, it can make the
> > connection. I don't remember for sure, but I believe you were
> > getting a DNS error. This could be because you couldn't reach the
> > name server, or because you are running a local name server, and it
> > isn't up when NTP starts. I would also expect to see this if you
> > were using a wireless connection and network manager configured to
> > make the connection when the user logs in. (User supplied wireless
> > key instead of system supplied wireless key.)
>
> I understand your explanation. I do not use any wireless connection to
> the Internet. Moreover, my Ethernet device is configure to be
> activated when computer starts. What else should I look at?
>
> Paul

Hi Paul. One thing I would consider is to add some Internet time servers to 
your /etc/ntp.conf. It is suggested that you have at least 3. Some 
timeservers can be unreliable, or not even accessable at times, which may 
well cause problems if you only have one. Make sure you use stratum 2, or 3, 
not stratum 1 servers.

Another thing. Are you sure that ntp isn't doing it's stuff, even though the 
bootup shows a fail. Before you do the ntpd restart, run the following as 
user.

/usr/sbin/ntpq
then type pe, which will give you some info on which servers ntp is trying to 
connect to, and how successfull it is being. You can keep typing pe at 
intervals, which will show ntp's progress at reaching a point where a time 
server is being used as a "sys peer". The server being used will be prefixed 
by a "*". Other useable servers will be prefixed by a "+" "candidat". To quit 
ntpq type q.

As a matter of course after receiving advice from the ntp list, I comment out 
all the uncommented lines in /etc/ntp.conf, except the driftfile line, 
including commenting out any server lines, as "I "select the servers I want 
to use. Many of the uncommented lines are not needed, and in the case of the 
restrict lines, can cause additional problems in getting ntp to work, unless 
you know what you are doing.

I have had problems when I first started to use ntp. I have a few distro's 
that run on the machine that gets it's time from the Internet. All use the 
same 3 Internet servers. I still use FC2 for day to day use on this machine, 
and do have a problem if my dialup connection isn't up when I boot FC2. The 
ntp daemon dies. I have a script though that runs from rc.local. This pings a 
webserver, and when the Internet connection is up, receives a response from 
the ping. Then the script starts the ntp daemon, and all is ok.

My F8 install is on the other machine, and gets it's time from, in this case, 
the machine that FC2 is running on. There are only 2 lines uncommented on 
F8's /etc/ntp.conf. The driftfile line, and a server line, which happens to 
be 192.168.0.230, and is pointing to the IP address of FC2 on the LAN.

Just for info I post a bit of output from ntpq> pe from FC2, that gets it's 
time from the Internet.

  /usr/sbin/ntpq
ntpq> pe
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
-crush.brunom.ne 88.191.16.241    3 u   35  256  377  138.418   36.829  21.347
+sd-881.dedibox. 193.52.184.106   2 u   38  256  377  137.545    4.407  10.555
*dedi.drazzib.co 193.49.205.17    2 u   40  256  377  145.066   10.910  24.633
+syrte8.obspm.fr 134.157.254.19   2 u  104  256  377  159.674    3.336  61.051
+ns1.kamino.fr   193.52.184.106   2 u   40  256  377  136.663    5.719  37.619
+ntp2.belbone.be 195.13.23.6      2 u   44  256  377  158.059    2.627  25.585
ntpq> pe
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
-crush.brunom.ne 88.191.16.241    3 u  224  256  377  138.418   36.829  21.347
+sd-881.dedibox. 193.52.184.106   2 u  227  256  377  137.545    4.407  10.555
*dedi.drazzib.co 193.49.205.17    2 u  230  256  377  145.066   10.910  24.633
+syrte8.obspm.fr 134.157.254.19   2 u   36  256  377  151.351    8.291  50.905
+ns1.kamino.fr   193.52.184.106   2 u  230  256  377  136.663    5.719  37.619
+ntp2.belbone.be 195.13.23.6      2 u  233  256  377  158.059    2.627  25.585
ntpq> pe
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
-crush.brunom.ne 88.191.16.241    3 u  232  256  377  138.418   36.829  38.303
+sd-881.dedibox. 193.52.184.106   2 u  236  256  377  137.545    4.407  28.083
*dedi.drazzib.co 193.49.205.17    2 u  238  256  377  145.066   10.910  26.332
+syrte8.obspm.fr 195.220.94.163   2 u   42  256  377  151.351    8.291  48.079
+ns1.kamino.fr   193.52.184.106   2 u  239  256  377  136.663    5.719  37.583
+ntp2.belbone.be 195.13.23.6      2 u  240  256  377  158.059    2.627  25.221
ntpq>

And a bit of output from ntpq> pe on F8

 /usr/sbin/ntpq
ntpq> pe
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
*192.168.0.230   88.191.12.200    3 u  106  256  377    0.511   -1.245   0.353
ntpq> pe
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
*192.168.0.230   88.191.12.200    3 u   73  256  377    0.491   -0.691   0.527
ntpq> pe
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
*192.168.0.230   88.191.12.200    3 u   17  256  377    0.491   -0.691   0.533
ntpq> pe
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
*192.168.0.230   88.191.12.200    3 u   60  256  377    0.491   -0.691   0.539
ntpq>

Interestingly the refid above shows dedi.drazzib.co having an IP address 
88.191.12.200, but when pinging dedi.drazzib.co from F8 at different times, I 
get 2 different IP addresses, 62.210.183.19, and 62.210.183.18. This is a 
good reason for using hostnames with ntp, rather than IP addresses. Hostnames 
don't change, but IP addresses can.

Dont's know if any of this is usefull to you, but it's my 2¢ worth.

Nigel.












More information about the users mailing list