On 12/15/2015 3:23 AM, Stuart Henderson wrote: > On 2015-12-14, Mark Carroll <[email protected]> wrote: >> I'm using the dhclient and ntpd from base OpenBSD 5.8. Given the >> apparent lack of dhclient-script or suchlike, I've added a line to the >> end of my hostname.if file so that, after dhcp, I have another line, >> >> !/usr/local/sbin/dhcp-ntp-update \$if >> >> where dhcp-ntp-update is a little Perl script I added that just reads >> /var/db/dhclient.leases.<if>: if ntp-servers are listed then it writes >> them into /etc/ntpd.conf and restarts ntpd. >> >> It seems to work fine. Is this what I should have done, or was there >> something easier? I'm guessing that wanting to set ntpd's servers based >> on what the DHCP server told the system is a fairly typical use case but >> I didn't see anything canned for this. (I'm trying to use what's >> included in the base system rather than just adding the packages for >> whatever I was used to using elsewhere.) > > I don't think there's an easier way without modifying dhclient (and the > latter is tricky with the current privilege model as it would need to > at least signal ntpd to restart). > > The optional file that you can have written with "dhclient -L" may be > a little better than dhclient.leases as then you can be sure the address > is from a current lease. >
In the example mentioned above, does the command !/usr/local/sbin/dhcp-ntp-update \$if run every time dhclient renews the lease, or just the first time a lease is acquired upon system start up?

