[Samba] dhcp lease time hardware in script at dhcpd/Bind/Samba wiki page

Rowland Penny rpenny at samba.org
Thu Mar 29 14:52:45 UTC 2018

On Thu, 29 Mar 2018 15:01:26 +0100
Sebastian Arcus via samba <samba at lists.samba.org> wrote:

> There seems to be a slight issue with the instructions at the
> following wiki page:
> https://wiki.samba.org/index.php/Configure_DHCP_to_update_DNS_records_with_BIND9
> The /usr/local/bin/dhcp-dyndns.sh script seems to use a hardwired
> value for the lease expiry time of 3600 - independent of whatever is 
> configured in dhcpd.conf. With the examples provided, it should work,
> as the example dhcpd.conf uses 1800 for lease expiry time - so dhcpd
> will try to renew the lease before it actually expires. However, when
> I implemented the script, I didn't notice that the lease time is
> hardwired in the dhcp-dyndns.sh script - so I've set a higher value
> in dhcpd.conf. This seems to have caused all sorts of strange
> behaviour, as Bind/samba_dlz were expiring leases and dhcpd wasn't
> renewing them - thinking they are still valid.
> Would it be possible to pass the max lease time value from dhcpd.conf
> to the dhcp-dyndns.sh script somehow? I would have made a suggestion 
> myself, but for the life of me I can't find anywhere on the net a 
> reference of standard variable which can be used in dhcpd.conf.
> If the above is not possible, maybe a max-lease-time variable should
> be placed at the top of the dhcp-dyndns.sh script. so that at least
> it is obvious that this is set again in this script, and not carried
> over from dhcpd.conf?

You could try adding something like this near to the top of

TTL=$(cat /etc/dhcp/dhcpd.conf | grep 'max-lease-time' | awk -F ';'
'{print $1}' | awk '{print $NF}')

Then replace the '3600' with '$TTL'


More information about the samba mailing list