SoCruel.NU

The domain that loves BSD

Home About Me Archive Contact

How to implement OpenNTPD on FreeBSD

One of the first things to take care of in a network is making sure that your infrastructure equipment like servers, routers, etc., run all the same time. The Network Time Protocol was developed for this specific purpose. FreeBSD has several ways of dealing with time and time synchronization. One way is using the OpenNTPD server which is based on requirements which I very much like.

Requirements

The following requirements have to be in place to be able to implement what is described in this post:

  • an up to date FreeBSD system with the ports installed
  • a connection to the internet
  • name resolution setup properly.

Installation

The FreeBSD Ports are used to install the OpenNTPD software:

# cd /usr/ports/net/openntpd
# make install clean

Configuration

OpenNTPD can now be configured. To be able to use the daemon the following line must be added to /etc/rc.conf of your FreeBSD system:

openntpd_enable="YES"

The configuration of OpenNTPD is kept in one file called /usr/local/etc/ntpd.conf. Edit this file with your favorite editor and make sure you set the right values for the listen on and server entries. I.e. for an internal time server running on an internal network with a private IP address and getting it’s time from a Dutch pool.ntp.org time server these entries could look like:

listen on 10.110.120.2
server 1.nl.pool.ntp.org
server 2.nl.pool.ntp.org

After saving the configuration file /usr/local/etc/ntpd.conf the OpenNTPD daemon can be started with the following command:

# /usr/local/etc/rc.d/openntpd.sh start
or
# service openntpd start

Resources

Some resources about this subject:

Updated: August 15, 2018