Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

timedatectl DHCP NTP Server

746 views
Skip to first unread message

basti

unread,
Feb 4, 2021, 4:20:04 PM2/4/21
to
Hello,
I use a up to date debian. As I can see now timedatectl seems *not*
using the NTP Server provide by DHCP. I have configure a NTP server in LAN.

timedatectl timesync-status
Server: 167.86.86.192 (0.debian.pool.ntp.org)
Poll interval: 1min 4s (min: 32s; max 34min 8s)
Leap: normal
Version: 4
Stratum: 2
Reference: CD2EB2A9
Precision: 1us (-24)
Root distance: 45.645ms (max: 5s)
Offset: +7.949ms
Delay: 36.328ms
Jitter: 0
Packet count: 1
Frequency: +79.117ppm


ntpdate -bu raspi
4 Feb 22:15:53 ntpdate[21025]: step time server 192.168.30.5 offset
-0.016785 sec

Can someone confirm that?

Best Regards

Dan Ritter

unread,
Feb 4, 2021, 5:00:06 PM2/4/21
to
basti wrote:
> I use a up to date debian.

Stable? Testing? Unstable?


> As I can see now timedatectl seems *not*
> using the NTP Server provide by DHCP. I have configure a NTP server in LAN.
>

Assuming you are sending option 42, the usual way to get that
adopted is to tell dhclient.conf:

request ... ntp-servers ...

which should create an /etc/ntp.conf.dhcp which could then
be picked up by /etc/dhcp/dhclient-exit-hooks.d/.

But maybe you're running systemd, in which case it will
probably be different.

-dsr-

Charles Curley

unread,
Feb 4, 2021, 11:00:05 PM2/4/21
to
On Thu, 4 Feb 2021 22:16:12 +0100
basti <maili...@unix-solution.de> wrote:

> I use a up to date debian. As I can see now timedatectl seems *not*
> using the NTP Server provide by DHCP. I have configure a NTP server
> in LAN.
>
> timedatectl timesync-status
> Server: 167.86.86.192 (0.debian.pool.ntp.org)
> Poll interval: 1min 4s (min: 32s; max 34min 8s)

I see the same, on a Bullseye system.

root@dragon:~# timedatectl timesync-status
Server: 198.74.51.125 (2.debian.pool.ntp.org)
Poll interval: 34min 8s (min: 32s; max 34min 8s)
Leap: normal
...

This box is running systemd, and ntp is not present.

The dhcp server shows:


