Re: timedatectl DHCP NTP Server

2021-08-03 Thread Charles Curley
On Thu, 4 Feb 2021 22:16:12 +0100
basti  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/


-- 
Does anybody read signatures any more?

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



Re: timedatectl DHCP NTP Server

2021-02-06 Thread Charles Curley
On Fri, 5 Feb 2021 12:13:43 -0700
Charles Curley  wrote:

> > 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.

The attached script should do it. Note that it only handles IPV4. See
other notes in the comments.

Note that it creates and logs to its own log file. Once you are
satisfied that it works, you can comment out the rest of the debug
statements.

-- 
Does anybody read signatures any more?

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


60ntp
Description: Binary data


Re: timedatectl DHCP NTP Server

2021-02-05 Thread deloptes
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.




Re: timedatectl DHCP NTP Server

2021-02-05 Thread Charles Curley
On Fri, 5 Feb 2021 19:50:49 +0100
john doe  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.

-- 
Does anybody read signatures any more?

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



Re: timedatectl DHCP NTP Server

2021-02-05 Thread Charles Curley
On Fri, 5 Feb 2021 08:33:30 -0700
Charles Curley  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

-- 
Does anybody read signatures any more?

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



Re: timedatectl DHCP NTP Server

2021-02-05 Thread john doe

On 2/5/2021 4:33 PM, Charles Curley wrote:

On Fri, 5 Feb 2021 07:22:27 -0700
Charles Curley  wrote:


On Fri, 5 Feb 2021 07:24:05 +0100
john doe  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



Re: timedatectl DHCP NTP Server

2021-02-05 Thread Charles Curley
On Fri, 5 Feb 2021 07:22:27 -0700
Charles Curley  wrote:

> On Fri, 5 Feb 2021 07:24:05 +0100
> john doe  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?

-- 
Does anybody read signatures any more?

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



Re: timedatectl DHCP NTP Server

2021-02-05 Thread Charles Curley
On Fri, 5 Feb 2021 07:24:05 +0100
john doe  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.



-- 
Does anybody read signatures any more?

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



Re: timedatectl DHCP NTP Server

2021-02-05 Thread Charles Curley
On Fri, 05 Feb 2021 09:22:55 +0100
deloptes  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.

-- 
Does anybody read signatures any more?

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



Re: timedatectl DHCP NTP Server

2021-02-05 Thread Darac Marjal

On 05/02/2021 08:22, deloptes wrote:
> basti wrote:
>
>> 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
> 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 

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.


>
> 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
>
>
>



OpenPGP_signature
Description: OpenPGP digital signature


Re: timedatectl DHCP NTP Server

2021-02-05 Thread deloptes
basti wrote:

> 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

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





Re: timedatectl DHCP NTP Server

2021-02-05 Thread basti

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.



On 05.02.21 07:24, john doe wrote:

On 2/5/2021 4:10 AM, Charles Curley wrote:

On Thu, 4 Feb 2021 22:16:12 +0100
basti  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;

...



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





Re: timedatectl DHCP NTP Server

2021-02-04 Thread john doe

On 2/5/2021 4:10 AM, Charles Curley wrote:

On Thu, 4 Feb 2021 22:16:12 +0100
basti  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;

...



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



Re: timedatectl DHCP NTP Server

2021-02-04 Thread Charles Curley
On Thu, 4 Feb 2021 22:16:12 +0100
basti  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/



Re: timedatectl DHCP NTP Server

2021-02-04 Thread Dan Ritter
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-



timedatectl DHCP NTP Server

2021-02-04 Thread basti
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