890 / 5.000 NTP on the PI - where does it get its time from?

I specified my Pi as the NTP server in the LAN - that works too. So Windows synchronizes the time with "pi.hole" etc.

But I'm wondering - why? :wink:
I'm completely lost at the moment.

The only thing I know: pi.hole allows time queries. But what I'm missing is: where does the pi get its time from?

timedatectl
NTP service: inactive
=> But that seems to be the service? But if it's inactive, why is it distributing?

sudo journalctl -fu ntp
Listen normally on 3 eth0 ....

sudo systemctl status ntp
Active: active (running)

=> both of these seem to relate to the service.

=> so as you can see: I'm completely lost at the moment. Maybe someone can help me get this working properly (pi gets time from ..ntp.org and acts as a time server in the LAN (the pi is already distributed via dhcp)...

Thx

I'm not sure how that could be working and its possible that your windows machine is falling back to another source. A stock pi install would consist of a ntp client only.

What does sudo ss -upln show? Look specifically for port 123 as that would be the port for a ntp server.

Strictly speaking Pi-hole does not provided time services. That is a function of your operating system and the time services installed. For example on my Debian-based distro, I use the service systemd-timesyncd (which is just an NTP client to set the Raspberry's time). Other distros may use NTP. You may have to consult a forum for your OS-specific set up.

The part that Pi-hole can provide is automatic distribution of the device's address as a time server, via DHCP. There is a DHCP option (42 or ntp-server) to set that, which could go into a dnsmasq configuration file (v5 only?). There might be Pi-hole documentation on adding that.

Are you running a v5 Pi-hole, or do you participate in the v6 beta?

"sudo ss -upln" shows that NTPD is running (multiple Port 123 entries for each IP range on the Pi).

I already knew that, which is why I only talked about one Pi. This isn’t really a Pi-hole issue.

Yes, I communicate option 42 (NTP) to clients via DHCP. Windows doesn’t really care about that, but I specifically set the Pi’s IP address there. That works as expected—Windows synchronizes its time with the Pi/NTP.

I’m running Pi-hole v5 on Raspberry Pi OS "Buster."

What’s clear to me: a time server is running on the Pi; otherwise, Windows wouldn’t be able to get the time from that IP. I’ve had this Pi with Pi-hole for a long time, and I remember setting up something with NTP back then, but I have no idea what exactly. I also don’t have enough Linux knowledge to figure it out again.

It seems that ntpd is running as the server, at least according to sudo ss -upln.

Now the only question is: where does the time that the server distributes come from? There are many options for NTP on Linux. I need to identify this or at least check if the Pi is actually fetching the time via NTP. If it’s not, I’d like to change that. :slight_smile:

You can try ntpq -p to see where NTP is getting is clock and ntpstat also systemctl status ntp

The config is located /etc/ntp.conf and that should show the pools your using.

You mentioned that your using buster. Note that that is EOL as of June / July and will not recieve any updates going forward.

1 Like

Also check out the man page (if installed) for ntpd eg:

$ man ntpd
[..]
FILES
       /etc/ntp.conf
              default name of the configuration file

       /etc/ntp.drift
              default name of the drift file

SEE ALSO
       ntp.conf(5), ntpdate(8)

       The     complete    documentation    can    be    found    at
       /usr/share/doc/ntp-doc/html/ntpd.html in the package ntp-doc.

Then your issue is completely unrelated to Pi-hole.
You should consider to consult forums on your chosen OS and/or NTP server software for further configuration advice.

Note that upcoming Pi-hole v6 will embed both a simple NTP client as well as an NTP server, where you could configure relevant settings via Pi-hole's UI: