0

My environment is a Debian 11 server ( bullseye ). As it is a test system I kept DHCP configuration on the interface as well as the DHCP server is configured to give always to same IP address based on the MAC address. I realised that the NTP daemon restarts exactly in a 12 hour interval. This happens when the Debian server sends out a DHCP requests and gets immediately a DHCP ack. As it is a renewal after 50% of the lease time the IP address of the interface is unchanged. In daemon.log I can find

ntpd exiting on signal 15 (Terminated)

Immediately after that ntpd is restarted, obviously with systemctl functionality. I tried to figure out which script is responsible for this strange behaviour ( why should we restart ntpd if the lease is renewed. )

The files in /etc/dhcp and below were promising. But I couldn't manage to stop this behaviour. Any idea how to fix this issue ? Of course I could define fixed IP addresses for this network card but this would be the last way out.

3 Answers 3

0

This is standard procedure, during DHCP lease renewal procedure. DHCP client manage this by following script: /etc/dhcp/dhclient-exit-hooks.d/ntp.
Try to move this file to another location or comment all lines.

1
  • As I mentioned before looking at /etc/dhcp is the wrong direction. BUt in the meantime I found the solution.
    – hans
    Jul 4, 2022 at 7:03
0

It is related to the dhcp client service. Running dhcpcd.service in debug mode with option -d shows that /lib/dhcpcd/dhcpcd-run-hook will be executed. So the solution is quite simple: rename the file 66-ntp.conf to .66-ntp.conf or delete it.

1
  • 66-ntp.conf is located in /lib/dhcpcd/dhcpcd-hooks
    – hans
    Jul 4, 2022 at 7:14
0

I had this problem, too. I would find my ntp service had just stopped.

Our DHCP server is configured to return DHCP option 42 -- a list of NTP servers available to the client by IP address. Some systems ignore this DHCP option. Windows, which doesn't have full support for NTP, uses this address to set its default time server. Modern Debian systems, for reasons unknown to me, handle the option poorly, and kill off the ntpd service.

My solution for Debian 11 is to edit the file /etc/dhcp/dhclient.conf, removing dhcp6.sntp-servers and ntp-servers from the request statement. [The man page for dhclient.conf doesn't even mention these options, and it certainly doesn't say they are default options for Debian 11.] I know nothing more about these options, aside from the fact that I stumbled upon them, and removing them fixed the problem of my ntpd service being killed off periodically.

root@nickel:/etc/dhcp# diff dhclient.conf.orig dhclient.conf
18c18
<       dhcp6.name-servers, dhcp6.domain-search, dhcp6.fqdn, dhcp6.sntp-servers,
---
>       dhcp6.name-servers, dhcp6.domain-search, dhcp6.fqdn,
20c20
<       rfc3442-classless-static-routes, ntp-servers;
---
>       rfc3442-classless-static-routes;
root@nickel:/etc/dhcp#

If your DHCP server returns Option 42 despite this change, then I hide file /etc/dhcp/dhclient-exit-hooks.d/ntp, where DHCP can't find it.

I think somebody in the Linux DHCP world doesn't understand that the ntpd service works best if it is started and just left running. It averages local time skew day and night, hot and cold, CPU busy and CPU idle, to provide a reasonably good local time. Killing and restarting ntpd is harmful to its function. So, if I have taken the time to configure my own ntp.conf file, DHCP shouldn't be changing it, and especially DHCP shouldn't be killing and/or restarting my ntp service. [Just my opinion.]

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .