Pi-hole v6: Setting up wildcard domains


In my previous article, I talked about my password and login troubles on Pi-hole V6, it seems that this isn’t the end of my journey, as I’ve ran into new ones while trying to set up wildcard domains on Pi-hole v6.

TLDR version: Dnsmasq config files no loads by default on Pi-hole v6. Enable it via All Settings > Miscellaneous > misc.etcdnsmasq_d. If it’s just a few lines, you can add it to > misc.dnsmasq_line instead on the same page.



Creating a dnsmasq config file for wildcard domains

Pi-hole doesn’t have a way to setup wildcard domains via it’s web dashboard. This can only be done manually by adding a dnsmasq configuration file under /etc/dnsmasq.d.

You first a create a config file, e.g. /etc/dnsmasq.d/99-myserver.com.conf (where the 99 is just the order of priority if you are managing multiple configuration files), and inside that config file, just put in:

server=/myserver.com/#
address=/.myserver.com/100.101.102.103
Enter fullscreen mode

Exit fullscreen mode

The first line server=/myserver.com/# prevents Pi-hole from trying to resolve myserver.com using an upstream DNS.

The second line address=/.myserver.com/100.101.102.103 tells Pi-hole that the domain myserver.com + any subdomain *.myserver.com should be pointed to `100.101.102.103.



Pi-hole v6 doesn’t load dnsmasq config file by default

This is the part that tripped me up. In v6, dnsmasq config files are no longer loaded by default. You will need to enable it via All Settings > Miscellaneous > misc.etcdnsmasq_d.

Once enabled, you should be able to get Pi-hole to resolve the hostname to correct IP address. You can test it using dig by telling it to query the hostname via your Pi-hole’s IP address, the IP 192.168.1.123 is used in the example below.

`> dig foobar.myserver.com @192.168.1.123 +nocomments

; <<>> DiG 9.10.6 <<>> sr80.ysr.app @192.168.100.80 +nocomments
;; global options: +cmd
;foobar.myserver.com. IN A
foobar.myserver.com. 0 IN A 100.101.102.103
;; Query time: 4 msec
;; SERVER: 192.168.1.123#53(192.168.1.123)
;; WHEN: Fri Sep 12 21:00:54 +02 2025
;; MSG SIZE rcvd: 57`



Just a few lines? Skip creating the config file.

It appears that on the same settings page there is also another field misc.dnsmasq_lines. If you have just a few config lines, just enter it in there saves you the trouble of having jump into the terminal to create the file.


Perfect! With wildcard domains working, I can now skip having to manually assign each subdomain for each of the web services I intend to run on my Unraid server.



Source link

Leave a Reply

Your email address will not be published. Required fields are marked *