NTP (Network Time Protocol) is an Internet protocol used for synchronizing the clocks of networked computers. Computer clock accuracy is instrumental in providing a consistent reference for system log files, email timestamps, time-activated scripts, and so on. The NTP system is capable of keeping your computer’s clock accurate to within a few milliseconds of an accurate time server. Time servers are usually connected directly to a source of accurate time (e.g., atomic or GPS clocks).
In this article we will discuss about installing and configuring FreeBSD as NTP Server. For that purpose, I use:
- FreeBSD amd64 8.3
How it Works?
A server running the NTP daemon periodically synchronizes its clock to one or more established time servers. Over time, the NTP daemon calculates the system-specific clock error. If the system temporarily loses Internet connectivity, the NTP daemon will keep the system clock accurate using this error (or clock drift) data until it can re-synchronize with a time server.
Make sure we have became superuser before proceeding to next stage.
Installation of NTP is as easy as install other ports.
cd /usr/ports/net/ntp make config make install clean rehash
At this point, we have successfully install NTP Server. Before using it, we should do a minimum configuration.
Create a drift file for storing clock correction data. In this article, we will store the drift file at /etc/ntp as drift. The drift file is used as
Next, we will select appropriate time servers for synchronization. Choose the closest time server available to our network (geographically). The updated list of public time servers can be viewed here. This will make our server adjusting the time relative to our selected time server. Note this, and at least use three network servers.
Next, create and edit /etc/ntp.conf. This file will be our NTP’s configuration file. Later, write these into ntp.conf:
server time.example1.com iburst server time.example2.com iburst server time.example3.com iburst driftfile /etc/ntp/drift logfile /var/log/ntp.log
In above example, we use time.example1.com, time.example2.com, and time.example3.com as our network time server.
To make our NTP daemon automatically started at boot time, add following lines to /etc/rc.conf:
ntpd_enable="YES" ntpd_program="/usr/local/bin/ntpd"freebsd, ntp