Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have 2 servers on a LAN that I want to precisely synchronize. the goal is to have a time difference < 500 microseconds, constant, with no drift (from what I've found on the web, this is achievable accuracy).

those two servers must also have "correct" time but the accuracy is less important (within 1 second of the "real" time is acceptable). the "official" time servers are only accessible through a WAN (so latency - accuracy is higher).

what's the best way to proceed ? so far, I've set up server A as a NTP client to official time servers, and server B as a NTP client to server A. NTP have been running for more than a day, drift file are updated regularly, however I can still see that time is drifting between server A & B (around 1ms every 55 seconds - very regular drift).

any idea / comment ?

thanks

share|improve this question
    
Peer them as marcoc points out below. –  Chris S Jan 28 '11 at 14:56
    
tried to Peer, but no impact: still 1ms every 57 seconds (constant). –  Bastien Feb 1 '11 at 2:48
add comment

5 Answers 5

I have 2 "internal" servers. On each one I have a configuration similar to this one

peer <otherserver>

server <reliable1.external.source>
server <reliable2.external.source>

restrict 127.0.0.1
restrict <otherserver>
restrict <reliable1.external.source> kod notrap nomodify
restrict <reliable2.external.source> kod notrap nomodify
restrict <ntpclients> nomodify notrap nopeer
restrict default ignore

driftfile /var/lib/ntp/drift

On Solaris 10 I have enabled svcadm enable ntp4.

BTW I would consider buying a GPS+NTPd clock...

share|improve this answer
    
+1 Peer the servers to keep them synchronized against each other. –  Chris S Jan 28 '11 at 14:56
    
I setup a similar configuration, synchronizing both servers to reliable "distant" clocks, and Peered the two servers together, that didn't change anything: I still have one clock drifting 1ms every 57 seconds. alternatively, as this drift if constant (and strangely not corrected by NTP), is there a way to manually correct it ? can I manually add a value to the drift file ? or any other solution ? –  Bastien Feb 1 '11 at 2:46
add comment

Personally for two servers I would just set them both up to use NTP from the internet clocks. That way if there is any irregular skew of server A happening it won't upset server B's NTP process.

In situation where I had a lot of machines, I would have three systems that were both highly reliable and ideally had better-than-average clocks and have them set to use NTP from the internet clocks, then have the rest of the systems use NTP to them.

(No good personal aside: Sun (ultra and regular) Sparc systems have clocks which range from horrible (Netra X1s) to excellent (the SS20s had very nice clocks). Other Suns could range widely in clock quality within the same system model. When I say horrible, I mean "NTP would give up trying to keep it in sync within a day" horrible. So you are kind of at the mercy of the quality of the systems' clocks.)

share|improve this answer
    
server A (that is syncing from internet clock) shows a delay (as in ping delay) of 180ms. I'm afraid that might be too much to guarantee < 500 microsec difference between 2 servers syncing to internet clock, but I might be wrong, and will test it. –  Bastien Jan 27 '11 at 4:54
add comment

I think if the external delay is relatively constant then the ntp protocol can get you quite accurate synchronization. I'd be more concerned if your external delay fluctuated, then ntp will have trouble achieving maximum accuracy.

Here's a very technical pdf that says you can get accuracy down to a few nanoseconds with the right configurations.

If you really need that sort of accuracy, have you thought about installing some sort of ntp appliance and syncing to that? That way you would eliminate the variable of external delay.

share|improve this answer
    
interestingly enough, the paper describes one configuration that could correspond to what I'm looking for, however it says "with a polling interval of 16s" (or 64s), and I can't find any way to FORCE ntpd to poll at a fixed interval. any idea ? the polling interval is set automatically by the system, mine is at 1024 after a few hours running. no idea how to force it back to 16s or 64s, that would probably help me... –  Bastien Jan 27 '11 at 8:40
add comment

Did you try tinker minpoll to change the interval back?

share|improve this answer
add comment

Consider investing in a dedicated ntp server and sync those servers to the ntp hardware. Besides getting the right time from a source like GPS they are also optimized to minimize jitter by their choice in hardware and build. As noted in one answer some types of hardware you can install ntpd on will still cause lots of jitter.

Dedicated NTP hardware is not cheap, but it can save you weeks of finding the right system to use as a timekeeper.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.