# [ntp:questions] Query about NTP accuracy

Terje Mathisen "terje.mathisen at tmsw.no" at ntp.org
Tue Jun 2 06:40:40 UTC 2009

```Mike K Smith wrote:
> On 31 May, 22:20, Brian Utterback <brian.utterb... at sun.com> wrote:
>> Hal Murray wrote:
>>> In article <1243711613.525216 at news1nwk>,
>>>  Brian Utterback <brian.utterb... at sun.com> writes:
>>>> David Woolley wrote:
>>>>> It only requires 2.  The argument about having four initially is about
>>>>> having a clear majority even after rejecting one.
>>>> I am not sure what you are saying. Are you saying that 4 servers allow
>>>> you to have a failed server and then outvote a falseticker. I don't
>>>> think that is true. And it definitely takes three servers to outvote
>>>> one falseticker in some cases. NTP deals in intervals, and it takes
>>>> two servers to define one interval, and then one more to make that
>>>> interval outvote all the others possible intervals. So, three servers
>>>> will always outvote a single falseticker, but two will not always
>>>> outvote a single falseticker.
>>> What cases does it take 3 servers to outvote a falseticker?
>>> I thought the idea behind using 4 severs was that 3 was the magic
>>> number (2 could outvote a falseticker) and you still had 3 after
>>> 1 (of the 4) died.
>> Nope. NTP works with intervals. Each server has two intervals that it
>> is contributing, the offset to the offset minus the dispersion, and
>> the offset to the offset plus the dispersion. It then finds the
>> interval that has the most overlap. In the case of three servers, any
>> particular interval can have one, two or three "votes". When it finds
>> the interval with the most votes, it takes the servers that
>> contributed (i.e. voted) for that interval as acceptable and goes on
>> to the next step, choosing which to use. You can easily see that
>> server 1 and 2 might be close together in offset, but there
>> dispersions might only overlap a little, giving that overlap two
>> votes. Then if server 3 is far away from the other two but has a large
>> dispersion, overlapping the dispersion of server two but not all the
>> way to its offset, the overlap also has two votes. There is no
>> location with 3 votes, so either one might be chosen. Server 3 can
>> have a offset and dispersion that does not overlap the real time
>> anywhere, which is the definition of a falseticker, and still get chosen.
>>
>> If you add a fourth server, there will be a combination of that
>> overlaps with three, and this will outvote the interval with the
>> falseticker that has two. So, you see? It takes 4 servers to outvote a
>> falseticker.- Hide quoted text -
>>
>> - Show quoted text -
>
> You mean like this?
>
> 1
>           |--------+--------|
> 2
>               |----------+----------|
> 3                              |------------+------------|
>
> Would server 3 be regarded as a falseticker in this case?

No, this is a perfect example of why you need 4 servers: There is no way
to determine if 1 or 3 is the falseticker (at least one of them _must_ be!)

With four servers, including one falseticker, the three good servers
_must_ have a common range which includes the true time.

Terje
--
- <Terje.Mathisen at tmsw.no>
"almost all programming can be viewed as an exercise in caching"

```