April 21, 2003

ntp for freebsd for newbies

Want to sync your clock in FreeBSD? I will show you how.

The daemon in FreeBSD 4.x is called ntpd. (The old daemon, circa 1998, circa 3.x, is called xntpd. You will still see references to xntpd in some config files, but if you find other instructions on the net telling you to run /usr/sbin/xntpd, don't.) ntpd reads its settings from /etc/ntp.conf, which by default doesn't exist. Create it and add:

server [address of time server] prefer
driftfile /etc/ntp.drift

This is all you need. If you want to add a second time server for redundancy, add a second 'server' line just like the first, but without the 'prefer' directive. For more options 'man ntp.conf'. The U.S. Navy provides a list of time servers.

Now, to tell the ntp daemon to start at boot time. In rc.conf add:

xntpd_enable="YES"
xntpd_flags="-p /var/run/ntpd.pid"

and then reboot. If you put ntp.conf somwhere other than the default of /etc/ntp.conf, then use the -c flag and add '-c /new/path/ntp.conf'

If you don't wish to reboot you can start the ntp daemon manually with:

/usr/sbin/ntpd -c /etc/ntp.conf -p /var/run/ntpd.pid

Check to see if it worked with 'ps -aux'.

Hope this helps. If you're using Windows, get started with 'net time'. Microsoft offers more detailed instructions.

Posted by complex at April 21, 2003 10:11 PM | TrackBack
Comments
Post a comment









Remember personal info?