OPNsense Forum

English Forums => Tutorials and FAQs => Topic started by: baqwas on April 29, 2025, 01:59:42 PM

Title: Unbound DNS Guidance
Post by: baqwas on April 29, 2025, 01:59:42 PM
Hello!

I would like to "register" a few virtual hosts. I need some guidance, please.

I'm using DHCP and Unbound under OPNsense. I have a server registered as server1.domain.org under DHCP. How can I leverage Unbound to register site1.server1.domain.org, site2.server1.domain.org, etc.? The virtual hosts may or may not use different port numbers under Apache2 virtual host control.

It is my understanding that if Unbound can resolve server1.domain.org, then I should be able to add the virtual hosts using Unbound (apart from the work needed under Apache2). Any advice would be appreciated. Thanks.

Regards.

P.S.
I was using another FOSS product to perform (DHCP, DNSmasq derivative & this specific configuration) but I need to rely solely on OPNsense now. DNSmasq is disabled in my OPNsense instance and I would prefer to limit myself to Unbound.
Title: Re: Unbound DNS Guidance
Post by: meyergru on April 29, 2025, 02:14:24 PM
For that, using a single DHCP mapping will give you only one DNS name with the corresponding IP.

With Unbound overrides, you can have one DNS->IP mapping with explicit aliases, where you could register the other names for your name-based virtual hsting.

There is also the option to use a name like *.server1.domain.org if you want all the names point to one IP.
Title: Re: Unbound DNS Guidance
Post by: baqwas on May 02, 2025, 04:48:42 AM
@meyergru:

Could you please clarify just a little bit more (for a newbie)? Under Unbound DNS, how do I navigate to the page where I can enter the data in the wildcard format that you have illustrated? I stepped through General, Overrides, Advanced, Access Lists and Query Forwarding but could not understand which of these pages could help me enter the wildcard formatted string, *.server1.domain.org, that you provided as an example. In my situation, server1.domain.org is being resolved by Unbound DNS locally. I feel that your example would serve my purpose much better than what I had used previously (one record for each virtual host). Thanks.

Regards.
Title: Re: Unbound DNS Guidance
Post by: meyergru on May 02, 2025, 08:31:13 AM
You can do that whereever you want, in the override itself or in one of its aliases. Shall I cite Nike? "Just do it"

Title: Re: Unbound DNS Guidance
Post by: Vilhonator on May 05, 2025, 01:28:55 PM
You can access override rules of Unbound in Services ---> Unbound ---> Overrides

In the overrides window, select + icon under "hosts" which is at the top above aliases

Title: Re: Unbound DNS Guidance
Post by: baqwas on May 11, 2025, 10:47:48 PM
Thanks, @meyergru & @Vilhonator, for your patience & understanding. Your solution did the job for me.

Regards.