Operating System - Linux
1820291 Members
3248 Online
109622 Solutions
New Discussion юеВ

Re: time syncs after restarting ntpd but, within a few minutes, it's off again

 
Matt Shaffer_1
Regular Advisor

time syncs after restarting ntpd but, within a few minutes, it's off again

My rhel4 server (recently built) is running ntp. It syncs to a rhel3 server on the same network but in a different subnet (not sure if that matters). If I restart the ntpd service, the time syncs up no problem. But within minutes, it's off drastically.
12 REPLIES 12
Bill Thorsteinson
Honored Contributor

Re: time syncs after restarting ntpd but, within a few minutes, it's off again

It appears to be a severe clock drift problem.
NTP will only adjust minor drift.
Try running the command
ntpq -c peers
This will show you if you have synced with
other server and how far off you are.

You may be syncing to one server with ntpdate
when starting ntp and switching to another
once ntpd start running.
Check the contents of ntp.conf and the
command line used to start ntpd.
If the contents of the ntp.drift file are
less than +/1 500 and not zero then ntp is
managing to sync the clock.
Ivan Ferreira
Honored Contributor

Re: time syncs after restarting ntpd but, within a few minutes, it's off again

At startup, the ntpdate command is executed to sync the servers time.

You should use ntpq -pn to view if you are using a NTP server, the server markes with a * is your current ntp server.

Ensure that your timezone configuration is correct. Remove the local clock from the configuration file.
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?
Steven E. Protter
Exalted Contributor

Re: time syncs after restarting ntpd but, within a few minutes, it's off again

Shalom Matt,

ntp won't really sync if you are off too far. You may need to manually set the clock.

You may need to replace the clock battery if the drift problem is servere. If the clock itself is a brick its system board replacement time.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Matt Shaffer_1
Regular Advisor

Re: time syncs after restarting ntpd but, within a few minutes, it's off again

When I run nptq -pn there are no servers that have the * by it. what does that mean? I have 300 rhel3 machines and they are all syncing with the ntp server. when I run nptq -pn on one of those I see that one of the ntp servers has the * by it. I made this rhel4 just like those but that didn't work either. can I include any files that might help? Or how do I manually reset the clock? This server has just been out of the box for 2 weeks. Thanks to all
Ivan Ferreira
Honored Contributor

Re: time syncs after restarting ntpd but, within a few minutes, it's off again

Please run:

service ntpd stop

ntpdate -b ntp_server

service ntpd start

Post the results of the command ntpdate -b, the ntp.conf and the /etc/sysconfig/clock file.

Also post the results of:

date +%z
date +%Z

Of your server and another server that actually works the time synchronization.
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?
Matt Shaffer_1
Regular Advisor

Re: time syncs after restarting ntpd but, within a few minutes, it's off again

RPSPRO is the server that doesn't work
RPSPRO.wescodist.com# ntpdate -b 207.241.222.30
28 Sep 11:07:00 ntpdate[7719]: step time server 207.241.222.30 offset -2332.6316
45 sec
**********************
/etc/ntp.conf file
restrict default ignore
restrict 207.241.222.11 mask 255.255.255.255 nomodify notrap noquery
restrict 207.241.222.30 mask 255.255.255.255 nomodify notrap noquery
restrict 127.0.0.1

driftfile /etc/ntp/drift

logfile /var/log/ntp.log

#server time_server
server 207.241.222.30
server 207.241.222.11
server 66.187.233.4
fudge 127.127.1.0 stratum 10

broadcastdelay 0.008
authenticate yes
keys /etc/ntp/keys
***************************
/etc/sysconfig/clock file
ZONE="America/New_York"
UTC=false
ARC=false
*****************************
*****************************

This server does work
B1116-> ntpdate -b 207.241.222.30
28 Sep 11:07:18 ntpdate[17869]: step time server 207.241.222.30 offset 0.004804
sec
***********************
/etc/ntp.conf file
restrict default ignore
restrict 207.241.222.11 mask 255.255.255.255 nomodify notrap noquery
restrict 207.241.222.30 mask 255.255.255.255 nomodify notrap noquery
restrict 127.0.0.1

driftfile /var/lib/ntp/drift

logfile /var/log/ntp.log



#server time_server
server 207.241.222.11
server 207.241.222.30 prefer
server 66.187.233.4
fudge 127.127.1.0 stratum 10

broadcastdelay 0.008
authenticate yes
keys /etc/ntp/keys
***************************
/etc/sysconfig/clock file
ZONE="America/New_York"
UTC=false
ARC=false



Matt Shaffer_1
Regular Advisor

Re: time syncs after restarting ntpd but, within a few minutes, it's off again

Does anyone have any idears about this? Why don't I see a current ntp server when I run ntpq -pn? I appreciate all the help because I'm stumped on this. I expected ntp be just work. Thanks
Ivan Ferreira
Honored Contributor

Re: time syncs after restarting ntpd but, within a few minutes, it's off again

Is your key file correctly configured? ntpdate works, so ntp should work also, the only difference is that you use authentication with ntp.

Can you post the output of ntpq -pn please?
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?
Matt Shaffer_1
Regular Advisor

Re: time syncs after restarting ntpd but, within a few minutes, it's off again

RPSPRO.wescodist.com# ntpq -pn
remote refid st t when poll reach delay offset jitter
==============================================================================
207.241.222.30 192.5.41.209 2 u 28 64 1 1.108 -0.146 0.001
207.241.222.11 .INIT. 16 u - 64 0 0.000 0.000 4000.00
66.187.233.4 .INIT. 16 u - 64 0 0.000 0.000 4000.00
*******************************************

Keep in mind, when I manually stop and restart ntpd my server syncs with the ntp server. But it gets way out of sync when I just let it go. Also, if I turn off ntp the clock seems to keep good time.
Ivan Ferreira
Honored Contributor

Re: time syncs after restarting ntpd but, within a few minutes, it's off again

Can you set authenticate to no and also, what do you have in the /var/log/ntp.log file?
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?
Matt Shaffer_1
Regular Advisor

Re: time syncs after restarting ntpd but, within a few minutes, it's off again

actually when I turned off ntp and let the server run on it's own clock for awhile, now when I turned ntpd back on it is now syncing with my time server. I now have an * by my primary time server. thanks to all - you all helped me out.
Matt Shaffer_1
Regular Advisor

Re: time syncs after restarting ntpd but, within a few minutes, it's off again

once I let the server run on it's own clock for a few days, I was able to sync it with my ntp server.