# Unbound - Conditional forward

**URL:** <https://forum.openwrt.org/t/unbound-conditional-forward/118269>\
**Category:** Network and Wireless Configuration\
**Created:** [January 24, 2022, 11:57am UTC](https://forum.openwrt.org/t/unbound-conditional-forward/118269 "2022-01-24T11:57:21Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![PatrikSamuelTauchim](https://forum.openwrt.org/user_avatar/forum.openwrt.org/patriksamueltauchim/32/48067_2.png) [@PatrikSamuelTauchim](https://forum.openwrt.org/u/PatrikSamuelTauchim)\
**Post date:** [January 24, 2022, 11:57am UTC](https://forum.openwrt.org/t/unbound-conditional-forward/118269/1 "2022-01-24T11:57:21Z")

</div>

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

- 10.10.0.1 = [a.example.com](http://a.example.com)
- 10.20.0.1 = [b.example.com](http://b.example.com)
- 10.30.0.1 = [c.example.com](http://c.example.com)

What I want to do is to forward all queries for \*.a.example.com to 10.10.0.1 so **[client.b.example.com](http://client.b.example.com)** can reach **[client.a.example.com](http://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](http://a.example.com).’)}))  
> policy.add(policy.suffix(policy.FORWARD(‘10.30.0.1’), {todname(‘[c.example.com](http://c.example.com).’)}))

Thanks in advance

---

<div class="post-metadata">

**Author:** ![trendy](https://forum.openwrt.org/user_avatar/forum.openwrt.org/trendy/32/8800_2.png) [@trendy](https://forum.openwrt.org/u/trendy)\
**Post date:** [January 24, 2022, 2:36pm UTC](https://forum.openwrt.org/t/unbound-conditional-forward/118269/2 "2022-01-24T14:36:26Z")

</div>

I am not using unbound, but you could try with either [uci](https://github.com/openwrt/packages/blob/master/net/unbound/files/README.md#config-zone) or [manually](https://github.com/openwrt/packages/blob/master/net/unbound/files/README.md#how-to-manual-override) edit the configuration.

---

<div class="post-metadata">

**Author:** ![EricLuehrsen](https://forum.openwrt.org/letter_avatar/ericluehrsen/32/6_449c533f586939b6e5f246632a46421f.png) [@EricLuehrsen](https://forum.openwrt.org/u/EricLuehrsen)\
**Post date:** [March 13, 2022, 4:47am UTC](https://forum.openwrt.org/t/unbound-conditional-forward/118269/3 "2022-03-13T04:47:33Z")

</div>

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

```nohighlight
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.'

```
