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"
ntp_leapfile_sources="ftp://tycho.usno.navy.mil/pub/ntp/leap-seconds.list"
To configure the the NTP daemon edit /etc/ntp.conf
Substitute your own preferred public time servers in this example configuration:
server clock.uregina.ca server clock.fmt.he.net server clock.nyc.he.net server time.nrc.ca server clock.nyc.he.net # IPv4 restrict -4 default limited kod nomodify notrap nopeer noquery restrict 127.0.0.1 restrict 192.168.0.0 mask 255.255.0.0 # IPv6 restrict -6 default limited kod nomodify notrap nopeer noquery restrict ::1 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)
Adjust the server line(s) in /etc/ntp.conf
to include your user defined values.
server time.nrc.ca minpoll 8 maxpoll 16
NTP by default logs to the default system syslog facility.
To specify a specific log file location add the logfile option to /etc/ntp.conf
logfile /var/log/ntpd.log
Start the service with service ntpd start
You can view the current status of the running ntpd with ntpq -p
remote refid st t when poll reach delay offset jitter ============================================================================== *CLOCK.UREGINA.C .GPS. 1 u 119m 18h 377 16.334 -114.07 211.040 +clock.fmt.he.ne .CDMA. 1 u 11h 18h 357 103.994 87.410 87.084 -clock.nyc.he.ne .CDMA. 1 u 13h 18h 377 98.231 115.145 145.857 +time12.nrc.ca 132.246.11.231 2 u 12h 18h 377 46.890 101.514 124.000 -d24-150-203-150 .PPS. 1 u 12h 18h 377 54.767 107.637 135.019
Columns Defined:
* = current time source
# = source selected, distance exceeds maximum value
o = source selected, Pulse Per Second (PPS) used
+ = source selected, included in final set
x = source false ticker
. = source selected from end of candidate list
– = source discarded by cluster algorithm
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