OPNsense Forum

Archive => 21.1 Legacy Series => Topic started by: CJ on April 11, 2021, 09:52:44 PM

Title: NTP stops working after a few minutes
Post by: CJ on April 11, 2021, 09:52:44 PM
I noticed recently that my clock was about 15 minutes off.  Looking at my NTP status page all of the peers show "Unreach/Pending".  I stopped the NTP service and ran ntpdate 0.opnsense.pool.ntp.org

When I started the service back up everything seemed fine.  It was syncing with peers and everything was good.  But within a couple of minutes everything went back to the "Unreach/Pending" status.

Given that I'm using the default config and it works correctly for the first few minutes where should I look for more troubleshooting?

Thanks.
Title: Re: NTP stops working after a few minutes
Post by: Patrick M. Hausen on April 11, 2021, 10:15:32 PM
Your hardware seems to be unable to keep a proper clock. If the deviations are too large for ntpd to keep up with, it will just give up. Is your installation virtualised?
Title: Re: NTP stops working after a few minutes
Post by: CJ on April 11, 2021, 10:26:26 PM
No, it's a physical machine.  A Dell Optiplex 7020.

I found this thread about NTP being too fast but mine doesn't seem to drift as quickly.  https://forum.opnsense.org/index.php?topic=18557.0

Do you think the tunable mentioned would fix the issue?
Title: Re: NTP stops working after a few minutes
Post by: Patrick M. Hausen on April 11, 2021, 10:47:47 PM
Of course. If your clock drift is too high, try other time counters.
Title: Re: NTP stops working after a few minutes
Post by: CJ on April 11, 2021, 10:55:03 PM
Thanks.  That does appear to have fixed the issue.  I wonder why my clock was drifting, though.
Title: Re: NTP stops working after a few minutes
Post by: almodovaris on April 12, 2021, 12:11:12 AM
NTP is an IPv6 lover. So, if you don't have a working IPv6 connection and you didn't disable IPv6, then it fails to work.
Title: Re: NTP stops working after a few minutes
Post by: CJ on April 12, 2021, 09:31:37 PM
Quote from: almodovaris on April 12, 2021, 12:11:12 AM
NTP is an IPv6 lover. So, if you don't have a working IPv6 connection and you didn't disable IPv6, then it fails to work.

I'm not sure I follow.  1 of the 4 peers shows up as ipv6 but that doesn't appear to change whether they end up as unreachable or not.

I do have a working ipv6 connection.
Title: Re: NTP stops working after a few minutes
Post by: Patrick M. Hausen on April 12, 2021, 10:25:56 PM
Quote from: CJRoss on April 11, 2021, 10:55:03 PM
I wonder why my clock was drifting, though.
Hardware isn't perfect and the FreeBSD kernel clock implementation certainly isn't either. It's just not stable with certain combinations of system and hardware clock used. And it gets worse in virtual machines.

Linux suffers from the same problem. Just the one odd mainboard in one hundred.

Glad it works for you, now.