This configuration is doable at the dnsmasq level, which Pi-hole utilizes as its internal DNS.
Enable Custom Configuration
Ensure your Pi-hole environment is permitted to process custom configuration files in the web panel.Set Environment Variables
Set theFTLCONF_misc_etc_dnsmasq_denvironment variable totrue.
For a Docker Compose setup, simply add:
environment:
...
FTLCONF_misc_etc_dnsmasq_d: true
- Configure volumes
Map your custom configuration into/etc/dnsmasq.d. Using a named volume is the recommended approach:
volumes:
...
- 'pihole_etc_dnsmasqd:/etc/dnsmasq.d'
You can also use a bind mount to map a specific host directory instead of a named volume.
Create the
wildcard.conffile
Inside the mapped directory, create a file named wildcard.conf and use the following syntax:address=/.domain.local/xxx.xxx.xxx.xxxExample:
address=/.homelab.local/192.168.1.5Restart the container
Verify the resolution using
dig:dig +short subdomain.domain.local @server_ipExample:
dig +short test.homelab.local @192.168.1.1