subnet 192.168.100.0 netmask 255.255.255.0 {
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.100.255;
option routers 192.168.100.31;
option domain-name-servers 192.168.100.30, 192.168.100.6, 192.168.100.31; # chaffee, hawk, freeman
option domain-search "localdomain", "virtual", "yen";

option domain-name "localdomain";
option ntp-servers 192.168.100.31; # freeman, AKA ntp.localdomain
# range 192.168.100.1 192.168.100.254;

...

--
Does anybody read signatures any more?

https://charlescurley.com
https://charlescurley.com/blog/

john doe

unread,
Feb 5, 2021, 1:30:06 AM2/5/21
to
It does work fine for me, is the lease showing the ntp server?

Note that systemd is using a sntp client and not a ntp client.

Does 'systemctl restart systemd-timesyncd' help?

--
John Doe

basti

unread,
Feb 5, 2021, 3:20:05 AM2/5/21
to
OK thanks John,

I don't know what was wrong here. I move the option from global to the
subnet and backup to global and for now it works on Debian Buster.

deloptes

unread,
Feb 5, 2021, 3:30:04 AM2/5/21
to
you are mixing up two different approaches. Try

timedatectl show-timesync

timedatectl has its config in /etc/systemd/timesyncd.conf

ntpdate has no idea what systemd is doing

set your NTP IP in /etc/systemd/timesyncd.conf
and restart

systemctl restart systemd-timesyncd

or disable the service

systemctl status systemd-timesyncd
systemctl disable systemd-timesyncd

Not so hard to read man pages though

man timesyncd.conf

regards

Darac Marjal

unread,
Feb 5, 2021, 3:40:06 AM2/5/21
to
And, for the D part in DHCP, the ArchWiki has as recipe for how to do
this automatically using NetworkManager's dispatcher scripts. OP hasn't
said what DHCP client they use, so some adaption might be required.
OpenPGP_signature

Charles Curley

unread,
Feb 5, 2021, 9:20:05 AM2/5/21
to
On Fri, 05 Feb 2021 09:22:55 +0100
deloptes <delo...@gmail.com> wrote:

> set your NTP IP in /etc/systemd/timesyncd.conf
> and restart
>
> systemctl restart systemd-timesyncd

I thought the whole point of specifying the time server via DHCP was to
avoid editing /etc/systemd/timesyncd.conf.

Charles Curley

unread,
Feb 5, 2021, 9:50:06 AM2/5/21
to
On Fri, 5 Feb 2021 07:24:05 +0100
john doe <johndo...@mail.com> wrote:

> It does work fine for me, is the lease showing the ntp server?

I don't know. The computer in question is a laptop and using wifi and
NetworkManager. There is no dhcp.leases file for the wifi nic. There is
an old one for the wired nic, which shows the ntp server.

I forced a renewal of the lease, and looked at syslog. NM reports plenty
of information about the lease, but not the time server option.

Is there a way to learn this other than the leases file?

>
> Note that systemd is using a sntp client and not a ntp client.
>
> Does 'systemctl restart systemd-timesyncd' help?

No. There is no change in the ntp server.

Charles Curley

unread,
Feb 5, 2021, 11:00:06 AM2/5/21
to
On Fri, 5 Feb 2021 07:22:27 -0700
Charles Curley <charle...@charlescurley.com> wrote:

> On Fri, 5 Feb 2021 07:24:05 +0100
> john doe <johndo...@mail.com> wrote:
>
> > It does work fine for me, is the lease showing the ntp server?
>
> I don't know. The computer in question is a laptop and using wifi and
> NetworkManager. There is no dhcp.leases file for the wifi nic. There
> is an old one for the wired nic, which shows the ntp server.
>
> I forced a renewal of the lease, and looked at syslog. NM reports
> plenty of information about the lease, but not the time server option.
>
> Is there a way to learn this other than the leases file?

I have two other machines running the systemd time client. Both are
Bullseye. Both show that they are using the local NTP server. Neither
is running NetworkManager.

Is NetworkManager causing problems here?

Charles Curley

unread,
Feb 5, 2021, 2:00:05 PM2/5/21
to
On Fri, 5 Feb 2021 08:33:30 -0700
Charles Curley <charle...@charlescurley.com> wrote:

> I have two other machines running the systemd time client. Both are
> Bullseye. Both show that they are using the local NTP server. Neither
> is running NetworkManager.
>
> Is NetworkManager causing problems here?

Apparently, yes. And apparently this is a long-standing problem. See
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=537358 and
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=627343

Basti, I conjecture that you are using NetworkManager. Are you?

Meanwhile, I am going to have a go at the script at
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=537358#37

john doe

unread,
Feb 5, 2021, 2:00:05 PM2/5/21
to
On 2/5/2021 4:33 PM, Charles Curley wrote:
> On Fri, 5 Feb 2021 07:22:27 -0700
> Charles Curley <charle...@charlescurley.com> wrote:
>
>> On Fri, 5 Feb 2021 07:24:05 +0100
>> john doe <johndo...@mail.com> wrote:
>>
>>> It does work fine for me, is the lease showing the ntp server?
>>
>> I don't know. The computer in question is a laptop and using wifi and
>> NetworkManager. There is no dhcp.leases file for the wifi nic. There
>> is an old one for the wired nic, which shows the ntp server.
>>
>> I forced a renewal of the lease, and looked at syslog. NM reports
>> plenty of information about the lease, but not the time server option.
>>
>> Is there a way to learn this other than the leases file?
>
> I have two other machines running the systemd time client. Both are
> Bullseye. Both show that they are using the local NTP server. Neither
> is running NetworkManager.
>
> Is NetworkManager causing problems here?
>

For lack of time, I resorted to use systemd-timesyncd but apparently you
need to configure NM to handle NTP server by way of a hook or tweaking
the profile for the desired connection.

--
John Doe

Charles Curley

unread,
Feb 5, 2021, 2:20:05 PM2/5/21
to
On Fri, 5 Feb 2021 19:50:49 +0100
john doe <johndo...@mail.com> wrote:

> >
> > Is NetworkManager causing problems here?
> >
>
> For lack of time, I resorted to use systemd-timesyncd but apparently
> you need to configure NM to handle NTP server by way of a hook or
> tweaking the profile for the desired connection.

So I conjecture. I am working on a script to update systemd-timesyncd,
based on one I found in one of the two bug reports I mentioned earlier.

deloptes

unread,
Feb 5, 2021, 4:00:07 PM2/5/21
to
Darac Marjal wrote:

> And, for the D part in DHCP, the ArchWiki has as recipe for how to do
> this automatically using NetworkManager's dispatcher scripts. OP hasn't
> said what DHCP client they use, so some adaption might be required.

I am afraid I missed that part. Indeed it seems to be the bug mentioned
already in the thread.

Charles Curley

unread,
Aug 3, 2021, 8:20:05 PM8/3/21
to
On Thu, 4 Feb 2021 22:16:12 +0100
basti <maili...@unix-solution.de> wrote:

> As I can see now timedatectl seems *not*
> using the NTP Server provide by DHCP. I have configure a NTP server
> in LAN.

Are you using NetworkManager? Out of the box, it does not pick up the
relevant information from the dhcp client. There are scripts out there
to handle that for ntp. If you are using systemd-timesyncd, you will
want this:

https://charlescurley.com/blog/posts/2021/Feb/14/networkmanager.time/
0 new messages