<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">As promised...<br></div><div dir="ltr"><br></div><div>I now have this close enough to working as makes no odds for me ;)</div><div><br></div><div>There were a few bumps along the way, in particular Jan-Piet Mens says in this (rather old, but still top hit in google) blog post:</div><div><a href="https://jpmens.net/2011/07/06/execute-a-script-when-isc-dhcp-hands-out-a-new-lease/" style="font-family:-webkit-standard">https://jpmens.net/2011/07/06/execute-a-script-when-isc-dhcp-hands-out-a-new-lease/</a></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">If you are using the built-in mechanisms for DNS updates, you must not define events, as they are then used internally by dhcpd. (The manual page does, however, give hint at how to overcome that problem.)</blockquote><div><br></div><div>I didn't see anything in any of the man files (dhcpd/dhcpd.conf/dhcpd-eval) which seemed relevant, and the post is quite old,   ...</div><div><br></div><div>So I set about testing for myself.  I have ended up with:</div><div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">  on commit {<br>    set ClientIP = binary-to-ascii(10, 8, ".", leased-address);<br>    set ClientMac = binary-to-ascii(16, 8, ":", substring(hardware, 1, 6));<br>    set ClientHost = pick-first-value( host-decl-name,<br>                                       option fqdn.hostname,<br>                                       option host-name,<br>                                       "none");<br>    execute("/etc/dhcp/scripts/test", "commit", ClientIP, ClientMac, ClientHost); </blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">  }</blockquote><div> </div></div><div><br></div><div>in my dhcp subnet definition, and the referenced script (owned by dhcpd) calls nsupdate (it specifies the zone, server and key manually) to add in the cname using:</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">(echo server <a href="http://dns.example.org">dns.example.org</a>; echo zone <a href="http://example.org">example.org</a>; echo add *.${host}.<a href="http://example.org">example.org</a> 600 cname ${host}.<a href="http://example.org">example.org</a>.; echo send) | nsupdate -v -k /etc/bind/ddns_key >> /tmp/ddns.log<br></blockquote><div><br></div><div>That is correctly adding cname entries (I am currently assuming that bind is being sensible in terms of not making multiple identical cnames).</div><div><br></div><div>NB - I haven't put anything in place to remove old entries - but since they are cnames for machines which will likely get created again at some point I'm not too fussed about that just yet (unless someone tells me I need to be).</div><div dir="ltr"><br></div><div dir="ltr"><br></div><div>Just one issue left which is for a different thread.</div><div><br></div><div>Thanks for the pointers,</div><div><br></div><div>John</div><div><br></div><div>-- </div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, 30 Sep 2019 at 09:09, John Robson <<a href="mailto:jrobson@zenoss.com">jrobson@zenoss.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr">ISC DHCP hooks are probably the right way to go then - I'll need to do some research to figure out how to put those in place.<div><br></div><div>Thanks for the hint - I'll come back when I have had a chance to poke a bit more.</div><div><br></div><div>John</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, 29 Sep 2019 at 19:00, Crist Clark <<a href="mailto:cjc%2Bbind-users@pumpky.net" target="_blank">cjc+bind-users@pumpky.net</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div><div dir="auto">This isn’t really a BIND or DNS problem. There is not a standard way to do this.</div></div><div dir="auto"><br></div><div dir="auto">If you’re going for some kind of automation or orchestration of these services, there are a bunch of different places to build this in, depending on the tools you are using.</div><div dir="auto"><br></div><div dir="auto">You did mention ISC DHCP. One approach would be to use the server-side hooks when a lease is created  or renewed. You could add a script that creates what ever additional names you want.</div><div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Sep 29, 2019 at 10:22 AM John Robson via bind-users <<a href="mailto:bind-users@lists.isc.org" target="_blank">bind-users@lists.isc.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><span><div class="gmail_quote">Hi all,<br><br>I've set up both ISC dhcpd and ISC bind to provide relevant services to a virtualised test lab.  In the test lab obviously boxes will be brought up and down fairly frequently, and I'm aiming to minimise the amount of effort that this takes our users.<br><br>So - the machines get an IP address and dhcpd updates bind, so a specific internal domain gets updated - let's use <a href="http://example.org" target="_blank">example.org</a>here for ease of reading.<br><br>That all works (after a little fight with permissions).<br>I set up a machine with a hostname of 'foo' and there is an automagic DNS entry `<a href="http://foo.example.org" target="_blank">foo.example.org</a>`.<br><br>BUT - what I'd like to do is have `*.<a href="http://foo.example.org" target="_blank">foo.example.org</a>` (or even a specific listing of subdomains) point to that IP as well - to enable the various vhost based services on the test machines to be accessed without having to mess with local hosts files or further mess with DNS each time.<br><br>e.g. <a href="http://test.foo.example.org" target="_blank">test.foo.example.org</a> should point to the same IP as <a href="http://foo.example.org" target="_blank">foo.example.org</a> (heck, could even be a cname)</div></span><div class="gmail_quote"><span><br>Is there some simple configuration I am missing - or is this not possible?<br>Is there a better way to get to where I want to be*?<br><br>Cheers,<br><br>John</span></div></div></div></blockquote></div></div></blockquote></div></blockquote></div></div></div></div></div></div>