Unbound - Conditional forward

Hi,
I need help with setting up conditional DNS forwarding on Unbound.

I have 3 networks connected via WireGuard tunel, with static routes between them. Clients are able to reach each other via IP, but I would also like to get DNS working, so they are reachable via domain names.

Network looks like this:
Router & DNS - Local Domain

What I want to do is to forward all queries for *.a.example.com to 10.10.0.1 so client.b.example.com can reach client.a.example.com

Routed "b" runs Knot Resolver and configuration was just single line in the config file (below). I guess for Unbound it should be similar, but no idea what that should look like.

policy.add(policy.suffix(policy.FORWARD(‘10.10.0.1’), {todname(‘a.example.com.’)}))
policy.add(policy.suffix(policy.FORWARD(‘10.30.0.1’), {todname(‘c.example.com.’)}))

Thanks in advance

I am not using unbound, but you could try with either uci or manually edit the configuration.

uci allows you set up forward zones easily. https://github.com/EricLuehrsen/openwrt-packages/tree/master/net/unbound/files#readme

config zone 'example_a'
	option enabled '1'
	option fallback '0'
	option zone_type 'forward_zone'
	list server '10.10.0.1'
	list zone_name 'a.example.com.'
2 Likes