Sebastian Arcus
2018-Mar-29 15:24 UTC
[Samba] dhcp lease time hardware in script at dhcpd/Bind/Samba wiki page
On 29/03/18 15:52, Rowland Penny via samba wrote:> 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 > dhcp-dyndns.sh: > > TTL=$(cat /etc/dhcp/dhcpd.conf | grep 'max-lease-time' | awk -F ';' > '{print $1}' | awk '{print $NF}') > > Then replace the '3600' with '$TTL'Thank you for that! I take it there is no corresponding variable, which can be used as an argument in dhcpd.conf when calling dhcp-dyndns.sh? Also, I discovered another typo on the wiki page - which was actually a bit of a pain to track down. On the following line: rzone=$(echo ${ip} | awk -F '.' '{print $3"."$2"."$1".in-addr.arpa"}’) The last quote should be a single quote, but it is actually a backtick. I can report that on Slackware-current with dhcpd 4.4.1, the extra setting suggested to set the rzone is necessary - otherwise Bind tries to use a B class reverse zone instead of a C one and complains that it isn't authoritative for it: updating zone '168.192.IN-ADDR.ARPA/IN': update failed: not authoritative for update zone (NOTAUTH) I have other Slackware servers with dhcpd 4.3.6 and 4.3.4 - and those are happy without the rzone line.
Rowland Penny
2018-Mar-29 15:41 UTC
[Samba] dhcp lease time hardware in script at dhcpd/Bind/Samba wiki page
On Thu, 29 Mar 2018 16:24:32 +0100 Sebastian Arcus via samba <samba at lists.samba.org> wrote:> On 29/03/18 15:52, Rowland Penny via samba wrote: > > > > You could try adding something like this near to the top of > > dhcp-dyndns.sh: > > > > TTL=$(cat /etc/dhcp/dhcpd.conf | grep 'max-lease-time' | awk -F ';' > > '{print $1}' | awk '{print $NF}') > > > > Then replace the '3600' with '$TTL' > > Thank you for that! I take it there is no corresponding variable, > which can be used as an argument in dhcpd.conf when calling > dhcp-dyndns.sh?Not that I am aware of.> > Also, I discovered another typo on the wiki page - which was actually > a bit of a pain to track down. On the following line: > > rzone=$(echo ${ip} | awk -F '.' '{print $3"."$2"."$1".in-addr.arpa"}’)OOPs, I don't use that and I cut and pasted it in, which is no excuse for not noticing, but it is fixed now ;-)> I can report that on Slackware-current with dhcpd 4.4.1, the extra > setting suggested to set the rzone is necessary - otherwise Bind > tries to use a B class reverse zone instead of a C one and complains > that it isn't authoritative for it: > > updating zone '168.192.IN-ADDR.ARPA/IN': update failed: not > authoritative for update zone (NOTAUTH) > > I have other Slackware servers with dhcpd 4.3.6 and 4.3.4 - and those > are happy without the rzone line. >Good to know. Rowland
Sebastian Arcus
2018-Mar-29 17:22 UTC
[Samba] dhcp lease time hardware in script at dhcpd/Bind/Samba wiki page
On 29/03/18 16:41, Rowland Penny via samba wrote:> On Thu, 29 Mar 2018 16:24:32 +0100 > Sebastian Arcus via samba <samba at lists.samba.org> wrote: > >> On 29/03/18 15:52, Rowland Penny via samba wrote: >>> >>> You could try adding something like this near to the top of >>> dhcp-dyndns.sh: >>> >>> TTL=$(cat /etc/dhcp/dhcpd.conf | grep 'max-lease-time' | awk -F ';' >>> '{print $1}' | awk '{print $NF}') >>> >>> Then replace the '3600' with '$TTL' >> >> Thank you for that! I take it there is no corresponding variable, >> which can be used as an argument in dhcpd.conf when calling >> dhcp-dyndns.sh? > > Not that I am aware of. > >> >> Also, I discovered another typo on the wiki page - which was actually >> a bit of a pain to track down. On the following line: >> >> rzone=$(echo ${ip} | awk -F '.' '{print $3"."$2"."$1".in-addr.arpa"}’) > > OOPs, I don't use that and I cut and pasted it in, which is no excuse > for not noticing, but it is fixed now ;-)Thank you very much!
Seemingly Similar Threads
- dhcp lease time hardware in script at dhcpd/Bind/Samba wiki page
- dhcp lease time hardware in script at dhcpd/Bind/Samba wiki page
- dhcp lease time hardware in script at dhcpd/Bind/Samba wiki page
- dhcp lease time hardware in script at dhcpd/Bind/Samba wiki page
- DDNS with bind9 and isc-dhcp-server