Discussion:
[ntp:questions] Long term disciplining against 1PPS reference only
Charbonneau, André
2018-10-11 14:45:54 UTC
Permalink
Hi all,

Recently I've been trying to get one of my NTP server (a Raspberry Pi), to stay synchronized to a 1PPS signal coming from a Rb clock over long periods of time when all other sources are unavailable. The NTP server on the RPi is configured to have a couple upstream stratum 2 servers, plus the 1PPS driver, and a local clock driver. For example:


# Kernel-mode PPS ref-clock for the precise seconds
server 127.127.22.0 minpoll 4 maxpoll 4
fudge 127.127.22.0 refid PPS

# Stratum 2 servers:
server nnn.nnn.nnn.nnn iburst prefer

server nnn.nnn.nnn.nnn iburst prefer

server nnn.nnn.nnn.nnn iburst prefer

# Local clock driver
server 127.127.1.0
fudge 127.127.1.0 stratum 10

The NTP version I'm running is ntpd ***@1.3728-o Thu Jul 12 19:43:06 UTC 2018 (1), on

Raspbian GNU/Linux 9.3 (stretch).




So here is the overall scenario I'm trying to achieve:


1. The NTP server starts up, and sees all references and happily syncs to the 1PPS.

2. After a while, the upstream stratum 2 servers all become unreachable (i.e., a network outage). The 1PPS and local clock are the only 2 remaining references.

3. The NTP server continues to be synchronized via the 1PPS driver during the stratum 2 outage (which could last many hours)



The problem I'm seeing is that soon after (~10 minutes) the upstream stratum 2 servers become unreachable, the 1PPS also looses synchronization and the local clock starts to free run.


Reading more about this, it is documented (Computer Network Time Synchronization 2nd edition, by D. L. Mills, section 3.11.4) that I should be using the following command to tell NTP to keep the 1PPS synchronization even if no other sources are present:


"tos minsane 0"


I've put this command at the very top of my ntp.conf, restarted ntpd but it seems to have no effect and the problem still happens. (I verified that I'm indeed editing the correct ntp.conf file.)


Maybe I'm not using the tos command correctly?


I've found a workaround by putting the "prefer" keyword also on the local clock entry in ntp.conf but I would like to understand why the "tos minsave 0" does not work for me.




Any information about this would be much appreciated.


Thanks!

Andre
Dan Drown
2018-10-19 20:47:32 UTC
Permalink
Quoting "Charbonneau, André" <***@nrc-cnrc.gc.ca>:
> Recently I've been trying to get one of my NTP server (a Raspberry
> Pi), to stay synchronized to a 1PPS signal coming from a Rb clock
> over long periods of time when all other sources are unavailable.
> The NTP server on the RPi is configured to have a couple upstream
> stratum 2 servers, plus the 1PPS driver, and a local clock driver.
:
> Reading more about this, it is documented (Computer Network Time
> Synchronization 2nd edition, by D. L. Mills, section 3.11.4) that I
> should be using the following command to tell NTP to keep the 1PPS
> synchronization even if no other sources are present:
>
> "tos minsane 0"
:

Looks like this code was added around 2 years ago to ntpd/ntp_config.c:

case T_Minsane:
val = tos->value.d;
if ((int)tos->value.d < 1)
tos->value.d = 1;
l_minsane = (int)tos->value.d;
break;

I've verified that changing the minimum from 1 to 0 in that code lets
this feature work again. Can you give that a try?
Charbonneau, André
2018-10-22 13:36:21 UTC
Permalink
Hi,
Thanks for the follow-up on this.
Yes, I did try what you suggested and indeed it now allows me to use minsane = 0 and behaves as documented.
I opened a bug report for this:


https://bugs.ntp.org/show_bug.cgi?id=3540

Best regards,
Andre
________________________________________
From: questions <questions-bounces+andre.charbonneau=nrc-***@lists.ntp.org> on behalf of Dan Drown <dan-***@drown.org>
Sent: Friday, October 19, 2018 4:47 PM
To: ***@lists.ntp.org
Subject: Re: [ntp:questions] Long term disciplining against 1PPS reference only

Quoting "Charbonneau, André" <***@nrc-cnrc.gc.ca>:
> Recently I've been trying to get one of my NTP server (a Raspberry
> Pi), to stay synchronized to a 1PPS signal coming from a Rb clock
> over long periods of time when all other sources are unavailable.
> The NTP server on the RPi is configured to have a couple upstream
> stratum 2 servers, plus the 1PPS driver, and a local clock driver.
:
> Reading more about this, it is documented (Computer Network Time
> Synchronization 2nd edition, by D. L. Mills, section 3.11.4) that I
> should be using the following command to tell NTP to keep the 1PPS
> synchronization even if no other sources are present:
>
> "tos minsane 0"
:

Looks like this code was added around 2 years ago to ntpd/ntp_config.c:

case T_Minsane:
val = tos->value.d;
if ((int)tos->value.d < 1)
tos->value.d = 1;
l_minsane = (int)tos->value.d;
break;

I've verified that changing the minimum from 1 to 0 in that code lets
this feature work again. Can you give that a try?
Loading...