I am using caddy reverse proxy so there is a DNS record on the internet for portainer.mydomain.com. I try to visit portainer.mydomain.com on a variety of machines (windows 11, raspbian, debian, android). I expect to get 192.168.1.15 when at home and 89.89.89.89 when not at home.
Actual Behaviour:
On many machines I get the expected result. On others, the ones with ip6 enabled, the dns comes back with the remote address and the connection fails.
Solutions that are not ideal
disable ip6 on each device
manually set the ip6 address of the pihole on each machine as the ip6 DNS server (not sure if this is a goer because I don't think the pihole has a fixed ip6 adress and it is on docker anyway which I don't think supports ip6?
I looked at the pihole.toml and could only find these settings which made no difference no difference:
# Should FTL try to resolve IPv6 addresses to hostnames?
resolveIPv6 = false ### CHANGED, default = true
# Should Pi-hole make an attempt to also satisfy IPv6 address requests (be aware that
# IPv6 works a whole lot different than IPv4)
ipv6 = false
Sadly my android phone will create an ipv6 address whether the network is IPv6 or not it appears, and this still causes it to swerve the DNS. So the above is a partial solution only.
This was not a problem in v5 so I imagine I just need to find the magic setting.
And THAT my friends was android being weird. Although I am on DHCP and OpenDNS servers in pihole, when I first connect to the DHCP I get my pihole address but android quietly slips in 8.8.8.8 later!!!!!!!!
The only way I could fix this was to install pihole "bare metal" (into a proxmox lxc) and disable ip6 altogether.
I tried another DHCP server that pushed out two DNS servers but my phone added a 3rd IPv6 one(!) and it still bypassed local addresses for addresses that existed with dns.
This is dhcp.multiDNS, which is also exposed via Pi-hole's UI:
Under Settings | DHCP » Advanced DHCP Settings, you can tick Advertise DNS server multiple times:
Advertise DNS server multiple times to clients. Some devices will add their own proprietary DNS servers to the list of DNS servers, which can cause issues with Pi-hole. This option will advertise the Pi-hole DNS server multiple times to clients, which should prevent this from happening.
Note that for this to work, DHCP clients must acquire their DHCP lease through Pi-hole's DHCP server, which has to be both enabled as well as accessible for broadcasts.
I am now running the pihole on an unprivileged proxmox lxc with IPv6 switched off - but that was not the issue because the bypassing DNS appears in IPv4 as 8.8.8.8 or 8.8.4.4. Currently trying the dhcp-option=6,10.2.3.23,10.2.3.2 with a cloned lxc on the second address (with its DHCP switched off) and restart but I only see one DNS at the moment. The second address is there on my phone but greyed out as 8.8.4.4 and pingtools says DNS2 not provided. I think it takes a while for the 8.8.4.4 to appear.
I am trying to upload the log of that machine to you but getting
[?] Would you like to upload the log? [y/N] y
* Using curl for transmission.
* curl failed, contact Pi-hole support for assistance.
* Error message: curl: (22) The requested URL returned error: 400
Yes, internet is working fine and blocking is working most of the time - BUT it fails eventually and I can't see my externally available (public DNS enabled - Caddy reverse proxied) machines when the 8.8.8.8 takes over.
Clients have an active lease. It is currently set to 1h and I have forgotten it on the phone and reconnected with no problem.
It is no longer a docker container. It is a debian 12 lxc with pihole installed "bare metal" according to curl -sSL https://install.pi-hole.net | bash in the documentation.
No, the phone has already invented a 3rd DNS server and now bypasses pihole for a local IP which is set up as a Local DNS and which is also a different IP on the internet because I reverse proxy.
Maybe I have set it up wrong but it worked flawlessly on v5.
e.g.
myserver - set up in dnasmasq.d/09-mydomain-machines.conf as
address=/myserver.mydomain.net/10.10.10.15
Where 10.10.10.15 is my Caddy reverse proxy
Then in my domain host the external address of my router is set up as an A record:
myserver.mydomain.com on e.g. 48.111.123.12
myserver.mydomain.com works perfectly on my laptop, but on my phone no joy. I never had this problem with v5 but will be testing that hypothesis soon.
I give up. I have reverted to my pihole5 setup in docker on a pi3B from backup. And the phone keeps doing the same thing. Ad blocking is fine.
Whether I do local DNS in the GUI or through dnsmasq rules, eventually the phone sees the internet IP address. I am guessing this is beyond the bounds of pihole and will keep investigating. If I find a permanent solution I will put it here.