DEV Community

Yoshi Nakamoto for Yoshi's Homelab

Posted on

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 longer loads by default on Pi-hole v6. You will need to enable it manually via All Settings > Miscellaneous > misc.etcdnsmasq_d. If you just need to insert a few lines, skip creating the config file and 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 abc.myserver.com @192.168.1.123 +nocomments

; <<>> DiG 9.10.6 <<>> abc.myserver.com @192.168.1.123 +nocomments
;; global options: +cmd
;abc.myserver.com.          IN  A
abc.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 +08 2025
;; MSG SIZE  rcvd: 57
Enter fullscreen mode Exit fullscreen mode

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.

Top comments (0)