[Networkmanager] NetworkManager handling of NTP options

Andrei Borzenkov arvidjaar at gmail.com
Sat Mar 11 06:25:12 UTC 2023

On 10.03.2023 23:50, mh at mike.franken.de wrote:
> Hi *,
> I am using systemd-timesyncd for managing the ntp server entries on my
> clients. Because NetworkManager doesn't update timesyncd.conf, I wrote a
> dispatcher script, that is doing this job. The script is using the
> DHCP[46]_NTP_SERVERS env vars, NetworkManager is providing to dispatcher
> scripts.
> Everything works fine for DHCP connections, but as for my wireguard VPN
> connection this doesn't work, because there isn't any setting for ntp servers
> - at least I couldn't find one.
> So I thought, I could add a static fallback entry to /etc/sysconfig/network/
> config in NETCONFIG_NTP_STATIC_SERVERS. Indeed this entry is written to some
> files, for example to chrony.servers.
> But I couldn't find any easy way to get that value from my dispatcher script
> besides reading NETCONFIG_NTP_STATIC_SERVERS myself. Is this really the way to
> do this or am I missing something here?

This file is configuration file for netconfig tool. It is not intended 
to be used by anything else.

> Whats more: If this static entry exists, NetworkManager is writing it to the
> above mentioned files even if it gets ntp servers from a DHCP connection. Is
> this correct?

Yes. Default netconfig policy if NetworkManager is present is to use 
values from NetworkManager if available and statically defined values 
otherwise. See "man 8 netconfig". NetworkManager does not provide any 
NTP server to netconfig (it only uses it to manage DNS configuration), 
so netconfig falls back to statically defined values. It happens every 
time interface configuration changed.

> debug: ntp-runtime Module called
> debug: Resolved ntp-policy 'auto' for service 'NetworkManager' to
> 'STATIC_FALLBACK NetworkManager'
> debug: Static Fallback
> debug: Use NetworkManager policy merged settings
> debug: exec get_ntp_settings: /run/netconfig/NetworkManager.netconfig
> debug:      get_ntp_settings: NTP_SERVER_LIST=''
> debug: exit get_ntp_settings: /run/netconfig/NetworkManager.netconfig
> debug: write_chrony_servers:
> debug: ntp servers written to /run/netconfig/chrony.servers
> debug: write_ntpd_servers:
> debug: ntp servers written to /run/ntp/servers-netconfig
> - openSUSE Tumbleweed 20230308

As was already mentioned, netconfig is completely unrelated to 
NetworkManager, it is external tool to merge dynamic information from 
various sources (mostly intended for DHCP information from different 
interfaces) available in (open)SUSE.

It does not support systemd-timesyncd, although it is possible to add 
netconfig module to do it (modules are located in 
/usr/libexec/netconfig/netconfig.d) in which case you could simply call 
"netconfig" from your dispatch script to update configuration and 
netconfig would Do The Right Thing depending on whether your interface 
has dynamic NTP servers or not. You may also consider extending existing 
/usr/libexec/netconfig/netconfig.d/ntp-runtime to also support 

But that is out of scope on this list.

> - NetworkManager-1.42.2-1.1.x86_64
> - systemd-252.7-1.1.x86_64
> TIA.
> Bye.
> Michael.

More information about the Networkmanager mailing list