1
General Discussion / DNS hostnames from DHCP
« on: November 07, 2019, 04:52:31 am »
This is apparently not a new topic as I found some of others here and on the "other" sites which seemed to go nowhere. I have a bunch of IOT devices and many of them have a hard-coded hostname - like something-last 6 of the mac. It's ugly. All of my Sonos Ones are named SonosZP. Sonos appears to not allow name changes either.
So all I want to do is set up DHCP to match on a MAC and publish the hostname I define into DNS. The GUI for Unbound (which I'm using) and Dnsmasq both have options for "Register DHCP leases" and "Register DHCP static Mappings". And in DHCP, if you add a static mapping, beneath the IP address field it reads "If no IPv4 address is given, one will be dynamically allocated from the pool". Great!
So I take that to mean if I create a static mapping in DHCP only adding in the MAC and hostname, so long as I have the DNS boxes checked I should be able to resolve my "custom" hostnames.
But I can't. I screwed around for a while with the unbound.conf file and noticed when unchecking the "Register DHCP leases" box the directive "include: /var/unbound/dhcpleases.conf" is removed. But toggling the "Register DHCP static mappings" box neither writes nor removed a directive from unbound.conf. Perhaps it writes something elsewhere.
I can't see a way to accomplish this without creating a bunch of manual mappings with IP's, which nearly destroys the utility of DHCP. Any solutions out there? I've also tried Dmsmasq and DNSCrypt in all combinations but no dice. FWIW, the "register dhcp leases" checkbox does register the garbage hostnames and they are reachable, so I got that going for me, I guess.
I also noted in the "other" sites there is a "dhcpleases_entries.conf" that OPN doesn't seem to reference. Or maybe I didn't find it. IDK at this point... I'm getting sleepy....
Thanks
So all I want to do is set up DHCP to match on a MAC and publish the hostname I define into DNS. The GUI for Unbound (which I'm using) and Dnsmasq both have options for "Register DHCP leases" and "Register DHCP static Mappings". And in DHCP, if you add a static mapping, beneath the IP address field it reads "If no IPv4 address is given, one will be dynamically allocated from the pool". Great!
So I take that to mean if I create a static mapping in DHCP only adding in the MAC and hostname, so long as I have the DNS boxes checked I should be able to resolve my "custom" hostnames.
But I can't. I screwed around for a while with the unbound.conf file and noticed when unchecking the "Register DHCP leases" box the directive "include: /var/unbound/dhcpleases.conf" is removed. But toggling the "Register DHCP static mappings" box neither writes nor removed a directive from unbound.conf. Perhaps it writes something elsewhere.
I can't see a way to accomplish this without creating a bunch of manual mappings with IP's, which nearly destroys the utility of DHCP. Any solutions out there? I've also tried Dmsmasq and DNSCrypt in all combinations but no dice. FWIW, the "register dhcp leases" checkbox does register the garbage hostnames and they are reachable, so I got that going for me, I guess.
I also noted in the "other" sites there is a "dhcpleases_entries.conf" that OPN doesn't seem to reference. Or maybe I didn't find it. IDK at this point... I'm getting sleepy....
Thanks