I have added the CNAME record pihole.mydomain.net
pointing to pi.hole
to receive a localized IP response based on the interface origin.
The record is correctly resolved by tools making basic DNS requests like ping
:
$ ping pihole.mydomain.net
PING pi.hole (127.0.0.1) 56(84) bytes of data.
64 bytes from localhost (127.0.0.1): icmp_seq=1 ttl=64 time=0.026 ms
Tools requesting advanced DNS information like dig
receive 0.0.0.0
, no matter the origin interface:
$ dig pihole.mydomain.net @127.0.0.1
; <<>> DiG 9.20.9-1-Debian <<>> pihole.mydomain.net
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 48616
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
;; QUESTION SECTION:
;pihole.mydomain.net. IN A
;; ANSWER SECTION:
pihole.mydomain.net. 0 IN CNAME pi.hole.
pi.hole. 0 IN A 0.0.0.0
;; Query time: 0 msec
;; SERVER: 127.0.0.1#53(127.0.0.1) (UDP)
;; WHEN: Sun Jul 20 21:40:29 CEST 2025
;; MSG SIZE rcvd: 85
$ dig pihole.mydomain.net @172.30.0.1
; <<>> DiG 9.20.9-1-Debian <<>> pihole.mydomain.net @172.30.0.1
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 65359
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
;; QUESTION SECTION:
;pihole.mydomain.net. IN A
;; ANSWER SECTION:
pihole.mydomain.net. 0 IN CNAME pi.hole.
pi.hole. 0 IN A 0.0.0.0
;; Query time: 0 msec
;; SERVER: 172.30.0.1#53(172.30.0.1) (UDP)
;; WHEN: Sun Jul 20 21:40:37 CEST 2025
;; MSG SIZE rcvd: 85
$ dig pihole.mydomain.net @192.168.178.158
; <<>> DiG 9.20.9-1-Debian <<>> pihole.mydomain.net @192.168.178.158
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 44482
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
;; QUESTION SECTION:
;pihole.mydomain.net. IN A
;; ANSWER SECTION:
pihole.mydomain.net. 0 IN CNAME pi.hole.
pi.hole. 0 IN A 0.0.0.0
;; Query time: 4 msec
;; SERVER: 192.168.178.158#53(192.168.178.158) (UDP)
;; WHEN: Sun Jul 20 21:40:48 CEST 2025
;; MSG SIZE rcvd: 85
Requesting pi.hole
normally works as expected:
$ dig pi.hole @127.0.0.1
; <<>> DiG 9.20.9-1-Debian <<>> pi.hole
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 11674
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
; EDE: 29: (synthesized)
;; QUESTION SECTION:
;pi.hole. IN A
;; ANSWER SECTION:
pi.hole. 0 IN A 127.0.0.1
;; Query time: 0 msec
;; SERVER: 127.0.0.1#53(127.0.0.1) (UDP)
;; WHEN: Sun Jul 20 21:42:08 CEST 2025
;; MSG SIZE rcvd: 69
$ dig pi.hole @172.30.0.1
; <<>> DiG 9.20.9-1-Debian <<>> pi.hole @172.30.0.1
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 54116
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
; EDE: 29: (synthesized)
;; QUESTION SECTION:
;pi.hole. IN A
;; ANSWER SECTION:
pi.hole. 0 IN A 172.30.0.1
;; Query time: 0 msec
;; SERVER: 172.30.0.1#53(172.30.0.1) (UDP)
;; WHEN: Sun Jul 20 21:42:14 CEST 2025
;; MSG SIZE rcvd: 69
$ dig pi.hole @192.168.178.158
; <<>> DiG 9.20.9-1-Debian <<>> pi.hole @192.168.178.158
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 50076
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
; EDE: 29: (synthesized)
;; QUESTION SECTION:
;pi.hole. IN A
;; ANSWER SECTION:
pi.hole. 0 IN A 192.168.178.158
;; Query time: 0 msec
;; SERVER: 192.168.178.158#53(192.168.178.158) (UDP)
;; WHEN: Sun Jul 20 21:42:20 CEST 2025
;; MSG SIZE rcvd: 69
My guess is that the 0.0.0.0
in host-record=pi.hole,0.0.0.0
in CNAME responses(the actual CNAME request, not an A request that happens to be a CNAME) is wrongly interpreted as actual 0.0.0.0
and not as the IP of the machine running dnsmasq/pihole-FTL
.
Im not sure if this is an issue or not, I am ready to be corrected by people understanding CNAME records and dnsmasq logic better than me.