CZ-NIC / knot-resolver

Knot Resolver - resolve DNS names like it's 2024
https://www.knot-resolver.cz/
Other
364 stars 59 forks source link

Transparent local DNS entries #118

Closed JosefRypacek closed 1 month ago

JosefRypacek commented 1 month ago

Hi,

I've reinstalled Turris router which is using kresd instead of unbound for DNS resolving now. I need to add some local entries which I was able to do using hostname_config and hosts file.

I'm using my own domain (example.net) which has entries in public DNS (ip.location1.example.net and ip.location2.example.net). I would like to setup local DNS for example.net, locationX.example.net and service.locationX.example.net for each location using knot-resolver.

When I define following line in hosts everyting works fine and clients are still able to resolve ip.locationX.example.net from public DNS.

10.10.10.10 location1.example.net service.location1.example.net service.example.net

But when I define following line in hosts, all public DNS entries can't be resolved anymore. I would like to use this TLD as local DNS entry as well.

10.10.10.10 example.net

In past I used following configuration for unbound and it worked, very likely because of transparent mode.

server:
local-zone: "example.net." transparent
local-data: "example.net. IN A 10.10.10.10"
local-data: "locationX.example.net. IN A 10.10.10.10"

Is there any way how to setup this in kresd too? This part is IMHO undocumented.

vcunat commented 1 month ago

The default in Knot Resolver is close to Unbound's "transparent", as there aren't any zones really. However, by default, setting address(es) for a name clears all other records on that name.

If you do that at the top of a signed zone, it really will get broken. Perhaps we should tweak that default somehow.

Anyway, you can put this into your resolver configuration to disable that default:

hints.use_nodata(false)

If you don't have that on your Turris yet, here's how: https://wiki.turris.cz/en/public/dns_knot_misc#adding_your_own_custom_configuration_file_to_knot

JosefRypacek commented 1 month ago

Thank you, it works just like expected! I didn't get the meaning of use_nodata from the documentation before.