I like dnsmasq’s automatic *.lan automatic hostnames and I wanted to continue using them, but I didn’t want to get rid of the knot resolver. dnsmasq automatically generates the hostnames based off the dhcp request hostname as well as any static hosts you’ve defined.
I set dnsmasq’s DNS port to 54 in LuCI’s Network > DHCP and DNS > Advanced Settings > DNS Server Port
I created the file /etc/kresd/custom.conf:
local lan_rule = policy.add(policy.suffix(policy.FORWARD('127.0.0.1@54'), policy.todnames({'lan','168.192.in-addr.arpa'})))
policy.del(lan_rule.id)
table.insert(policy.rules, 1, lan_rule)
I’m forwarding all of 192.168.0.0/16 reverse dns to dnsmasq, if you need 10.0.0.0/8 instead use “10.in-addr.arpa” instead of “168.192.in-addr.arpa”
This forwards *.lan and the reverse DNS queries for your local subnet to port 54, which is handled by dnsmasq
I then changed /etc/config/resolver:
config resolver 'kresd'
option rundir '/tmp/kresd'
option log_stderr '0'
option log_stdout '0'
option forks '1'
option include_config '/etc/kresd/custom.conf'
The other lines should already be there, just add the include_config line at the end of the kresd section.
End result:
$ host turris.lan
turris.lan has address 192.168.1.1
$ host beaglebone.lan
beaglebone.lan has address 192.168.1.16
$ host 192.168.1.1
1.1.168.192.in-addr.arpa domain name pointer turris.lan
Edit: update for the custom kresd config, credit to @eman