DLZ / ISC DHCP query

Marty Lee marty at maui-systems.co.uk
Thu Mar 27 18:58:35 UTC 2014


Hi,

I’m seeing some strange behaviour on a system here, and while I’m looking
to find the root cause, I thought I’d post something here to see if anyone
else has thoughts. (Tried searching the archives, but the web server keeps
telling me that the piper mail archive page doesn’t exist.. hey ho).

Solaris 11; Sun/Oracle compilers; 
* ISC DHCP 4.2.6 (4.3.0 doesn’t compile with Oracle compilers)
* Bind 9.9.5

Both compiled from source and in my normal config (std zone files),
all works ok, including dynamic DNS updates.

Single Solaris x86 box with DHCP and Bind running locally; no other DHCP
or Bind servers present!

I’m trying to move Bind to using MySQL through a DLZ (dlopen) shared
object which I’ve written myself.

With my new DLZ, standard lookups work fine from the database, and
I’ve checked throughly with dig against a standard zone file and a
DLZ database backed one.

Then I moved on to dynamic DNS updates from ISC DHCP…..

With a clean dhcp lease file, and the appropriate zone picked up with
the DLZ driver, I see the following events: (clearly my own debug messages,
but I think they show the sequence of events quite clearly).

27-Mar-2014 18:38:02.824 dlz_newversion: carlops.maui.co.uk
27-Mar-2014 18:38:02.824 dlz_mysql: execute(0) START TRANSACTION
27-Mar-2014 18:38:02.824 Connect to database dns @ localhost
27-Mar-2014 18:38:02.826 dlz_mysql: allowing update of name=Martys-iPad.carlops.maui.co.uk by dhcpupdate
27-Mar-2014 18:38:02.826 dlz_mysql: allowing update of name=Martys-iPad.carlops.maui.co.uk by dhcpupdate
27-Mar-2014 18:38:02.827 client 192.168.2.2#55500/key dhcpupdate: updating zone 'carlops.maui.co.uk/NONE': adding an RR at 'Martys-iPad.carlops.maui.co.uk' A
27-Mar-2014 18:38:02.828 dlz_mysql: adding rdataset Martys-iPad.carlops.maui.co.uk 'Martys-iPad.carlops.maui.co.uk.     3600    IN      A       192.168.2.139'
27-Mar-2014 18:38:02.828 dlz_mysql: execute(0) INSERT INTO ZoneData (zone_id, name, type, data, ttl) VALUES (9, LOWER('Martys-iPad'), UPPER('A'), '192.168.2.139', 3600)
27-Mar-2014 18:38:02.828 client 192.168.2.2#55500/key dhcpupdate: updating zone 'carlops.maui.co.uk/NONE': adding an RR at 'Martys-iPad.carlops.maui.co.uk' TXT
27-Mar-2014 18:38:02.829 dlz_mysql: adding rdataset Martys-iPad.carlops.maui.co.uk 'Martys-iPad.carlops.maui.co.uk.     3600    IN      TXT     "31aaee999c17b074d5ffdcba7376571020"'
27-Mar-2014 18:38:02.829 dlz_mysql: execute(0) INSERT INTO ZoneData (zone_id, name, type, data, ttl) VALUES (9, LOWER('Martys-iPad'), UPPER('TXT'), '"31aaee999c17b074d5ffdcba7376571020"', 3600)
27-Mar-2014 18:38:02.832 dlz_mysql: subtracting rdataset carlops.maui.co.uk 'carlops.maui.co.uk.        14400   IN      SOA     carlops.maui.co.uk. dns.carlops.maui.co.uk. 95 86400 7200 86400 86400'
27-Mar-2014 18:38:02.832 dlz_mysql: adding rdataset carlops.maui.co.uk 'carlops.maui.co.uk.     14400   IN      SOA     carlops.maui.co.uk. dns.carlops.maui.co.uk. 96 86400 7200 86400 86400'
27-Mar-2014 18:38:02.832 dlz_mysql: execute(0) UPDATE Zones SET serial = 96 WHERE id = 9
27-Mar-2014 18:38:02.833 dlz_closeversion: carlops.maui.co.uk commit(1)
27-Mar-2014 18:38:02.850 dlz_mysql: execute(0) COMMIT
27-Mar-2014 18:38:02.850 dlz_mysql: committed transaction on zone carlops.maui.co.uk

so far everything looks ok.

Immediately after this set of events, I then get the following:

