Unbound - supply reverse map zone file for private home lan

Didn't found way how to supply reverse map zone file for private home lan 192.168.2.0/24. Local zone definition worked as expected. When tried to put local-zone: "2.168.192.in-addr.arpa." nodefault or local-zone: "2.168.192.in-addr.arpa." transparent with zonefile definition zonefile: "192.168.2.conf" into /etc/unbound/unbound_srv.conf it was not working. Even unbound didn' started by such entries. unbound-checkconf /var/lib/unbound/unbound.conf reports in such case error on line local-zone: "2.168.192.in-addr.arpa." transparent in /var/lib/unbound/unbound_srv.conf. Any idea how to fix this?

~# cat /etc/unbound/unbound_srv.conf
module-config: "respip validator iterator"
auth-zone:
name: "homelab.lan"
for-downstream: yes
for-upstream: no
zonemd-check: no
zonemd-reject-absence: no
zonefile: "homelab.lan.conf"
# next doesn't work
#    local-zone: "2.168.192.in-addr.arpa."    transparent
#    zonefile: "192.168.2.conf"


~# cat /etc/unbound/homelab.lan.conf
$ORIGIN homelab.lan.
$TTL    3600
@   IN  SOA server01.homelab.lan. admin.homelab.lan. (
        1710435698      ; Serial
        86400           ; Refresh
        3600            ; Retry
        3600000         ; Expire
        300 )           ; Negative Cache TTL
; name server RR for the domain
@       IN  NS  server01.homelab.lan.
; mail server RRs for the zone (domain)
@       IN  MX 10    homelab.lan.
@       IN  A   192.168.2.1
infosrv           IN  TXT "contact@homelab.lan"
server01   IN A     192.168.2.1
server01   IN AAAA  fd00::1
gw     IN CNAME         server01


~# cat /etc/unbound/192.168.2.conf
$TTL 2d  ; 172800 seconds
$ORIGIN 2.168.192.IN-ADDR.ARPA.
@     IN      SOA   server01.homelab.lan. hostmaster.homelab.lan. (
                                        2026110200 ; serial number
                                        3h         ; refresh
                                        15m        ; update retry
                                        3w         ; expiry
                                        3h         ; nx = nxdomain ttl
                                        )
; only one NS is required for this local file
; and is an out of zone name
@      IN      NS      server01.homelab.lan.
1     IN      PTR     server01.homelab.lan.

changes in /etc/config/unbound:
+       option add_local_fqdn '0'
+       option domain 'homelab.lan'
+       option domain_type 'transparent'
+       option listen_port '5353'
+       option query_minimize '1'
+       option ttl_min '0'

You can just let the special code for odhcpd populate the reverse map. It helps to set your lease expire time to something short (like half an hour) in order to refresh the mapping more often. The one downside is that mapping only gets populated at lease generation time so there is a 0-30 minute window after a reboot or unbound restart where no mapping exists. You will need to be running odhcpd-full so it runs on both the ipv4 and ipv6 side of things.

If you have static leases you can insert local-data and local-data-ptr . It should work with this uci config.

config unbound 'ub_main'
	option add_extra_dns '0'
	option add_local_fqdn '2'
	option add_wan_fqdn '2'
	option dhcp_link 'odhcpd'
	option dns64 '0'
	option domain 'example.com'
	option domain_type 'static'
	option edns_size '1232'
	option extended_stats '0'
	option hide_binddata '1'
	option interface_auto '1'
	option listen_port '53'
	option localservice '1'
	option manual_conf '0'
	option num_threads '4'
	option protocol 'default'
	option rate_limit '0'
	option rebind_localhost '1'
	option rebind_protection '1'
	option recursion 'default'
	option resource 'default'
	option root_age '9'
	option ttl_min '120'
	option ttl_neg_max '1000'
	option unbound_control '1'
	option validator '0'
	option verbosity '1'
	list iface_wan 'wan'
	option enabled '1'
	list iface_trig 'lan'
	list iface_trig 'wan'
	option exclude_ipv6_ga '1'

config zone 'auth_icann'
	option enabled '0'
	option fallback '1'
	option url_dir 'https://www.internic.net/domain/'
	option zone_type 'auth_zone'
	list server 'lax.xfr.dns.icann.org'
	list server 'iad.xfr.dns.icann.org'
	list zone_name '.'
	list zone_name 'arpa.'
	list zone_name 'in-addr.arpa.'
	list zone_name 'ip6.arpa.'

config zone 'fwd_isp'
	option enabled '0'
	option fallback '1'
	option resolv_conf '1'
	option zone_type 'forward_zone'
	list zone_name 'isp-bill.example.com.'
	list zone_name 'isp-mail.example.net.'

config zone 'fwd_google'
	option enabled '0'
	option fallback '1'
	option tls_index 'dns.google'
	option tls_upstream '1'
	option zone_type 'forward_zone'
	list server '8.8.4.4'
	list server '8.8.8.8'
	list server '2001:4860:4860::8844'
	list server '2001:4860:4860::8888'
	list zone_name '.'

config zone 'fwd_cloudflare'
	option enabled '0'
	option fallback '1'
	option tls_index 'cloudflare-dns.com'
	option tls_upstream '1'
	option zone_type 'forward_zone'
	list server '1.1.1.1'
	list server '1.0.0.1'
	list server '2606:4700:4700::1111'
	list server '2606:4700:4700::1001'
	list zone_name '.'

With local-zone, local-data, local-data-ptr values in /etc/unbound/unbound_srv.conf I was able to define relationships. But wanted to use syntax/files for ptr from bind. Is it possible? As wrote zone file for domain was recognized.

I've always just processed zone file via perl or sed to put them into the right form for unbound.

So I can forget bind config ptr zone file? I've generated unbound config file with the same tools:-)

I just used the forward bind zone files for generating both the forward and reverse pointers in unbound format.