Web lists-archives.com

Re: [Samba] Configure DHCP to update DNS records with BIND9




On Fri, 14 Jul 2017 14:43:30 +0200
Christian Naumer via samba <samba@xxxxxxxxxxxxxxx> wrote:

> Hallo all,
> I configured DHCPD on two of my DCs to update the DNS records
> according to the wiki (https://w
> iki.samba.org/index.php/Configure_DHCP_to_update_DNS_records_with_BIND9).
> 
> This works fine except when a lease expires the records are not
> deleted.
> 
> In the log I see this with an added record:
> 
> Jul  7 07:46:12 dc1 dhcpd: execute_statement argv[0]
> = /etc/dhcp/bin/dhcp-dyndns.sh Jul  7 07:46:12 dc1 dhcpd:
> execute_statement argv[1] = add Jul  7 07:46:12 dc1 dhcpd:
> execute_statement argv[2] = 192.168.X.X Jul  7 07:46:12 dc1 dhcpd:
> execute_statement argv[3] = 1:0:00:00:00:00:00 Jul  7 07:46:12 dc1
> dhcpd: execute_statement argv[4] = NAME
> 
> 
> When a lease expires I see this:
> 
> Jul  7 07:46:09 dc1 dhcpd: execute_statement argv[0]
> = /etc/dhcp/bin/dhcp-dyndns.sh Jul  7 07:46:09 dc1 dhcpd:
> execute_statement argv[1] = delete Jul  7 07:46:09 dc1 dhcpd:
> execute_statement argv[2] = 192.168.X.X Jul  7 07:46:09 dc1 dhcpd:
> execute_statement argv[3] = Jul  7 07:46:09 dc1 dhcpd:
> execute_statement argv[4] = 0 Jul  7 07:46:09 dc1 dhcpd: USAGE:
> Jul  7 07:46:09 dc1 dhcpd: dhcp-dyndns.sh add ip-address
> dhcid|mac-address hostname Jul  7 07:46:09 dc1 dhcpd: dhcp-dyndns.sh
> delete ip-address dhcid|mac-address Jul  7 07:46:09 dc1 dhcpd:
> execute: /etc/dhcp/bin/dhcp-dyndns.sh exit status 256
> 
> I the wiki the lines for adding a record in "/etc/dhcp/dhcpd.conf" are
> 
> execute("/etc/dhcp/bin/dhcp-dyndns.sh", "add", ClientIP, ClientDHCID,
> ClientName);
> 
> for deletion
> 
> execute("/etc/dhcp/bin/dhcp-dyndns.sh", "delete", ClientIP, "", "0");
> 
> as you can see the Name should be argv[4] the MAC should be argv[3].
> For deletion this isn't the case and the script checks for MAC (#
> Exit if no ip address or mac-address) and exits with usage.
> 
> I checked this running this by hand:
> 
> runuser -l dhcpd -c "/etc/dhcp/bin/dhcp-dyndns.sh delete 192.168.6.1
> 0"
> 
> works
> 
> runuser -l dhcpd -c "/etc/dhcp/bin/dhcp-dyndns.sh delete 192.168.6.1
> '' 0"
> 
> does not.
> 
> As it works for the author I think this might be distribution
> specific (I am on Centos 7) thing of interpreting ""? 
> I have changed my dhcp.conf to include this when a lease expires:
> 
> execute("/etc/dhcp/bin/dhcp-dyndns.sh", "delete", ClientIP,"0");
> 
> This works for us. Should this be added to the WIKI?
> 
> hope this helps somebody.
> 
> Regards
> 
> Christian
> 

Before getting that far, can you post the entire block from the log,
from where the computer either asks to renew (or in your case expire)
the lease to were the message 'DHCP-DNS Update' is printed and then I
can try and understand what is going on.

Rowland

-- 
To unsubscribe from this list go to the following URL and read the
instructions:  https://lists.samba.org/mailman/options/samba