2

I'm trying to stop some SBCs (running Debian) from updating their time via the router's own NTP server. We just want to use a manually configured one such as one from *.pool.ntp.org.

I believe the root cause to a particular problem occurs when some routers are reset. For a short time, the routers appear to be responding with blatantly wrong dates like 01 Jan 2003 (at time of writing it's 2019!), and then return to normal. This has a really negative impact on the software running on the respective SBCs. I have no control over these routers and really don't need to use them for NTP. It's just that the router's DHCP server offers NTP and the Debian SBCs use it automatically.


My first thought was to remove ntp-servers from /etc/dhcp/dhclient.conf eg:

request subnet-mask, broadcast-address, time-offset, routers,
    domain-name, domain-name-servers, domain-search, host-name,
    dhcp6.name-servers, dhcp6.domain-search, dhcp6.fqdn, dhcp6.sntp-servers,
    netbios-name-servers, netbios-scope, interface-mtu,
    rfc3442-classless-static-routes, ntp-servers;

But from what I can read /etc/dhcp/dhclient.conf is no longer used by Debian as it uses systemd-networkd and systemd-timesyncd.


Every manual I can find says words to the effect:

Any per-interface NTP servers obtained from systemd-networkd.service(8) configuration or via DHCP take precedence.

This is specifically the behaviour I need to prevent. Even if the router can offer ntp-servers we need to prevent these being used as NTP servers.

Jeff Schaller
  • 66,199
  • 35
  • 114
  • 250
Philip Couling
  • 17,591
  • 5
  • 42
  • 82

2 Answers2

1

Please refer to the documentation at freedesktop.org

You can disable the default behavior using UseNTP=no inside the [DHCPv4] and [DHCPv6]sections of a .network ini-styled file you have to put inside /etc/systemd/network folder.

You also have to activate DHCP=yes in the [Network] section, in order to make this having an effect.

HJo
  • 11
  • 2
0

Not sure if I get your question, but you can edit the /etc/ntp.conf to have the following server *.pool.ntp.org prefer. The prefer keyword should prefer the specified server over the others in the list.

Khaled Abuelenain
  • 173
  • 1
  • 2
  • 8
  • 1
    AFAIK, `/etc/ntp.conf` isn't read by [systemd-networkd](https://wiki.archlinux.org/index.php/Systemd-timesyncd). That is, we're not using `ntpd` but systemd's own daemon. – Philip Couling Jul 12 '19 at 07:35