The pool wants you!

As Chicago said back in 1970, does anybody really know what time it is? The message of the song is that we really shouldn’t care. But when it comes to our computer systems and other gadgets, having an accurate clock matters.

Widely used security protocols like Kerberos (which Windows uses to authenticate access permissions to folder shares) depend on the clocks of different computers being synchronized—if the clocks differ by more than a few minutes, Kerberos-based authentication attempts will fail. If you are a software developer, incremental build tools like make rely on the time stamps on source and object code files being accurate, regardless of the system where the file was created or modified. Widely used file synchronization protocols like rsync can also rely on file time-stamp information, depending on how they are used. These are but a few examples; in our increasingly wired world, many of our devices really do depend on knowing the time and assuming other devices to which they talk know, as well.

You may be thinking, "But wait, my computer’s CMOS clock keeps track of the time, so why do I need to care?" The problem is, your computer’s CMOS clock typically has worse accuracy than a cheap wristwatch. As computer motherboards became commodities, manufacturers started cutting corners on things like accurate CMOS clocks. Over a period of just a few weeks, that clock can drift way off. If that weren’t bad enough, when the computer is actually running, the OS keeps track of the time itself instead of relying on the CMOS clock. However, the clock source used by the OS (typically derived from the CPU clock) can be even more inaccurate than the CMOS clock—a clock that drifts by a minute or more in a single day isn’t uncommon.

Given that nearly every computer is now connected to the Internet, the solution seems obvious: synchronize the clock to a known accurate source online. All modern OSes provide a means to configure an Internet time service to keep the clock synchronized. But who provides the accurate time source to which you’re synchronizing? That’s a very good question… and a lead-in to a brief history lesson and the point of this whole blog post.

A brief history of (network) time

(With apologies to Stephen Hawking.)

The need for accurate time synchronization between computer systems was already recognized as an issue in the early days of the Internet, and it led to the development of the Network Time Protocol. Back in those days, the number of systems connected to the Internet was small, and usage was limited to government, military, and educational institutions. These same institutions provided a small number of central time servers that were used to synchronize time for all systems across the Internet.

Then the dot-com boom happened, and everybody got online. The number of systems connected to the Internet rose exponentially, and even embedded devices started using the NTP protocol to keep their clocks accurate. Existing time servers could barely keep up with the load; and if that wasn’t bad enough, several manufacturers of consumer networking equipment inadvertently launched DOS attacks against several public NTP servers by hard-coding the IP addresses of specific time servers into the firmware of thousands of devices. D’oh!

Clearly, something had to be done. Enter the NTP Pool Project. Many of you are already familiar with distributed computing in the form of Internet-based computing efforts like Folding@home. The NTP Pool is essentially the same concept applied to time servers, i.e. distributed time serving.

How the pool works

The concept behind the NTP pool is fairly simple: use a number of systems distributed across the Internet to serve accurate time to everyone. The servers in the pool ultimately get their time from accurate time servers provided by governments, universities, ISPs, and anyone else who operates a public Stratum 1 or Stratum 2 time server. (Stratum 1 servers get their time directly from a known accurate source like a GPS or WWV Radio, while Stratum 2 servers get their time directly from Stratum 1 servers. Everyone else is Stratum 3 or below.)

The NTP Pool Project operates a DNS server. When you configure your system or device to use an NTP pool server like us.pool.ntp.org, you’re actually asking the NTP Pool DNS server to randomly assign you to a set of time servers that are (hopefully) geographically close to you. The default NTP servers Microsoft Windows uses when you enable Internet time synchronization (time.windows.com) are part of the NTP pool, as are the default time servers configured by all of the major Linux distros. So, you’re probably already using the NTP pool without even knowing it!

Joining the pool

If you have an always-on broadband connection, you can help the NTP Pool Project. By adding your system to the pool, you will improve the accuracy of Internet time service for everyone by helping share the load. You need a static IP address and the ability to unblock/forward UDP port 123 on your router or firewall. You also need to run the reference NTP server implementation. That’s a no-brainer for UNIX/Linux users, since the server is probably already included on your system. For Windows users, you will need to install the Windows port of the NTP reference server, since Windows doesn’t include one out of the box.

When you join the pool, you tell the NTP Pool the speed of your broadband connection. The NTP Pool will include you in the server rotation at a rate that depends on your broadband speed, only consuming a small fraction of your available bandwidth. If you’re still concerned about bandwidth usage, you can configure a value lower than your actual connection speed to throttle the usage back even further. When joining the pool, you’ll want to configure a few Stratum 2 servers near you from this list from which to synchronize your own server. Unless you’re willing to do some extra legwork to get permission from the administrator(s) of the upstream server(s), only select servers that have an open access policy and no notification requirement (as noted in the list). If your ISP operates an NTP server for its customers, you can also use that as one of your upstream servers.

