I have a pi-hole (DNS and DHCP) on 192.168.1.1
I have a local device (hostname=server) with a static IP 192.168.1.10
I told pi-hole about server in the local DNS tab that it's IP is 192.168.1.10
I have a public registered wildcard domain *.example.com that resolves to 23.45.67.89
Expected Behaviour:
dig server.local.example.com @192.168.1.1 returns the local IP 192.168.1.10
This is already the case with devices that got their IP from pi-holes DHCP
Actual Behaviour:
dig server.local.example.com @192.168.1.1 returns the public wildcard-resolved IP for domain *.example.com : 23.45.67.89
*** [ DIAGNOSING ]: Discovering active DHCP servers (takes 10 seconds)
Scanning all your interfaces for DHCP servers
* Received 338 bytes from eth0:192.168.2.10
Server IP address: 192.168.2.10
DHCP options:
Message type: DHCPOFFER (2)
dns-server: 192.168.2.10
router: 192.168.2.1
I have a pi-hole (DNS and DHCP) on 192.168.2.10
I have a local device (hostname= raspi01 ) with a static IP 192.168.2.15
I told pi-hole about raspi01 in the local DNS tab that it's IP is 192.168.2.15
I have a public registered wildcard domain *.berchtold.live that resolves to 23.45.67.89
Expected Behaviour:
dig raspi01.local.berchtold.live @192.168.2.10 returns the local IP 192.168.2.15
This is already the case with devices that got their IP from pi-holes DHCP
Actual Behaviour:
dig raspi01.local.berchtold.live @192.168.2.10 returns the public wildcard-resolved IP for domain * .berchtold.live : 23.45.67.89
Each of raspi01 and raspi01.local.berchtold.live is a separate domain.
Unless .local.berchtold.live is your local search domain, DNS clients would have no way to arrive at the second when trying to resolve the first.
Your container running Pi-hole doesn't seem to be aware of this, but since you are using Pi-hole as DHCP server, I see you've correctly configured that as the local domain - but your configuration is currently missing an expand-hosts option.