Kresd custom DNS forwarding rule before "Use forwarding" rule

I have added a custom forwarding rule to kresd in /etc/kresd/kresd.custom.conf to forward dns queries for the local domain to dnsmasq, so I can look up computers in the local lan. However I need to use DNS forwarding, but when I activate DNS forwarding, the forwarding rule appears in the config file before the custom forwarding rule from /etc/kresd/kresd.custom.conf, which means that any forwarding rules from /etc/kresd/kresd.custom.conf will just be ignored. I can put the DNS forwarding rule in /etc/kresd/kresd.custom.conf as well, after the other one, but then it will not get dynamically updated from DHCP. I have also tried modifying the init script, but then it gets overwritten with every update. So, how do I add a custom forwarding rule to kresd, before the rule added by the “Use forwarding” checkbox, in a way where it persists with updates.

1 Like

Are you using the new /etc/kresd/custom.conf config? The “table.insert” part should insert the .lan forward before the general forward:

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 don’t have an /etc/kresd/custom.conf, but putting that in /etc/kresd/kresd.custom.conf seems to work.

1 Like