Introduction

Having your machines synchronized to the correct time is very practical! Especially when you’re trying to read logs from two different machines.

For those who need microsecond-level precision, OpenNTPd is not the right solution - use the traditional NTP server instead.

Installation

Nothing to do :-)

Configuration

Open the /etc/ntpd.conf file and configure it as follows:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
# $OpenBSD: ntpd.conf,v 1.8 2007/07/13 09:05:52 henning Exp $
# sample ntpd configuration file, see ntpd.conf(5)

# Addresses to listen on (ntpd does not listen by default)
# listen on *

# sync to a single server
server 0.pool.ntp.org
server 1.pool.ntp.org
server 2.pool.ntp.org
server ntp1.jussieu.fr

# use a random selection of 8 public stratum 2 servers
# see http://support.ntp.org/bin/view/Servers/NTPPoolServers
servers pool.ntp.org

This is a basic configuration, but it works well.

Next, edit the /etc/rc.conf.local file to indicate that the NTP server should start at boot time, and modify the line as follows:

1
ntpd_flags="-s"

Now, if you want to start the daemon to see how it works:

1
ntpd

Verification

To ensure that everything is working, use this command:

1
tail -f /var/log/daemon

It can take up to about 4 minutes to synchronize your machine.

Manual Synchronization

If you want to perform a manual synchronization, use this command:

1
rdate -ncv 0.pool.ntp.org

Resources

Last updated 21 May 2009, 11:40 CEST. history