[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: systemd/dhcp v. ntpd



On Wed, Feb 09, 2022 at 10:49:34AM -0500, Lee wrote:
> >> My first thought was telling the machine to ignore the NTP server
> >> address handed out via DHCP.  Maybe there's a way to do that, but I
> >> couldn't figure out how :(
> >
> > supercede ntp-servers "..." in dhclient.conf should do it for you.
> >
> > The option was helpfully provided by dhclient.conf(5).
> 
> I tried not giving it a value - ie
> supersede ntp-servers ;
> 
> didn't work.  Apparently one _has_ to give it a value.

Yup. But you know which NTP servers you want this host to use, do you?


> >> >> I tried changing /etc/dhcp/dhclient.conf to request just
> >> >>   request   subnet-mask, broadcast-address, routers,
> >> >>             interface-mtu,
> >> >>             rfc3442-classless-static-routes ;
> >> >>
> >> >> and systemd still restarted ntpd with only the dhcp supplied ntp
> >> >> server address ... which is this machine, so all the configured ntp
> >> >> servers went away :(
> >
> > And that merely stopped dhclient from asking DHCP server to provide
> > "ntp-server" option. What it cannot stop is DHCP server providing
> > "ntp-server" option anyway.
> >
> > ISC dhclient simply lacks the option to ignore certain options in DHCP
> > reply. It can supercede them though.
> 
> The way I read the man page, supercede requires a value.

One can say that too.


> I can't just say ignore what the DHCP server gives me, I have to say
> use <this> instead of what the DHCP server gives me ... and there is
> no <this> value, it's several pool & server lines that I don't want
> replaced.

Changing DHCP client is an option too.


> >> >> I then tried telling network manager to just get an ip address &
> >> >> subnet mask from dhcp.  And still systemd fucked up the ntpd config
> >> >>
> >> >> What finally worked was editing /usr/lib/ntp/ntp-systemd-wrapper to
> >> >> remove ' NTPD_OPTS="$NTPD_OPTS -u $UGID" '
> >> >
> >> > Huh?  You're saying that removing the "-u $UGID" option made it "work"?
> >> > And that it "didn't work" with -u being passed?
> >
> > Changing the contents of /etc/dhcp/dhclient-exit-hooks.d/ntp would make
> > it more friendly for the purpose of the future updates.
> 
> Changing it or moving it to another, clearly not supposed to be
> invoked, directory?

Removing this hook should be sufficient. Even better - add "exit 0" to
the beginning.

Reco


Reply to: