Re: [Ntp] NTPv5 Loop Detection without Stratum - Why do we want this?

kristof.teichel@ptb.de Tue, 06 September 2022 10:16 UTC

Return-Path: <kristof.teichel@ptb.de>
X-Original-To: ntp@ietfa.amsl.com
Delivered-To: ntp@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 82FC4C15257F for <ntp@ietfa.amsl.com>; Tue, 6 Sep 2022 03:16:10 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -4.405
X-Spam-Level:
X-Spam-Status: No, score=-4.405 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_ZEN_BLOCKED_OPENDNS=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01, URIBL_BLOCKED=0.001, URIBL_DBL_BLOCKED_OPENDNS=0.001, URIBL_ZEN_BLOCKED_OPENDNS=0.001] autolearn=unavailable autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=ptb.de
Received: from mail.ietf.org ([50.223.129.194]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id fvNRBEzXFoi5 for <ntp@ietfa.amsl.com>; Tue, 6 Sep 2022 03:16:04 -0700 (PDT)
Received: from mx1.bs.ptb.de (mx1.bs.ptb.de [192.53.103.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 93413C15257D for <ntp@ietf.org>; Tue, 6 Sep 2022 03:16:03 -0700 (PDT)
Received: from smtp-hub.bs.ptb.de (smtpint01.bs.ptb.de [141.25.87.32]) by mx1.bs.ptb.de with ESMTP id 286AFvJq004680-286AFvJs004680 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for <ntp@ietf.org>; Tue, 6 Sep 2022 12:15:57 +0200
In-Reply-To: <DA1F1664-8A84-4197-844A-CA7E8DAA36B8@meinberg.de>
References: <DA1F1664-8A84-4197-844A-CA7E8DAA36B8@meinberg.de>
To: "ntp@ietf.org" <ntp@ietf.org>
Cc: Heiko Gerstung <heiko.gerstung=40meinberg.de@dmarc.ietf.org>
MIME-Version: 1.0
X-KeepSent: 43150191:DABAA331-C12588B5:00362DC0; type=4; name=$KeepSent
From: kristof.teichel@ptb.de
Message-ID: <OF43150191.DABAA331-ONC12588B5.00362DC0-C12588B5.003861AF@ptb.de>
Date: Tue, 06 Sep 2022 12:15:46 +0200
X-MIMETrack: Serialize by Router on MAILGW01/PTB at 09/06/2022 12:15:57 PM, Serialize complete at 09/06/2022 12:15:57 PM
Content-Type: multipart/alternative; boundary="=_alternative 003861ADC12588B5_="
X-FE-Last-Public-Client-IP: 141.25.87.32
X-FE-Policy-ID: 5:5:5:SYSTEM
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; d=ptb.de; s=s1-ptbde; c=relaxed/relaxed; h=references:to:cc:mime-version:subject:from:message-id:date:content-type; bh=REOWGyql21zctHv3AOGYnmQiArQDk6U6iVAd2G/PuEw=; b=HyjI7GTHq5MTY5sa+Jvb+KAd23S5g24vKkydTEek0T81xG57GhqiRSfWCfMsD1CKemHZ7JUyzfP4 yChvNDXCPI/BIpJ/qm+69IwPD7f/vvnQxGlbv1uCCOcWgNZ16LoZS5pSpMgzJ6SDKYsF60o0o590 NMTQ7CArIdzDgq7kN+8b4sgkzYfg534QGwpDEstAF6xn4YsbPUnPp65ScRuqtSXk0XyEfpXRipxz 5HK2vxk2g9HAfS6T8gAVmSIB8j43xb+jVvLELJEDSQxkSfjwuiZzDvSfS2aM8iVvScdwH/LjpU+O i94+UFLpYX3XTvTjyBDL0zvpQxkkP1hQzSoDfQ==
Archived-At: <https://mailarchive.ietf.org/arch/msg/ntp/N6KM2hF6awNDTm86fasIrb94J9g>
Subject: Re: [Ntp] NTPv5 Loop Detection without Stratum - Why do we want this?
X-BeenThere: ntp@ietf.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: Network Time Protocol <ntp.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/ntp>, <mailto:ntp-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/ntp/>
List-Post: <mailto:ntp@ietf.org>
List-Help: <mailto:ntp-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/ntp>, <mailto:ntp-request@ietf.org?subject=subscribe>
X-List-Received-Date: Tue, 06 Sep 2022 10:16:10 -0000

Hey all,

I'm sorry to take several steps backwards here, but I was discussing this 
with Dieter and the Ostfalia folks yesterday, and I have questions:

1) What is the motivation to want to do loop detection, specifically 
without stratum?
If everyone does use stratum consistently (and in particular sees to it 
that their own stratum is higher than the max of those of its own 
sources), then there will never be a loop.
Why would anyone want to not use strata in that way, but then still be 
careful about loops?

2) What is this black magic that I've heard a few times (from at least 
Dieter and Danny now) that one RefID is supposed to be enough for loop 
detection?
Miroslav said it: it's a classic graph theory problem, and I don't see how 
looking just two hops further would ever give me a consistent reliable 
answer to "am I connected to X on some path, or not?".
Someone gave an example of a synchronization path A->B->C->D->A, and I 
don't see how the current RefID scheme is even supposed to ever detect 
that.
Perhaps it "works in practice", but that might just mean that 99.9...% of 
users aren't doing crazy enough things to really approach the limits of 
the current scheme's robustness, which is NOT the same as it being very 
robust!

