ntpd with flags in rc.conf

Alex Zbyslaw xfb52 at dial.pipex.com
Thu Oct 12 06:51:27 PDT 2006


Zbigniew Szalbot wrote:

> I have a question about ntpd. HOw is the time adjusted? Gradually over 
> time? Because I can see 30-second difference between my pc and FBSD 
> machine. Will it be minimized in the longer run? Thanks!

You're best off directing followup questions back to freebsd-questions 
as you may well get answers quicker than if you just ask me!

ntpd adjusts time slowly, but the -g option should make it set the time 
correctly when it starts from when it should keep in sync.  Set --g in 
your ntpd_flags and then as root run

    sh /etc/rc.d/ntpd restart

With -g it can still take a while (several minutes) before ntpd trusts 
its servers enough to set the time,  Many people, I believe, use ntpdate 
to set the time once at startup and then use ntpd to keep it in sync.  
(Ignore the comment on the manual page for ntpdate about it being 
deprecated.  It has said that for a long time and shows no sign of going 
away).  I believe ntpdate will pick up servers from your ntpd.conf.

The man page for ntpd has more info on how ntpd keeps the time, and also 
check out ntpdc which can show you what ntpd is doing (which servers 
it's using and stuff).

When you say the time on your PC is 30 seconds different, do you mean a 
Windows pc?  Maybe it's the one that's wrong, or maybe your local ntpd 
isn't finding any servers.

As root:  ntpdc -c dmpeers

should get you a list of the servers ntpd is polling and a * shows the 
one it is currently trusting, if i recall.

--Alex





More information about the freebsd-questions mailing list