27-Mar-2014 18:38:02.850 dlz_newversion: carlops.maui.co.uk
27-Mar-2014 18:38:02.850 dlz_mysql: execute(0) START TRANSACTION
27-Mar-2014 18:38:02.850 client 192.168.2.2#55500/key dhcpupdate: updating zone 'carlops.maui.co.uk/NONE': update unsuccessful: Martys-iPad.carlops.maui.co.uk: 'name not in use' prerequisite not satisfied (YXDOMAIN)
27-Mar-2014 18:38:02.850 dlz_closeversion: carlops.maui.co.uk commit(0)
27-Mar-2014 18:38:02.850 dlz_mysql: execute(0) ROLLBACK
27-Mar-2014 18:38:02.851 dlz_mysql: rolled back transaction on zone carlops.maui.co.uk
27-Mar-2014 18:38:02.851 dlz_newversion: carlops.maui.co.uk
27-Mar-2014 18:38:02.851 dlz_mysql: execute(0) START TRANSACTION
27-Mar-2014 18:38:02.852 dlz_mysql: allowing update of name=Martys-iPad.carlops.maui.co.uk by dhcpupdate
27-Mar-2014 18:38:02.852 dlz_mysql: allowing update of name=Martys-iPad.carlops.maui.co.uk by dhcpupdate
27-Mar-2014 18:38:02.852 client 192.168.2.2#55500/key dhcpupdate: updating zone 'carlops.maui.co.uk/NONE': deleting rrset at 'Martys-iPad.carlops.maui.co.uk' A
27-Mar-2014 18:38:02.852 dlz_mysql: subtracting rdataset Martys-iPad.carlops.maui.co.uk 'Martys-iPad.carlops.maui.co.uk.        3600    IN      A       192.168.2.139'
27-Mar-2014 18:38:02.853 dlz_mysql: execute(0) DELETE FROM ZoneData WHERE zone_id = 9 AND LOWER(name) = LOWER('Martys-iPad') AND UPPER(type) = UPPER('A') AND data = '192.168.2.139' AND ttl = 3600
27-Mar-2014 18:38:02.853 client 192.168.2.2#55500/key dhcpupdate: updating zone 'carlops.maui.co.uk/NONE': adding an RR at 'Martys-iPad.carlops.maui.co.uk' A
27-Mar-2014 18:38:02.856 dlz_mysql: subtracting rdataset carlops.maui.co.uk 'carlops.maui.co.uk.        14400   IN      SOA     carlops.maui.co.uk. dns.carlops.maui.co.uk. 96 86400 7200 86400 86400'
27-Mar-2014 18:38:02.857 dlz_mysql: adding rdataset carlops.maui.co.uk 'carlops.maui.co.uk.     14400   IN      SOA     carlops.maui.co.uk. dns.carlops.maui.co.uk. 97 86400 7200 86400 86400'
27-Mar-2014 18:38:02.857 dlz_mysql: execute(0) UPDATE Zones SET serial = 97 WHERE id = 9
27-Mar-2014 18:38:02.858 dlz_closeversion: carlops.maui.co.uk commit(1)
27-Mar-2014 18:38:02.867 dlz_mysql: execute(0) COMMIT
27-Mar-2014 18:38:02.867 dlz_mysql: committed transaction on zone carlops.maui.co.uk


So it looks like the DHCP server requests a new dynamic IP address to be created; the DLZ performs the task and
updates the zone serial number as expected, but as soon as that has happened, the DHCP server finds the A record,
and then decides the address is in use and removes it… 'name not in use' prerequisite not satisfied (YXDOMAIN)

The MySQL database gets the A record for a split second, then it’s removed, leaving the ‘TXT’ record behind. If
I clear out the lease in the DHCP server file and re-present the device (my iPad), then it works ok on the second
attempt - i.e. it seems to need the ‘TXT’ record to be there for some reason.

I’ll go and play with the stock DLZ example zone for example.nil and see if that does the same,
but it looks like either the DHCP server is doing something weird, or I’ve missed some critical item of doing
dynamic DNS updates with DLZ.

(as a side note, I did wonder whether I should just hold the updates in memory and only commit them
to the db when the ‘commit’ message is passed…. that resulted in the same behaviour, but would have
been a logical solution had it been the problem).

I know other people have used DLZ and dlopen with external modules; anyone got any gems of insight??

I’ve got no problems working my way through the code to figure out what is going on, but obviously if
someone else can give me a head start, then it would be appreciated!

BTW, doing a manual Dynamic DNS update using nsupdate works fine - the A and TXT records are created
without any problem and the A record isn’t then deleted, so it’s something to do with the DHCP server
and it’s interaction with Bind.

Cheers

marty



-----
Marty Lee                         e: marty at maui-systems.co.uk
Technical Director                v: +44 845 869 2661
Maui Systems Ltd                  f: +44 871 433 8922
Scotland, UK                      w: http://www.maui-systems.co.uk

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 203 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <https://lists.isc.org/pipermail/bind-users/attachments/20140327/66ea964c/attachment.bin>


More information about the bind-users mailing list