ntpd - Network Time Protocol Daemon

NTP is installed by default on FreeBSD.

When the NTP daemon is running and synced with external time sources, you can configure your Intranet PCs and connected devices to sync their time with it.

 

The daemon can be enabled at boot time by adding to /etc/rc.conf

ntpd_enable="YES"
ntpd_sync_on_start="YES"

 

By default ntpd will use NTP time servers assigned via the 0.freebsd.pool.ntp.org pool.
To configure the the NTP daemon to instead use your desired upstream time servers, edit /etc/ntp.conf

Comment out to disable the following line:

pool 0.freebsd.pool.ntp.org iburst

Add your preferred public time servers as well as access control directives to the bottom of the configuration:

server clock.uregina.ca
server time.nrc.ca
server ntp.torix.ca
server clock.sjc.he.net
server clock.fmt.he.net
server clock.nyc.he.net

restrict 192.168.0.0 mask 255.255.0.0
restrict 2001:xxxx:xxxx:xxxx:: mask ffff:ffff:ffff:ffff::

NOTE: ntpd will by default bind to all available interfaces in the system. On your firewall do not permit ingress NTP connections (port UDP 123) from the Internet to your server unless you have a specific need to do so.

When choosing public NTP servers to configure, select the ones that is geographically close and review its usage policy. Web search for 'public ntp stratum 1' + 'your country'

minpoll and maxpolI values default to: minpoll 6 (64 seconds) and maxpoll 10 (1024 seconds)
Should you desire to use different min and max polling intervals, this chart displays the calculated times of all valid values (4 - 17)

Chart of valid minpoll and maxpoll values with respective time intervals

Adjust the server line(s) in /etc/ntp.conf to include your desired values.

server time.nrc.ca minpoll 8 maxpoll 13

NTP by default logs to the default system syslog facility.
To specify a log file, add the logfile option to /etc/ntp.conf

logfile /var/log/ntpd.log

 

Start the service
service ntpd start

 

To view the current status of the running NTP daemon:
ntpq -p

     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
*CLOCK.UREGINA.C .GPS.            1 u    2  512  377   26.274   -0.109   0.618
-time12.nrc.ca   132.246.11.231   2 u   41  512  377   65.282   -1.345   0.317
-ntp2.torix.ca   .PTP0.           1 u   38  512  377   49.414   +3.636   0.407
+clock.sjc.he.ne .CDMA.           1 u  273  512  337   47.117   +1.830   0.881
+clock.fmt.he.ne .CDMA.           1 u   67  512  377   47.229   +2.239   0.541
-clock.nyc.he.ne 127.67.113.92    2 u   70  512  377   76.958   +5.716   3.804

Columns Defined:
* = current time source
+ = source selected, included in final set
o = source selected, Pulse Per Second (PPS) used
# = backup (more than tos maxclock sources)
– = source discarded by cluster algorithm
x = source discarded, false ticker
. = source discarded by table overflow (not used)
blank = source discarded, high stratum, failed sanity

remote: the time source peer specified in ntp.conf

refid: remote source’s synchronization source

st: stratum level of the source

t: the type of connected time source
l = local (i.e. GPS)
u = unicast (most common type)
m = multicast
b = broadcast
– = netaddr

when: number of seconds passed since last response

poll: polling interval, in seconds, for source

reach: indicates success/failure to reach source, 377 all attempts successful

delay: indicates the roundtrip time, in milliseconds, to receive a reply

offset: indicates the time difference, in milliseconds, between the client server and source

jitter: indicates the difference, in milliseconds, between two samples