I have setup pi-hole on a local linux server using docker-compose, the server uses the local IP 192.168.x.123. Here's my docker-compose.yml:
version: "3"
services:
pihole:
container_name: pihole
image: pihole/pihole:latest
ports:
- "53:53/tcp"
- "53:53/udp"
- "81:80/tcp"
environment:
TZ: 'Europe/Berlin'
WEBPASSWORD: 'mystrongwebpassword'
volumes:
- './etc-pihole:/etc/pihole'
- './etc-dnsmasq.d:/etc/dnsmasq.d'
restart: unless-stopped
Before running the container, I had to change the /etc/systemd/resolved.conf on my server by substituting #DNSStubListener=yes with DNSStubListener=no, else port 53 would have been blocked at the start.
Then, I configured my Speedport router to use my local server IP as DNS resolver:
Everything seems to work quite well, as far as the output on the pi-hole admin overview shows:
Then, I tried to setup local DNS addresses on pi-hole to be able to access certain machines locally using domains, let's say home.local pointing to my server address on 192.168.x.123:
However, neither my android phone connected to my WiFi nor the Ubuntu PC I'm writing this text from is able to resolve those addresses.
I tried changing my Ubuntu computer's resolv.conf so it directly uses my server's DNS:
resolv.conf on Ubtuntu computer
# ...
nameserver 192.168.x.123 # before: 127.0.0.53
options # ...
search my.router # my router's local FQDN
# ...
After doing that, I am able to connect to home.local on the Ubuntu PC, however I'm unable to resolve the real LAN hostnames. Let's say my server's hostname is johndoe and before changing the nameserver in resolv.conf I was perfectly able to connect to my server via http://johndoe/ but changing the nameserver makes it unaccessible.
Is there something I have to take care of when configuring pi-hole so the local DNS resolving works "out of the box", so that every device is automatically able to resolve the local DNS entries?
Here's what my /etc/pihole/custom.list looks like:
192.168.x.xxx senec.local
192.168.x.123 home.local
Thanks a lot in advance.
EDIT: I "dag into it" a bit:
$ dig home.local
; <<>> DiG 9.18.1-1ubuntu1.3-Ubuntu <<>> home.local
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 52863
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 65494
;; QUESTION SECTION:
;home.local. IN A
;; Query time: 0 msec
;; SERVER: 127.0.0.53#53(127.0.0.53) (UDP)
;; WHEN: Thu Feb 23 10:17:53 CET 2023
;; MSG SIZE rcvd: 37
$ dig @192.168.x.123 home.local
; <<>> DiG 9.18.1-1ubuntu1.3-Ubuntu <<>> @192.168.x.123 home.local
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 60551
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;home.local. IN A
;; ANSWER SECTION:
home.local. 0 IN A 192.168.x.123
;; Query time: 0 msec
;; SERVER: 192.168.x.123#53(192.168.x.123) (UDP)
;; WHEN: Thu Feb 23 10:18:34 CET 2023
;; MSG SIZE rcvd: 53
So apparently when manually setting the DIG resolver in dig the resolving of the local DNS entries set in pi-hole works. Still this is not the behavior I want since I expect my configuration to work without settings DNS resolvers manually in every device I use.


