Re: Question about NTP via DHCP - RFC 2132
Roy Marples
Fri Jul 24 15:38:11 2020
On 24/07/2020 13:46, Stefano Cappa wrote:
How many times dhcpcd calls my custom hook? I suppose multiple times, or am I wrong?
If dhcpcd calls the hook multiple times and $if_up is always true, I'll restart
my ntp service many times.
To prevent this, is it right to compare "old_" and "new_" ntp_servers variables
to understand if something is changed to decide if I should reboot systemd or not?
Obviously, as you suggested, I should also check if the variable is empty.
This is what the dhcpcd ntp hook script does.
All this discussion is about my worries about runtime/live changes of the router
configuration. Because, if I change NTP on the router, I expect that my device
with dhcpcd will always receive and update the new NTP via DHCP packet. But
obviously, I don't want to restart NTP daemon if there are no real reasons to do it.
Yes
"The answer simply is, you just don't know." I absolutely agree with this and I
have to trust in dhcpcd.
But my question was more about to find a commercial router that I can buy
without spending too much money to try my configuration.
Why not setup a VM and install your own NTP server? Then just set it's IP
address in the DHCP message from your DHCP server which may or may not be on the
same machine.
Because at the moment I don't have any physical router that can set NTP via
DHCP. I found only routers able to set the local time, but not an ip address.
Also searching on the web I found only some professional Cisco routers, but not
something cheaper to buy. I'm really surprised that this feature is so uncommon
on domestic routers.
If you have this information, can you suggest, also privately, the model of
router available on the market that can let me try this feature on a real
network? At least, to check if what I've done is really working, because now I'm
simulating everything and I don't really trust what I've done.
I'm not going to do your market research for you :)
I generally roll my own router - I currently use an EdgeRouter LITE re-flashed
with NetBSD which runs dnsmsaq and NTPd.
Roy
Archive administrator: postmaster@marples.name