14

I'm looking for advice setting up time servers for a very non-typical network. I support many closed networks that have occasional access to the internet. A network would get access most days for a few hours, but would frequently go 1-3 weeks blacked-out. The computers/servers on this network are mostly *nix-based, but not all the same flavor. The entire network is mobile, so when it connects, it will have very different hops/latency to internet time servers. The servers on the closed network are powered-off frequently (at least daily). Right now, my gut tells me to use NTP (because I hate re-learning all the stuff that someone else already got working pretty well). But I have several issues, and am looking for someone with experience in this type of strange situation. I currently have no solution in place, I'm simply letting the internal clocks drift. This results in errors of ~600s in a majority of networks. I have seen mismatch worse than 10,000s.

  1. Is there something "better" than NTP in this situation? I know NTP likes to have very frequent, consistent access to servers that give nearly identical answers. I won't have that.
  2. How many internal NTP servers should I configure, so that during periods of internet blackout, I have internal time that is consistent within the closed network?
  3. There is no human access. No matter how large the mismatch, the server(s) must attempt to correct itself.
  4. Discrete steps are very bad. No matter how large the mismatch, the correction must be "slewed", not "stepped". I understand that this could take many hours to correct.
anregen
  • 287
  • 1
  • 7
  • 7
    Sounds like you need to pull time off GPS. – Michael Hampton Jun 11 '14 at 15:36
  • I think cell towers might have some kind of timecode system, that you could perhaps use. Or just a mobile access point. – Sobrique Jun 11 '14 at 15:42
  • @Sobrique In my experience the time you get from cell towers are usually multiple seconds off compared to the time you get from NTP. Occasionally it can even be off by a couple of minutes. I tend to think that when they disagree, it is NTP, which is right. I would trust GPS to keep accurate time because I know accurate time is a prerequisite for GPS to work in the first place. – kasperd Jun 11 '14 at 23:11

2 Answers2

23

In the old days, setting up a stratum-1 NTP server was very difficult, because stratum-0 sources were very expensive, extremely delicate, and usually radioactive.

Nowadays we have the GPS, which incidentally functions as an extremely accurate radio clock. You can buy a dedicated stratum-1 server containing a GPS receiver as its stratum-0 timesource for quite reasonable prices, or with a little ingenuity you can attach a decent consumer-grade GPS unit to a random server, and set up NTP accordingly to give you your own stratum-1 server. The first of those is better for improved availability.

Do one of those things, and you'll have a single stratum-1 server on your network to which everyone can sync. One is enough; everyone will be sync'ed to it while it's up, and if it goes down, all the clients will probably have got a good idea of their drift rates, so they shouldn't drift too far before it comes back, at which time they'll gently resync to it.

I can't see any reason not to have good time even with intermittent internet access.

MadHatter
  • 78,442
  • 20
  • 178
  • 229
  • 4
    http://www.satsignal.eu/ntp/Raspberry-Pi-NTP.html – Sobrique Jun 11 '14 at 15:43
  • I like this plan a lot and I'm going to give it a whirl. We even have GPS receivers already on-site, so we just need get NTP running and connect the GPS output to the server. – anregen Jun 11 '14 at 17:01
  • Anregen, forgive me for mentioning this if you already know it: the local etiquette is that when you're happy with an answer to your question, you accept it by clicking on the "tick" outline next to it. This both drives the SF reputation system for both you and the author of the answer, and it stops the question from floating around forever like a querulous albatross. – MadHatter Jun 11 '14 at 17:03
  • 1
    The only reason I'm holding off, is I want to make sure I can get around the start-up time on the GPS. There will be a time during system startup, during which the gps is acquiring satellites, and not reporting accurate time information. If I can get around that effectively, I'll definitely select this answer. Thanks again! – anregen Jun 11 '14 at 19:01
  • Don't worry; as long as you're aware of the way things are done around here, wait as long as you like! The community only asks that you accept an answer that you're happy with. – MadHatter Jun 11 '14 at 19:12
  • 1
    The pre-acquisition timestamp reported is 0/0/0 0:0:0, so it is extremely easy to identify. I just have to finishing writing the code to filter that out, then I'll have a great system. Thanks again! – anregen Jun 11 '14 at 19:55
  • This is also a good solution whan you have no internet access, as long as your GPS reciever can see the sky. – Jodrell Jun 12 '14 at 10:57
  • When I've done this, most good GPS receivers take an external antenna, so as long as you can run a thin cable to somewhere that **does** have sight of the sky, all will still be well. – MadHatter Jun 13 '14 at 12:25
  • In addition to the GPS receiver, you should also add some public NTP servers to your list so that you can use Internet-connected NTP servers while your GPS starts up. – Paul Gear Jun 17 '14 at 21:32
0

Similar to the other already accepted answer I doubt you can do this without having some external source of time available as your network connection is simply not good enough.

As an alternate solution to a GPS I want to suggest an external atomic clock signal receiver or radio clock. The basic idea is that you receive radio signals from one of a few atomic clock broadcasting stations around the world.

These can be bought in kits or made very cheaply yourself depending on your budget. These should be more accurate than a GPS, as a GPS can be off by up to 12 seconds: http://www.gpsinformation.net/main/gpstime.htm.

Here is a guide for creating a atomic radio clock receiver with a raspberry pi: http://www.rs-online.com/designspark/electronics/blog/atomic-time-for-the-raspberry-pi

And another DIY thread for creating a very cheap radio clock: http://www.micro-examples.com/public/microex-navig/doc/100-p16f84-led-dcf-clock.html

Just an idea ;)

JensB
  • 259
  • 1
  • 3
  • 15
  • 1
    See, I was nervous when you said 'cheap atomic clock' because ... well, pretty fundamentally, you're measuring atomic vibrations, which is non trivial. However one that received the atomic clock timesignal is a different kettle of fish, and quite a good idea. About the only downside of this is that it _tends_ to be poor reception during the day. – Sobrique Jun 12 '14 at 11:16
  • Made a few modifications to make what I meant clearer :) – JensB Jun 12 '14 at 12:27