OpenBSD Journal

NTP Basics

Contributed by jose on from the keepin-time dept.

The fine folks at The O'Reilly Network have put together a bit of documentation on getting started with NTP . NTP, the network time protocol, is far simpler to use than most people realize. Installed from the ports tree , once installed you're set up for time quite handily.

(Comments are closed)

  1. By RC () on

    The only problem with NTP is that their example configuration files they provide are terrible. I'd bet that 90% of NTP users just want to type in a couple NTP servers, and forget about it... Meanwhile, their example configs are extensive, and mostly deal with hardware GPS devices. Adding one simple sample file couldn't be difficult, and would likely take care of most problems people have.

  2. By fuzzyping () on

    Never mind that OpenBSD includes an SNTP-capable rdate. Just edit your /etc/rc.conf entry as such:



  3. By mirabile () on describes _why_ exactly ntp is broken. <br> <br> I had a discussion on #OpenBSD yesterday. I cannot <br> recommend a NTP server. <br> On the client side, there is /usr/sbin/rdate: <br> <br> <br> On the server side I only can recommend djb taiclocks, <br> which unluckily doesn't speak the (broken) SNTP <br> protocol, but rather the taiclock-protocol (NIH :), <br> which makes it need taiclock as a client. <br> <br> I started thinking about bringing taiclock support <br> to rdate(8) yesterday, maybe jakob@ would commit <br> it if it proves stable enough.

  4. By Ben Goren () on

    About the best thing Mr. Graham has done is let people know that NTP is easy to use. It's a shame that he rather missed the boat on the best simple way to use it.

    First, his math is off. Both and are stratum-1 servers, not stratum-2. This makes his first example a stratum-2 server, not stratum-3.

    Next, he says that he'll show an example with one local computer synching to multiple external servers and make the local computer be a server to all internal hosts. So why does his example for an internal computer query an external stratum-1 server? Incidentally, by doing so, he makes the internal computer a stratum-2 server, not stratum-4.

    His last piece of advice is to run ntpdate every hour via cron. I'm sorry, but doing so completely defeats the whole purpose of NTP. Any computer that has ntpdate also has ntpd. You're far better off running ntpd than ntpdate, as the former has the ability to constantly adjust the computer clock based on the calculated drift rate. With ntpd, it's not unheard of to have cheap PCs synched to within a millisecond or three. Without, if you've got cheap PC hardware, you could easily be jumping in time by a second or more each time cron fires off ntpdate.

    You can greatly enhance the accuracy of all computers in question by using the “peer” keyword in /etc/ntp.conf. If two computers refer to each other as peers, then they'll compromise on the proper time, each suggesting and accepting adjustments to and from the other. So, what you do, is have your local externally-connected NTP master refer to (several, not just two) stratum-2 or higher public NTP servers as “server” and to as many as possible internal computers as “peer.” All internal computers refer to as many other internal computers, especially including the local master, as “peer.” In normal operation, you get a “cloud&rdqup; of time servers, each contributing to a pool of the correct time, with the internal master having a much stronger voice than the rest. When the external link is severed, a great deal of inertia remains, such that the link can stay severed for a long period of time without any one computer ever getting more than the tiniest bit off.

    Your example files will look like this:



    Note: Please be careful in picking your external NTP servers. Make sure that their owners are okay with you using them and try to pick ones that are topographically close.

    Your internal computers will all have the same configuration file:


    On a final note, it's a good idea to get familiar with ntpq, especially the -p option. Lots of good information to be had, there.



  5. By Robert Mooney () on

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

    I've actually started using NetTime ( instead of AboutTime for the Windows clients, as it seems to be more stable.

  6. By Chad () on

    The problem with ntpdate is very simple, it is a one time shot client.

    So what does everyone do? they cron it.

    Imagine 2000+ servers hitting one ntp server at the exact same time of day, or on half hour/hour mutiples.

    It scales very bad.

    I would suggest using ntpd as a client, because it will have more average dispertion.


Copyright © - Daniel Hartmeier. All rights reserved. Articles and comments are copyright their respective authors, submission implies license to publish on this web site. Contents of the archive prior to as well as images and HTML templates were copied from the fabulous original with Jose's and Jim's kind permission. This journal runs as CGI with httpd(8) on OpenBSD, the source code is BSD licensed. undeadly \Un*dead"ly\, a. Not subject to death; immortal. [Obs.]