I have Pi-Hole setup along with Unbound, with Wireguard as the VPN solution. They are all on separate docker containers, on the same Raspberry Pi. I added the correct address and port of the Unbound docker container to Pi-Hole, with no other DNS servers selected. However, when I go to websites like dnsleaktest.com, they report my DNS Servers to be ones from Cloudflare, instead of my own public IP address. I tested this on my Android phone on LTE data, connected to the Wireguard VPN. As a test, while staying on data on my phone, disconnecting the VPN showed the AT&T DNS server as expected, connecting to the VPN immediately switches back to Cloudflare.
In Pi-Hole, all the queries are sent to and answered by the Unbound docker container, as confirmed by the Pi-Hole logs. I am not seeing any query in Pi-Hole going outside my network for resolution, so I am stumped as to what the cause of this is. The best guess that I could come up with is that somehow Unbound got configured in forwarding mode instead of a recursive resolver. I am not an expert on networking or Unbound, so I am looking for anyone who has an idea as to how to solve this. If it helps, I used GitHub - MatthewVance/unbound-docker-rpi: Run Unbound with latest version of OpenSSL on Raspberry Pi with Docker. as the docker image to set up unbound.
I was able to fix this issue. As I suspected, the unbound docker image I was using was setup in forwarder mode, meaning that the DNS server was forwarding the queries to Cloudflare. I commented out the include for the forward-mode file in unbound.conf and restarted the unbound container, and now the dnsleakstest (and other tools) only show my public IP as the DNS server.
Hard to say without seeing your config, but the short of it is that somewhere on your network you have Cloudflare set as the DNS resolver. Check all your clients, switches, vlans, router, etc., for hard-coded DNS.
Thanks so much man! its 2 am and I can finally sleep lol. BTW I also had to comment out all DNS servers in the etc/pihole/dns-servers.conf in my pihole container.
I did check actually and I don’t see it anywhere. I don’t have switches or VLAN setup, and my phone and router definitely don’t have the Cloudflare DNS. I can provide any config here if that would help diagnose this.