Keeping the correct time


Jump to: navigation, search



Your router's internal clock will drift over time like all computer clocks. Normally an operating system provides some functionality to keep it synchronized and so does FreeBSD but it isn't activated by default. You'll have to activate it now and by doing so you'll also provide a time server that your local LAN clients can use. The time server will listen on every interface by default, but since you have no firewall rule allowing such incoming requests on the external interface it will in practice only service requests from your LAN.


Add the following rows to /etc/rc.conf:


Check's list of public NTP pool servers and select a pool server from the region you live in. Create a file named /etc/ntp.conf and enter the rows below but exchange the pool server with the one you selected from your region.

logfile /var/log/ntpd.log

Start the time server but first set the correct time once with ntpdate since ntpd doesn't handle huge time deviations well. This will be taken care of automatically at boot time from now on.

# /etc/rc.d/ntpdate start
# /etc/rc.d/ntpd start

Daily reports of the NTP status can be generated if you wish.

# echo 'daily_status_ntpd_enable="YES"' >> /etc/periodic.conf


  • The configuration file for the time server is /etc/ntp.conf.
  • The start/stop script for the time server is /etc/rc.d/ntpd.

Unresolved issues

  • ntpd doesn't support newsyslog's method to rotate logs. I'm still looking for an alternative way.


Next guide: Mail server configuration
Personal tools