26.7.10, unbound and Kea static lease domains

Started by keeka, November 24, 2026, 06:43:48 PM

Previous topic - Next topic
I just upgraded to 26.7.10 and noticed change of behaviour with unbound resolving some local names (static dhcp hosts under Kea). I restored 26.7.9 as I was not in a position to look in to it further and forgot to check generated contents /var/unbound/host_entries.conf.
Unbound appears not to be picking up Kea subnet domain when it has been set explicitly in a subnet's DHCP domain option. Unbound will only resolve the respective hosts under the default domain.

I wanted to offer a migration but at the same time we didn't know as it was a bit of an assumption.

Its documented here:

https://github.com/opnsense/docs/commit/10c01b996cb0b9ed3e12f5d09bef2b2fd2e22510
Hardware:
DEC740

Many thanks @Monviech. I will make sure to set that option once I've rerun the upgrade.
I have been using a custom unbound snippet in order to prevent additional domains from being resolved upstream:
#/usr/local/etc/unbound.opnsense.d/custom.conf
local-zone: "local.lan" static
Is this still OK?

Nothing about Unbound was changed so I think thats okay.
Hardware:
DEC740

Yet there was a change. I saw that on one machine as well. As it turns out, I had to include the local domain in the subnet definitions of Kea in the "search domains" and also change the machine name domain to make it work.

I did not investigate much, but I found that only the machine name domain got appended to an unqualified DNS entry. In my case, that was a FQDN.
Intel N100, 4* I226-V, 2* 82559, 16 GByte, 500 GByte NVME, Leox LXT-010H-D

1100 down / 450 up, Bufferbloat A+

I have set the desired domain in Kea subnet's DDNS `DNS qualifying suffix` as well as retaining existing DHCP `Domain Name` option. The hosts concerned now resolve as required. Having now read the docs, deriving Unbound's host overrides from DDNS domain suffix rather than the DHCP domain option makes sense.

Regarding Kea, I'm still not quite sure how OPNsense's Kea config varies with `Auto collect option data` enabled vs disabled. AIUI this has no bearing on the subnet's DHCP Domain option. Only on how it sets Gateway, DNS and NTP server options, possibly others.

Auto collect option data sets gateway, dns server etc... from the system configuration. If you disable it, these fields are all manual. It shouldn't really influence anything else.

https://github.com/opnsense/core/blob/f1c1cde32eb1c0fc4cad4863009da5322a5f9cb8/src/opnsense/mvc/app/models/OPNsense/Kea/KeaDhcpv4.php#L62-L64
Hardware:
DEC740

Thanks again @Monviech. It was the 'etc' that prompted my query.

So the Auto option is literally system as gateway, dns and ntp. Whereas DHCP domain, when empty, is set to that of the system regardless.

November 25, 2026, 02:32:14 PM #8 Last Edit: November 25, 2026, 03:02:47 PM by Monviech (Cedrik)
Auto collect option data does not influence the DHCPv4 domain name option.

When the subnet's Domain name field is empty, the system domain is added during configuration generation:

https://github.com/opnsense/core/blob/f1c1cde32eb1c0fc4cad4863009da5322a5f9cb8/src/opnsense/mvc/app/models/OPNsense/Kea/KeaDhcpv4.php#L169-L174

I find that a bit unexpected too; theoretically, the fallback could also depend on Auto collect option data.

https://github.com/opnsense/core/pull/11314
Hardware:
DEC740

I wasn't suggesting it was confusing. Just to establish what it does and appreciate your filling the gaps in my understanding.

Quote from: Monviech (Cedrik) on November 25, 2026, 01:00:28 PMAuto collect option data sets gateway, dns server etc... from the system configuration. If you disable it, these fields are all manual.
Why did you guys choose to implement it like that ?

To me it's a bit of a weird "construction" and luckily something I immediately noticed when moving from ISC to KEA so it never caused me any issues, but I can imagine someone will not notice it while looking for a field to configure those options manually...
In fact I think I can remember a topic/post or two where that was the case :)
Weird guy who likes everything Linux and *BSD on PC/Laptop/Tablet/Mobile and funny little ARM based boards :)

I like how it is constructed, now I understand how it works!

Auto-Configuring the primary DHCP options via a checkbox makes sense. Auto configuring DHCP Domain, if empty, regardless also seems OK.
Setting the unbound static lease records from the Kea DNS suffix (rather than the Domain) gains flexibility. There is then scope for differentiating domain sent to client vs that used in DNS. That also, AIUI, now fits with the Kea PoV.

Talking with you helped me to find that it was still a bit weird and fix it. So thanks :)
Hardware:
DEC740

November 25, 2026, 04:34:34 PM #13 Last Edit: November 25, 2026, 04:41:02 PM by Monviech (Cedrik)
Quote from: nero355 on November 25, 2026, 04:12:03 PM
Quote from: Monviech (Cedrik) on November 25, 2026, 01:00:28 PMAuto collect option data sets gateway, dns server etc... from the system configuration. If you disable it, these fields are all manual.
Why did you guys choose to implement it like that ?

To me it's a bit of a weird "construction" and luckily something I immediately noticed when moving from ISC to KEA so it never caused me any issues, but I can imagine someone will not notice it while looking for a field to configure those options manually...
In fact I think I can remember a topic/post or two where that was the case :)

You can define any DHCP option manually as well (in the DHCP option tab) and they get defined at the latest point in the KEA packet chain that way (supersede, before the packet is sent out). So you can supersede even options that option auto collect would send out, even if these fields are hidden. xD

https://github.com/opnsense/core/blob/a4b837e2a3fca50b3425c5c99bddb0489da64199/src/opnsense/mvc/app/models/OPNsense/Kea/KeaDhcpv4.php#L184-L187

https://reports.kea.isc.org/dev_guide/d5/d27/libdhcp_flex_option.html

"supersede - Specifies the supersede action: it takes a string expression on the query packet. If the expression evaluates to a not empty value, the option with the value is added to the response. If it already exists it is overwritten."

https://docs.opnsense.org/manual/kea.html#dhcp-options


----

I think your point is that the regular fields are not visible while auto collect is enabled, so it may not be obvious where to configure them manually. That's fair. Once you disable auto collect, the fields become visible and you can set them directly.

The custom options I mentioned are another way to override them, but you don't need those for the usual gateway, DNS, and NTP settings.
Hardware:
DEC740

Quote from: Monviech (Cedrik) on November 25, 2026, 04:34:34 PMYou can define any DHCP option manually as well (in the DHCP option tab) and they get defined at the latest point in the KEA packet chain that way (supersede, before the packet is sent out). So you can supersede even options that option auto collect would send out, even if these fields are hidden. xD
OK, but why have it at all while the only thing it does is hide 3 options according to it's description :
QuoteAutomatically update option data for relevant attributes as routers, dns servers and ntp servers when applying settings from the gui.
IMHO someone who chooses to use OPNsense does not need this "automation" and should see all 3 fields at all times :)
Weird guy who likes everything Linux and *BSD on PC/Laptop/Tablet/Mobile and funny little ARM based boards :)