1b) Wouldn't tighter requirements on stratum use make things even easier?
I assume that everyone agrees that using higher stratum servers is never 
beneficial for accuracy - and often detrimental.
I would therefore assume that anyone who does not sync to a stratum 1 
server and instead uses stratum 2 has prohibitive reasons for that 
decision (and accordingly for higher strata decisions).
Why then can't stratum be something that is treated as a constant for each 
entity, with an accomanying requirement that a stratum n server ONLY EVER 
uses stratum n-1 servers to sync their clock?
(Add an encouragement that everyone keep their stratum as low as possible 
given their infrastructure)
Shouldn't loops go away completely (and strata 4+ become a really rare 
sight on the public internet, basically an indicator of user error)?


I'm guessing this comes down to some practical aspect (such as the NTP 
pool) that I'm ignorant of, but it really seems to be causing a lot of 
headache for something that looks like it could be avoided with some 
low-complexity guidelines.



Besten Gruß / Kind regards,
Kristof Teichel

__________________________________________

Dr.-Ing. Kurt Kristof Teichel
Physikalisch-Technische Bundesanstalt (PTB) 
Arbeitsgruppe 4.42 "Zeitübertragung"
Bundesallee 100
38116 Braunschweig (Germany)
Tel.:        +49 (531) 592-4471
E-Mail:   kristof.teichel@ptb.de
__________________________________________

"ntp" <ntp-bounces@ietf.org> schrieb am 23.08.2022 12:21:19:

> Von: "Heiko Gerstung" <heiko.gerstung=40meinberg.de@dmarc.ietf.org>
> An: "Miroslav Lichvar" <mlichvar@redhat.com>, "Ulrich Windl" 
> <ulrich.windl@rz.uni-regensburg.de>
> Kopie: "ntp@ietf.org" <ntp@ietf.org>
> Datum: 23.08.2022 12:21
> Betreff: [Ntp] NTPv5 Loop Detection without Stratum
> Gesendet von: "ntp" <ntp-bounces@ietf.org>
> 
> One way of avoiding/detecting loops:
> - upon startup, an NTPv5 instance creates a random 64bit ID
> - we add a loop detection EF that can include n IDs (or we use n EFs)
> - a stratum one server, when ask for his "sync trace", responds with
> only his ID
> - a stratum two server would add its own ID to the ID of its 
> upstream server, responding with a sync trace of two IDs
> - a stratum 1+n server would respond with the sync trace of its 
> upstream source(s) plus its own ID 
> - if you use more than one upstream source, you can respond with a 
> list of all IDs from the sync trace of all your upstream sources 
> (removing duplicates)
> - by checking if your own ID is in the sync trace of your upstream 
> source(s), you can find out if there is a loop
> 
> Maybe smaller IDs (32 bit, 16 bit) would be OK as well. 10 IDs would
> be 80 octets on the wire. No question that we would have to find a 
> way to avoid amplification attacks (hello monlist!). Maybe by making
> it mandatory to send a request (with padding bytes) that is as big 
> as the worst case response. 
> 
> Regards,
>   Heiko
> 
> --
> Heiko Gerstung | Managing Director
> T: +49 (0)5281 9309-404 | LinkedIn Profile <https://
> www.linkedin.com/in/heikogerstung/> | Twitter <
https://twitter.com/hgerstung>
> heiko.gerstung@meinberg.de
> 
> MEINBERG® The Synchronization Experts
> 
> Meinberg Funkuhren GmbH & Co. KG
> Lange Wand 9 | 31812 Bad Pyrmont | Germany
> Web: http://www.meinberg.de | http://www.meinbergglobal.com | LinkedIn  
<
> https://www.linkedin.com/company/meinberg-funkuhren-gmbh-&-co--kg>
> 
> Amtsgericht Hannover 17HRA 100322
> Geschäftsführer/Management: Günter Meinberg, Werner Meinberg, Andre 
> Hartmann, Heiko Gerstung
> 
> Do not miss our Time Synchronization Blog:
> http://blog.meinbergglobal.com
> 
> 
> 
> Am 23.08.22, 12:07 schrieb "ntp im Auftrag von Miroslav Lichvar" 
> <ntp-bounces@ietf.org im Auftrag von mlichvar@redhat.com>:
> 
>     On Tue, Aug 23, 2022 at 11:30:44AM +0200, Ulrich Windl wrote:
>     > So my conclusion still is that the "ping pong" style of time 
> exchange between
>     > peers is in accordance with the protocol specification.
> 
>     If the protocol cannot prevent the loop, there is no other option 
:).
> 
>     If NTPv5 can detect all loops, the client can decide to ignore the
>     measurements of the source to avoid the loop.
> 
>     > (However if those peer have no other time source, the quality 
> should become
>     > worse over time, eventually declaring them unsynchronized)
> 
>     If they have no other time source, the protocol will block the
>     synchronization by ignoring sources with larger stratum (NTPv3) or
>     ignoring sources with matching refid (NTPv4).
> 
>     > > It causes oscillations, which has a negative impact on stability 
of
>     > > the clocks. If you remove the symmetric associations, it 
performs
>     > > better. You can easily verify that.
>     > 
>     > It may be, but would it be in the spirit of the protocol 
specification?
> 
>     I'm not sure what you mean by this.
> 
>     -- 
>     Miroslav Lichvar
> 
>     _______________________________________________
>     ntp mailing list
>     ntp@ietf.org
>     https://www.ietf.org/mailman/listinfo/ntp
> 
> [Anhang "smime.p7s" gelöscht von Kristof Teichel/PTB] 
> _______________________________________________
> ntp mailing list
> ntp@ietf.org
> https://www.ietf.org/mailman/listinfo/ntp