October 16, 2018

How to Install NTP to Synchronize the System Clock on FreeBSD

FreeBSD Logo

On FreeBSD you can synchronize your system clock with the Network Time Protocol (NTP). The NTP client can be installed from the FreeBSD ports tree. Once the NTP client is installed you can use the ntpdate command to synchronize the system clock with a NTP server.

Root access is required to edit the following files and to execute commands. Log in as root (su) or simply prepend sudo to all commands that require root privileges.

Install the NTP client

Install the NTP client from the FreeBSD ports tree.

cd /usr/ports/net/ntp
make install clean; rehash

Select a NTP Server

Visit the NTP timeserver list and select your NTP server. Usually it is the nearest NTP server to your server location. The nearest pool is the one with less latency, and less latency will allow you to get better accuracy in your synchronization.

Firewall settings

For those who have a firewall running you need to open the UDP port 123.

Synchronize the System Clock

Now, that the NTP client has been installed we can synchronize the system clock. Please replace us.pool.ntp.org with your prefered NTP server.

ntpdate -v -b us.pool.ntp.org

Check that the system clock is correct.


Enable the clock synchronization on system start

Open the rc.conf.

vi /etc/rc.conf

Make these settings in you rc.conf to synchronize your system clock on system-start.


Speak Your Mind