# NTP still not working

**URL:** <https://community.ipfire.org/t/ntp-still-not-working/5282>\
**Category:** Network\
**Created:** [29 April 2021 03:31 UTC](https://community.ipfire.org/t/ntp-still-not-working/5282 "2021-04-29T03:31:51Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![stinga](https://community.ipfire.org/user_avatar/community.ipfire.org/stinga/32/9596_2.png) [@stinga](https://community.ipfire.org/u/stinga)\
**Post date:** [29 April 2021 03:31 UTC](https://community.ipfire.org/t/ntp-still-not-working/5282/1 "2021-04-29T03:31:51Z")

</div>

G’day all,

Out of the box NTP does not seem to work correctly.

we have:

```auto
    [root@cf-fw ~]# cat /etc/ntp.conf
    disable monitor
    restrict default nomodify noquery
    restrict 127.0.0.1
    server 127.127.1.0 prefer
    fudge 127.127.1.0 stratum 10
    driftfile /etc/ntp/drift

```

If you want NTP to work correctly you need something like:

```auto
    [root@cf-fw ~]# cat /etc/ntp.conf
    disable monitor
    restrict default nomodify
    pool 0.uk.pool.ntp.org
    pool 1.uk.pool.ntp.org
    pool 2.uk.pool.ntp.org
    pool 3.uk.pool.ntp.org
    
    fudge 127.127.1.0 stratum 10
    driftfile /etc/ntp/drift

```

I have removed

```auto
restrict 127.0.0.1
server 127.127.1.0 prefer

```

and added some pools

If you don’t make changed to ntp.conf you don’t get proper ntp synchronisation

Before the change on IPFire

```auto
[root@cf-fw ~]# ntpq -p
         remote refid st t when poll reach delay offset jitter
    ==============================================================================
    *LOCAL(0) .LOCL. 10 l 11 64 377 0.000 +0.000 0.000

```

Note that ntp is using LOCAL source, so probably fighting the 1 hourly sync.

And a host on green:

```auto
    root@nostromo:/shares/doc# ntpq -p
         remote refid st t when poll reach delay offset jitter
    ==============================================================================
    *cf-fw.coastfm.c LOCAL(0) 11 u 308 1024 377 0.212 -118.55 118.822

```

Note the LOCAL(0) on nostromo, I believe ntp is clever enough to say 'hey, our upstream server is using local, I have a local too! I will use my local)

Making the change, we now have:

```auto
    [root@cf-fw ~]# ntpq -p
         remote refid st t when poll reach delay offset jitter
    ==============================================================================
     0.uk.pool.ntp.o .POOL. 16 p - 64 0 0.000 +0.000 0.000
     1.uk.pool.ntp.o .POOL. 16 p - 64 0 0.000 +0.000 0.000
     2.uk.pool.ntp.o .POOL. 16 p - 64 0 0.000 +0.000 0.000
     3.uk.pool.ntp.o .POOL. 16 p - 64 0 0.000 +0.000 0.000
    +85.199.214.100 .GPS. 1 u 60 64 377 12.028 -6.732 4.894
    #time.cloudflare 10.21.8.19 3 u 1 128 377 10.509 -25.550 18.986
    -time.netweaver. 85.199.214.98 2 u 128 128 377 10.988 -7.090 10.747
    -ns3.turbodns.co 85.199.214.99 2 u 59 128 377 15.830 -13.917 13.064
    -183.ip-51-89-15 225.254.30.190 4 u 2 128 377 10.232 -8.263 9.131
    +time.cloudflare 10.21.8.19 3 u 118 128 377 10.167 -5.649 12.197
    #ntp3.wirehive.n 81.187.26.174 2 u 73 128 377 11.812 -23.923 17.777
    *85.199.214.98 .GPS. 1 u 3 64 377 12.389 -0.610 2.689
    -ns1.luns.net.uk 157.44.176.4 2 u 67 128 377 16.633 +0.325 14.474
    #x.ns.gin.ntt.ne 249.224.99.213 2 u 60 128 377 10.737 -1.304 13.492
    -ntp.uk.eria.one 85.199.214.102 2 u 59 128 377 11.196 -8.670 9.665
    -devrandom.pl 85.199.214.101 2 u 65 128 377 11.445 -1.382 13.179
    -51.155.16.62 (5 .GPS. 1 u 38 128 377 33.163 +0.470 14.223

```

and on a green host:

```auto
    root@nostromo:/shares/doc# ntpq -p
         remote refid st t when poll reach delay offset jitter
    ==============================================================================
    *cf-fw.coastfm.c 85.199.214.98 2 u 65 64 377 0.188 -8.333 3.349

```

Woot! much better, no drift and everything in sync. I am sure I have posted this before, but could not find it.

In the WUI, make ntp synchronisation manual, dont need that any more.  
And having an 3 or more upstream servers is much better, 2 is worse than 1 I think, with 2 ntp does not know who is accurate.

---

<div class="post-metadata">

**Author:** ![jon](https://community.ipfire.org/user_avatar/community.ipfire.org/jon/32/15363_2.png) [@jon](https://community.ipfire.org/u/jon)\
**Post date:** [29 April 2021 16:17 UTC](https://community.ipfire.org/t/ntp-still-not-working/5282/2 "2021-04-29T16:17:37Z")

</div>

This is what I had found…

> [@Odd NTP Offset Issues (continued)](https://community.ipfire.org/t/odd-ntp-offset-issues-continued/492):
>
> Continued from old IPFire forum: EDIT: this is an bad link to the old IPFire Forum: Odd NTP Offset Issues [IPFire Community](https://forum.ipfire.org/viewtopic.php?f=27&t=21861) H&M - I see many of the same messages in /var/log/messages: Nov 29 15:07:27 ipfire ntpd[3258]: ntpd 4.2.8p13@1.3847-o Thu May 2 20:06:35 UTC 2019 (1): Starting Nov 29 15:07:27 ipfire ntpd[3258]: Command line: /usr/bin/ntpd -Ap /var/run/ntpd.pid Nov 29 15:07:27 ipfire ntpd[3260]: proto: precision = 0.240 usec (-22) Nov 29 15:07:27 ipfire ntpd[3260]: basedate set to 2019…

* * *

**EDIT** : for code blocks and for log blocks add three back ticks ````` before the code and three back ticks ````` after the code.

---

<div class="post-metadata">

**Author:** ![stinga](https://community.ipfire.org/user_avatar/community.ipfire.org/stinga/32/9596_2.png) [@stinga](https://community.ipfire.org/u/stinga)\
**Post date:** [30 April 2021 02:13 UTC](https://community.ipfire.org/t/ntp-still-not-working/5282/3 "2021-04-30T02:13:32Z")

</div>

/shrug dunno

All I know is that out of the box, ntp never seemed to work, hosts behind the firewall were always using LOCAL(0) IE their own time source and our clocks drifted all over the place. Once I made the changes and restarted ntp, everything was in sync.  
I am not sure the  
`restrict 127.0.0.1`  
has to be removed, but I am pretty sure  
`server 127.127.1.0 prefer`  
does. This causes IPFire to never use external sources.

I am by no way an ntp expert but I have debugged a lot ntp issues over the years.

I set the host name ntp to be IPfire and the `/etc/ntp.conf` on a green node looks like

```auto
root@nostromo:~# cat /etc/ntp.conf|grep -v "^#"|grep -v "^ *$"
driftfile /var/lib/ntp/ntp.drift
statistics loopstats peerstats clockstats
filegen loopstats file loopstats type day enable
filegen peerstats file peerstats type day enable
filegen clockstats file clockstats type day enable
restrict -4 default kod notrap nomodify nopeer noquery limited
restrict -6 default kod notrap nomodify nopeer noquery limited
restrict 127.0.0.1
restrict ::1
restrict source notrap nomodify noquery
server ntp

```

I added the `server ntp` line.

There may be other solutions and maybe it does work out of the box, but it didn’t seem to be correct to me.  
I need to keep clocks in sync and 1 hour updates were not cutting it either. We had drift over the hour.  
This way we have proper ntp time sync.  
(Mind you we had a UPS plugged into a UPS in error! That was not helping the time drift on one server!)  
(We are a radio station so we need accurate timing for events to fire across nodes!)

---

<div class="post-metadata">

**Author:** ![anon42188109](https://community.ipfire.org/letter_avatar_proxy/v4/letter/a/94ad74/32.png) [@anon42188109](https://community.ipfire.org/u/anon42188109)\
**Post date:** [30 April 2021 03:51 UTC](https://community.ipfire.org/t/ntp-still-not-working/5282/4 "2021-04-30T03:51:01Z")

</div>

Hi Mike  
FYI: I reported bug 12518 back in Oct 2020 since ntpq -p was not working. I looked a Debian sources and found “restrict 127.0.0.1” was needed in the ntpd.conf

[https://bugzilla.ipfire.org/show\_bug.cgi?id=12518](https://bugzilla.ipfire.org/show_bug.cgi?id=12518)

---

<div class="post-metadata">

**Author:** ![jon](https://community.ipfire.org/user_avatar/community.ipfire.org/jon/32/15363_2.png) [@jon](https://community.ipfire.org/u/jon)\
**Post date:** [13 July 2022 20:49 UTC](https://community.ipfire.org/t/ntp-still-not-working/5282/5 "2022-07-13T20:49:25Z")

</div>

NTP issues are fixed in [IPFire 2.27 - Core Update 169 released](https://blog.ipfire.org/post/ipfire-2-27-core-update-169-released#miscellaneous).

see:  
[https://git.ipfire.org/?p=ipfire-2.x.git;a=commit;h=2234e8aacac2e0d0b06dac4513585c15c2b3b440](https://git.ipfire.org/?p=ipfire-2.x.git;a=commit;h=2234e8aacac2e0d0b06dac4513585c15c2b3b440)

---

<div class="post-metadata">

**Author:** ![jon](https://community.ipfire.org/user_avatar/community.ipfire.org/jon/32/15363_2.png) [@jon](https://community.ipfire.org/u/jon)\
**Post date:** [19 July 2022 19:37 UTC](https://community.ipfire.org/t/ntp-still-not-working/5282/6 "2022-07-19T19:37:32Z")

</div>

Closed on 19 July 2022 19:37 UTC


