Proper Method of Time Sync?

wc_fbsd at wc_fbsd at
Fri Apr 14 16:06:28 UTC 2006

At 11:40 AM 4/14/2006, Jonathan Horne wrote:
>i have read about 2 methods to sync the time on a freebsd box.
>...i have a workstation and a server, which i originally did method 
>1 on, but soon enough, time drifted quite a bit.  so i switched it 
>to the 2nd method, and they appear to be sync'd perfectly.  a third 
>box i set up, i did only method 2, and this one did not stay synced 
>at all.  after i manually ran 'ntpdate -v -b', this 
>box straightend up.

First off, ntpdate is obsolete, and will be retired "sometime in the 
future".  Its functionality has been incorporated into ntpd.  I think 
your problem is a limit in ntpd that's enabled by default.  There is 
a limit on how large a correction ntpd will make at one time, even at 
boot up.  ntpdate isn't that picky and always just syncs, even if the 
offset is large.

Try some rtfmp on ntpd, ntpdate and ntpd.conf.  I run ntpd on one 
server, with a flag (-g) set to always sync, eg:

ntpd_sync_on_start="YES"        # Sync time on ntpd startup, even if 
offset is high
ntpd_flags="-A -p /var/run/"

And ntp.conf:
driftfile       /etc/ntp.drift
logfile         /var/log/ntpd.log
restrict mask nomodify notrap

My other servers and desktops are similarly configured, but sync off 
the first server.

Be sure to specify the driftfile;  ntpd will "learn" how fast or slow 
your clock is and record it, so it can apply corrections when/if an 
internet connection isn't up.  Be sure the file exists and has some 
number.  You can initialize with:  echo "0" > /var//db/ntp.drift 

More information about the freebsd-questions mailing list