The NTP Pool project monitors the accuracy, network latency, and availability of your time server by polling it twice an hour, and assigns you a score based on this monitoring. Periods of high network latency, unavailability, or instances when the time your server reports is off by more than 100 milliseconds will result in deductions from your score. Conversely, periods of low latency and high accuracy cause that score to rise. Your system is only included in the pool rotation when your score is above +5 (scores range from -10 to +20).

You can access the monitoring data for your server on the NTP Pool web site. The screenshot below shows some of the monitoring history for my server. The dips and peaks in the "offset" graph (and corresponding drops in score) correspond to periods of high Internet activity (i.e. downloads) on my DSL connection, which trashed my network latency.

NTP Server Stats

So, dive in! The water’s fine… and the next time someone asks you if you really know what time it is, you can give them a definitive answer.

Comments closed
    • chiikmilsen
    • 9 years ago

    OK. I got the pool 14 by 42 to be exact easy set well it was easy set up. I did not know you have to add this and that every so many days.

    ยง[< http://www.articlesbase.com/business-articles/online-fax-services-30-days-free-trial-review-2979505.html<]ยง

    • shaq_mobile
    • 10 years ago

    “If you have an always-on broadband connection, you can help the NTP Pool Project. By adding your system to the pool, you will improve the accuracy of Internet time service for everyone by helping share the load.”

    lol. he said load. lol.

    • Aphasia
    • 10 years ago

    Really nice post about NTP. Havent used the pool myself but are using the goverment(Swedish National Laboratory for Time and Frequency) funded Stratum-1 NTP servers that are run together with the main Internet exchange points. And those in turn supply the metrological services and most other sources within the country with time.

    At my main customer we use a blended setup where we in part uses the source above, in part uses GPS-clock, and in part uses yet another source.

    • aces170
    • 10 years ago

    Nice blog, some really intresting stuff which I was not aware. Always thought M$ had some atom based clock and linked its time servers to it ๐Ÿ™‚

    And yeah, a break from the Apple articles ๐Ÿ™‚

      • just brew it!
      • 10 years ago

      q[

    • End User
    • 10 years ago

    A screen shot taken in Ubuntu. Hurray!

    • IntelMole
    • 10 years ago

    We’ve just been doing some time synchronisation monitoring at work with some servers located across two or three sites.

    Let me tell you, when you drop the assumption that all computation is instantaneous (as you have to when you start trying to measure sub-ms timing differences), measuring stuff accurately is HARD, and is subject to error in about a thousand different ways, not least because soft real-time systems like linux break your whole abstraction in many small subtle ways.

    If you need an example, think about what happens if your process happens to wake up with exactly the same period as another process, which may or may not hammer the same resources you’re using with much higher priority than you. You have no way of detecting when you get in sync with this other process. The way I solved this was to do an average of the last 100 differences, and should the last difference be 3x this or more, insert a random delay up to one second, and restart my monitoring.

    As such, I do not envy the original coders of the NTP protocol. Just thinking of it reminds me of that quote (probably paraphrased): “any sufficiently advanced technology is indistinguishable from magic”.

      • just brew it!
      • 10 years ago

      Yup, we deal with this sort of thing where I work too — soft real-time systems which need to maintain a synchronized clock with other systems. IIRC we did something similar to you (i.e. keeping a history buffer to smooth out random variations), and slewing our clock forward or back to get it in sync with our best guess at the clock of the device we’re trying to synchronize to.

      I agree, designing the NTP protocol and algorithms must have been quite challenging. NTP is capable of synchronizing down to the level of ~10 ms or so over the Internet; that is pretty amazing stuff, given how variable the latencies are. To put it in perspective, 10 ms is less than the time it takes to display a single video frame on a typical computer screen.

    • Captain Ned
    • 10 years ago

    I’ve been using AtomTime since forever to keep my clock straight.

    • notfred
    • 10 years ago

    I have a dynamic IP so cannot join the pool, but I use time.nrc.ca and time.chu.nrc.ca and my ISP peers at OTTIX with the NRC. Nothing like being low latency to Canada’s official time!

    It’s also possible to do Stratum 1 yourself with a GPS receiver.

      • just brew it!
      • 10 years ago

      q[

    • indeego
    • 10 years ago

    “Existing time servers could barely keep up with the load; and if that wasn’t bad enough, several manufacturers of consumer networking equipment inadvertently launched DOS attacks against several public NTP servers by hard-coding the IP addresses of specific time servers into the firmware of thousands of devices. D’oh!”

    Well the solution to the consumer networking devices is to blacklist the requests and the devices.

    Link to issues regarding the time servers? I’ve seen no evidence of this using various time servers here on the west coast. Seems like a fairly big project with a lot of wasting time[heh] g{

      • UberGerbil
      • 10 years ago

      g[

      • just brew it!
      • 10 years ago

      q[

    • Flying Fox
    • 10 years ago

    Can those dynamic-ip “addresses” be used or you really need a static, publicly-routeable numbered IP?

      • just brew it!
      • 10 years ago

      Yeah, unfortunately they really do want you to have a static IP, or at the very least, one that changes at most every few months. NTP clients may cache the IP address until they are restarted/rebooted, so the servers in the pool need to stay put.

      A properly configured NTP client will actually have several servers configured, and use some heuristics to select the “best” one. So a server changing IPs or becoming temporarily unreliable isn’t the end of the world; but it does degrade the quality of service available from the time pool.

    • Krogoth
    • 10 years ago

    THE POOL IS CLOSED!

    (Sorry, I couldn’t resist that meme)

    • Sargent Duck
    • 10 years ago

    I only care about 1 time. 5:00pm (monday to Friday).

      • SomeOtherGeek
      • 10 years ago

      +1 Same here!

      • ew
      • 10 years ago

      Three cheers for 5:00pm!!!

    • zima
    • 10 years ago

    Yeah, keeping PC clock acceptably synchronized was a solved problem for quite some time.

    What irks me is mobile phones; why nobody included using time signals from towers (which certainly must do precise timekeeping) in GSM specs to keep the cellphone constantly synchronized?!

      • stdRaichu
      • 10 years ago

      Pretty sure my Nokia E52 supports getting the time from the network on bootup.

      As far as NTP goes, alot of people don’t realise it’s pretty trivial to add a single NTP server to your network and, as well as adding it to the pool, every other device in your local LAN can sync off it, reducing load further. Even windows hosts have no problems syncing with my NTP servers – just point it to your local hostname in the “internet time” panel.

        • just brew it!
        • 10 years ago

        Yup, I really should’ve mentioned that in the original blog post. That’s how I’ve got my home network set up, and it is also how we have the network at work set up. The main file server is also the NTP server for all of the other systems on the network, so only one system is actually querying the external time servers. Regardless of whether you’re syncing to the pool, or syncing to external Stratum 2 servers and participating in the pool, it is a good way to reduce load on the time servers. It is just one aspect of being a good ‘net citizen.

        It will also give you tighter time synchronization among the systems on your network, since they will all be syncing to the same local low-latency time source.

        • zima
        • 10 years ago

        Well, but for example Nokia E50 that I still have lying around here, and which isn’t that far off from yours, certainly doesn’t.

        Note: it /[

        • zima
        • 10 years ago

        PS. Really, check if what you think is NTP-like synchronization isn’t really simple timezone toggling that I mentioned.

        I’ve seen quite a lot of cellphones in which this option (of timezone change recognition when traveling and shifting internal clock) is named in a way that suggests obtaining accurate time from the network. But it does no such thing.

      • Kurlon
      • 10 years ago

      Cell towers DO transmit time constantly. Cell based time sources will show as CDMA in ntpd. clock.sjc.he.net is an example of a stratum 1 source running off CDMA.

        • zima
        • 10 years ago

        I don’t doubt that they do – after all, one would expect that the system of towers should be kept roughly synchronized; the easiest way to do it is…synchronizing from nearby towers.

        But that’s useless to me if I’ve never seen a /[

          • elpresidente
          • 10 years ago

          My free Sony-Ericsson W800i, free Nokia generic piece o’crap as well as my very not free G1 both synchronize time automatically with the network. This is not simple timezoning either, as when I start the phone from being disconnected from it’s battery and SIM for a time it says that the day’s date is sometime in ’99 until it syncs with the network and pulls the correct time/date.

            • zima
            • 10 years ago

            Hm, then it might be even worse…it’s an “optional” feature in GSM networks, one that carriers might choose to ignore?…

            (certainly I’ve never heard about a cellphone that would synchronize its clock in PL cellphone networks)

      • DrDillyBar
      • 10 years ago

      I got lost in there for an hour, and ended up on wikipedia looking at Nixie Tubes.

      • just brew it!
      • 10 years ago

      …or see if your ISP has one. My ISP runs an NTP server on the routers at all their POPs, so you have the option of using the same IP for time synchronization that you set as your default IP gateway.

      Cool link, BTW. I got lost in there for a while too, like #17.

    • PRIME1
    • 10 years ago

    Sometimes I don’t even know what day it is.

      • Farting Bob
      • 10 years ago

      I would have a clue, but according to TR its “shopping reminder day”…

      • TheEmrys
      • 10 years ago

      Awesome quote. I’m adding it to my sig.

    • flip-mode
    • 10 years ago

    Nice to see a blog from you JBI. Always very interesting stuff. Thanks for this one.

Pin It on Pinterest

Share This