[Samba] Configure DHCP to update DNS records with BIND9

Christian Naumer cn at brain-biotech.de
Fri Jul 14 12:43:30 UTC 2017


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

-- 
Dr. Christian Naumer
Research Scientist
Plattform-Koordinator Bioprozesstechnik

B.R.A.I.N Aktiengesellschaft
Darmstaedter Str. 34-36, D-64673 Zwingenberg
e-mail cn at brain-biotech.de, homepage www.brain-biotech.de
fon +49-6251-9331-30  /   fax +49-6251-9331-11

Sitz der Gesellschaft: Zwingenberg/Bergstrasse
Registergericht AG Darmstadt, HRB 24758
Vorstand: Dr. Juergen Eck (Vorsitzender), Frank Goebel
Aufsichtsratsvorsitzender: Dr. Ludger Mueller



More information about the samba mailing list