Correcting computer time using ntpdate & ntp

Bill Fink billfink at mindspring.com
Sat May 7 12:51:00 MDT 2005


Two possibilities:

First I generally use IP addresses rather than names in my ntp.conf,
so in your case it would be:

server 199.212.17.20 prefer			# ntp2.cmc.ec.gc.ca

However this is probably not your problem.

Second, you may need a "restrict" entry for your server (I think by
default it restricts everything).  I'd put this before your server
entry as follows:

restrict 199.212.17.20 mask 255.255.255.255 nomodify notrap noquery
server 199.212.17.20 prefer			# ntp2.cmc.ec.gc.ca

Then of course you need to restart ntpd.

Some useful commands for checking on ntpd are "ntpdc -c peers" and
"ntpdc -c sysinfo" (note it takes a while for ntpd to fully sync
with its peers).

						-Hope this helps

						-Bill

P.S.  If your time is fairly far off, you should do the ntpdate
      first to set the correct time, and then start ntpd (or just
      put 199.212.17.20 in your case in the /etc/ntp/step-tickers
      file which causes ntpdate to be run against that host when
      ntpd is started by /etc/init.d/ntpd).



On Sat May 7 2005, Eric Dunbar wrote:

> Hello, I've got a server that likes to loose 30 to 60 seconds each
> week. I'm trying to get ntpd working but haven't had much success.
> 
> I tried uncommenting the server line in /etc/ntp.conf and changing the
> URL to ntp2.cmc.ec.gc.ca before running ntpd from the command line and
> it doesn't do much.
> 
> I've now tried a very simple /etc/ntp.conf file:
> server ntp2.cmc.ec.gc.ca
> 
> As suggested by the ntp website and that doesn't work.
> 
> (I wait a few mintues, checking system time using 'date' and ntp
> activity with ntpstat)
> 
> However, if I run either
> ntpdate ntp2.cmc.ec.gc.ca
> 
> or
> 
> ntpd -qd
> 
> The date is updated to the correct time.
> 
> Should ntpd -q be run as a cron job? Seems a little strange for a
> daemon to run as a cron job.
> 
> Anyone have experience with ntpd?


More information about the yellowdog-general mailing list