Setting up an OpenBSD NTP server (and time synchronizing Windows clients)

(Last modified: 10/12/00)


Setting up your local network for time synchronization can seem overwhelming, especially when you have little to start with. I figured I would write a document on setting up the Network Time Protocol, once I had a basic working knowledge and a setup to go along.

If you have any questions or comments, feel free to drop me a note. Remove the ".nospam" on the end of my username to send me mail.

Note that I've written most of this document from memory. It appears to be correct; if I've missed something, let me know.

Described Network

Here's my network setup:

                                (( Internet ))
                              | OpenBSD firewall |
                       ( various windows and unix hosts )
I will describe the setup on the OpenBSD firewall, and my main desktop machine (which is a Windows based box).

Initial Setup

To start, make sure you are running a recent version of OpenBSD. The latest available at the time of this writing is 2.7-current. I suggest making sure you have the latest rc.conf, rc.local and rc.securelevel files in place.

Also, make sure your /etc/localtime file is linked to the correct time zone file for your region. For example, if you were in the Canadian Atlantic time zone, your /etc/localtime file should be linked as follows (from afterboot(8)):

           ln -fs /usr/share/zoneinfo/Canada/Atlantic /etc/localtime
This will designate Atlantic Standard Time as your system's time zone.

Compiling NTPD

Next, compile and install XNTPD, located in the OpenBSD ports collection directory, sysutils/xntpd. This can (usually) be accomplished by typing "make all install" as root in that directory.

Configuring NTPD

Next, create an NTP configuration file. This is located at /etc/ntp.conf, by default. Placing the following in the configuration file will more than likely suit your needs:
server prefer
See the references section for information on where to find public NTP servers.

Initializing the System Clock

Next, run ntpdate -b <server> to synchronize your system's time, where <server> is one of the servers in your ntpd.conf file.

If you would like the OpenBSD machine's system time to be synchronized on boot, modify the ntpdate_flags variable in /etc/rc.conf to equal one of the servers specified in your ntp.conf file.

Running this command is a good idea, as any significant deviation of your system's time from the actual time (as reported by the configured servers) will cause NTPD to exit (and therefore leave your system time desynched from the rest of the world).

Running NTPD

Finally, run NTPD. By default, it is installed in /usr/local/sbin/ntpd. To monitor the status of the NTP daemon, use the utility /usr/local/sbin/ntpq. This is an interactive client to the NTP daemon running on your machine. The two commands I find most helpful in debugging the NTP daemon are "pe" and "rv", which allow you to see a peer list and read the current NTP variables, respectively. See the NTPD documentation for more details.

If you would like NTPD to run automatically the next time your system is re- started, modify the ntpd variable in /etc/rc.conf to equal "YES".

Providing NTP Access to Other Hosts

By default, your NTP server will provide time service for other hosts, unless you specify otherwise in ntp.conf. See the NTP configuration URL below for information on how to restrict this service.

NTP Clients for Platforms Other Than UNIX

There are a number of clients available for platforms other than UNIX. For Windows based machines, I suggest AboutTime: a small, easy to use, and free NTP client. It can be downloaded at

Configuring AboutTime

The AboutTime version described here is 4.8.

To configure AboutTime to poll your local NTP server (i.e. the OpenBSD box), start the application and remove all hosts under the Time Hosts tab.

Next, add an entry for your local (OpenBSD) NTP server. Set the protocol to SNTP.

Next (optional), disable all protocols under Time Servers, except SNTP.

Under Options, make sure it is polling at a reasonable interval.

Finally, have AboutTime set the time at startup.

I also suggest making a shortcut to the AboutTime executable in the Startup folder for the system. Under Windows NT, this directory is (usually) located at:

C:\WINNT\Profiles\All Users\Start Menu\Programs\Startup
When the machine boots, AboutTime will now be started automatically. If the Set Time When Starting option was set, it will also sync with your local time server.

Test your setup: under the Control/Time Client tab, click Set Time, and make sure the Windows machine synchronizes properly. If not, recheck your configuration on both the OpenBSD and Windows machines.

Additional Notes

If the Windows machine is behind an hour when synching, make sure it accounts for Daylight Savings Time. In the Control Panel, double click Date and Time, then click the Time Zone tab. Make sure "Automatically adjust clock for daylight savings changes" is checked.

To get a fairly accurate reading of the current time from the US Naval Observatory, check out:


Information regarding NTP configuration can be found at:

A List of public NTP servers can be found at:

Complete documentation can be found at:

The Time Synchronization homepage:


Written by Robert Mooney ( Remove the ".nospam" to email.

Copyright © 2000 Robert Mooney, All rights reserved.

This document may be freely distributed and modified, so long as the original author is credited.

Return to the Projects index