SurlyJake Blog

FreeBSD Time Updates With Ntpdate and Ntpd

| Comments

So FreeBSD’s time is out of wack. Two options:

  1. ntpdate. This is manual. To run a time sync manually, just run

    ntpdate -b pool.ntp.org

You can replace pool.ntp.org with whatever you want. To tell it to run whenever the system is booted, add this to /etc/rc.conf:

ntpdate_enable="YES"
ntpdate_hosts="[your ntp server]"

This works, but if you don’t reboot often, could be unreliable.

  1. ntdp. ntpd just runs all the time and keeps you nsync with internet time servers. You would want to use this for servers that you don’t reboot all the time. for this:

create an /etc/ntpd.conf file:

server pool.ntp.org
driftfile /etc/ntp.drift
logfile /var/log/ntpd.log

you can start ntpd manually:

ntpd

and/or add a startup entry for it in /etc/rc.conf:

ntpd_enable="YES"

I recommend setting up both of these on servers. Ntpdate will snap your system to a good point before you begin synchronizing with ntpd. ntpd by itself will take a lot longer to get you synced up.

Comments