tags:

views:

42

answers:

4

I have 5 servers on a LAN without Internet connection. I need them to keep the clock in sync among them.

I could configure them as NTP peers, and set a high stratum for the local clock of one of them. In this way, the other four would sync with that clock.

What I actually want, is them to agree on a time using all of the 5 local clocks (i.e. doing some kind of average), for reasons of robustness and precision. Is it possible with NTP?

PS: I do not want to use an external clock source.

EDIT: and no scripting outside NTP features, that could only make precision worse :)

A: 

you can set up one of them as ntp server which will broadcast its time on the local network and the others as slaves to listen on the local network

edit: I missed the average part. well, in that case, you can probably write a script on the local server to collect times from all the slaves get the average and update own time with that value. You may even want to get rid of ntp in that case and just use the script to update time on all the servers

Gunjan
Did you actually read the question? This is specifically what he does NOT want. He wants a way to average their times.
houbysoft
A: 

You might be able to have one of them listen for the times from each computer, perform an average, set the average as it's own time, and broadcast that time for all the other computers. It seems a little excessive, though.

Computerish
A: 

I wish I could give a definitive proposal, but I don't know enough about your environment. No matter what you'll likely be doing some sort of script kung fu.

If it's unix/linux I would set everyone up with SSH authorized keys to poll each others' date +%s command (to get the epoch), average those times with awk or something, and then set the machine's own local date.

Or perhaps it would be more secure (and reliable) to have one authoritative machine check everyone's time in the same manor, average it, and then provision itself and every other host to that average.

On Windows you'll probably be looking into VBScript and WMI.

EDIT: You may run into some weird problems if anyone's clock drifts forward from the average and my guess is about half of them will ;). Future timestamps can be rather strange. It will be up to you to determine how frequently this synchronization will need to occur.

andyortlieb
+2  A: 

If you average 5 drifting clocks, the only thing you get is another drifting clock that's harder to correct. It won't be more precise. NTP uses multiple servers to increase precision because it takes network latency into account. Since all your systems are on a fast local network, you just need one server.

Set up two systems to be NTP server, one a primary, and if you feel the need, one a backup. Have all other systems synchronize to them. This will be significantly easier to set up than the clock-averaging solution, and you won't have to develop any crazy scripts.

Karmastan