redirect with exceptions

Yorgos Thessalonikefs yorgos at nlnetlabs.nl
Mon Dec 2 13:45:43 UTC 2024


Hi Bartosz,

Local zone selection relies on the most specific match of the domain 
names. So you can have exceptions in your basic rule for a certain zone.

That is you can have a redirect zone for 'foo.com' and another redirect 
zone for 'a.foo.com' like:

	local-zone: "foo.com." redirect
	local-data: "foo.com. A 10.10.10.10"
	local-zone: "a.foo.com." redirect
	local-data: "a.foo.com. A 10.10.10.11"

Every A query for 'a.foo.com' and anything under 'a.foo.com' will get 
the 11 address.

Every A query for 'foo.com' and anything under 'foo.com' (that is not 
part of 'a.foo.com') will get the 10 address.

Best regards,
-- Yorgos

On 29/11/2024 16:46, Bartosz Fenski via Unbound-users wrote:
> Hello,
> 
> I'm trying to create rather simple (at least I thought so initially) 
> solution.
> 
> Want to intercept some of the DNS queries in my homelab and return fake 
> entries for them.
> 
> So basically I want to return let's say 10.10.10.10 for every subdomain 
> of foo.com but for some hostnames/subdomains I'd like to return 
> different IP, let's say 10.10.10.11.
> 
> So:
> 
> *.foo.com -> 10.10.10.10
> 
> a.foo.com -> 10.10.10.11
> 
> I started experimenting with redirect but seems it doesn't allow to set 
> any exceptions. Is all or nothing.
> 
> Is there a way to configure unbound the way I want?
> 
> Thanks for any hints.
> 
> regards
> Bartosz Fenski
> 



More information about the Unbound-users mailing list