truenas / charts

TrueNAS SCALE Apps Catalogs & Charts
BSD 3-Clause "New" or "Revised" License
308 stars 295 forks source link

Pi-Hole can no longer resolve DNS for other apps, after upgrading to Electric Eel. #2907

Open TimvanDijkNL opened 2 weeks ago

TimvanDijkNL commented 2 weeks ago

As the title suggests, on "Dragonfish" 24.04, other apps & custom apps could use Pi-Hole as DNS server via the host IP. After upgrading to "Electric Eel" 24.10 this is no longer the case, most likely due to the switch to docker.

Is there any way to fix this ?

stavros-k commented 2 weeks ago

I'm not sure, did you try anything to troubleshoot this? Did you check if other apps can reach pihole's dns port?

Any logs?

TimvanDijkNL commented 2 weeks ago

Attempting to resolve from the shell of a random container (jlesage/firefox in this case) works on cloudflare dns and my ISP's router.. but not on the PiHole via the TrueNAS ip. Pinging the IP however works fine.

/tmp # nslookup www.google.com 1.1.1.1
Server:         1.1.1.1
Address:        1.1.1.1:53

Non-authoritative answer:
Name:   www.google.com
Address: 142.251.36.4

Non-authoritative answer:
Name:   www.google.com
Address: 2a00:1450:400e:803::2004

/tmp # nslookup www.google.com 192.168.2.254
Server:         192.168.2.254
Address:        192.168.2.254:53

Non-authoritative answer:
Name:   www.google.com
Address: 142.251.36.36

Non-authoritative answer:
Name:   www.google.com
Address: 2a00:1450:400e:801::2004

/tmp # nslookup www.google.com 192.168.2.1
;; connection timed out; no servers could be reached

/tmp # ping 192.168.2.1
PING 192.168.2.1 (192.168.2.1): 56 data bytes
64 bytes from 192.168.2.1: seq=0 ttl=64 time=0.075 ms
64 bytes from 192.168.2.1: seq=1 ttl=64 time=0.107 ms
^C
--- 192.168.2.1 ping statistics ---
2 packets transmitted, 2 packets received, 0% packet loss
round-trip min/avg/max = 0.075/0.091/0.107 ms
/tmp # 

Resolving the same domain on my windows laptop via the PiHole DNS works fine, however:

Microsoft Windows [Version 10.0.22631.4391]
(c) Microsoft Corporation. All rights reserved.

C:\Users\conta>nslookup
Default Server:  truenas.home
Address:  192.168.2.1

> www.google.com
Server:  truenas.home
Address:  192.168.2.1

Non-authoritative answer:
Name:    www.google.com
Addresses:  2a00:1450:400e:80f::2004
          216.58.214.4

>

I did find this: https://discourse.pi-hole.net/t/solve-dns-resolution-in-other-containers-when-using-docker-pihole/31413 where they suggest changing the listening address to the actual address of the host OS (TrueNAS) but i have not been able to experiment with that as my docker knowledge is too limited.

stavros-k commented 2 weeks ago

Do you have static ip on truenas? If not can you set one?

Seems weird that binding it to specific ip instead of all would fix it. Tho this will be possible probably in 25.04.

TimvanDijkNL commented 2 weeks ago

You mean give the PiHole a unique IP ? Or the TrueNAS server ? The TrueNAS server has a static IP. PiHole is using the default setting which is host network

stavros-k commented 2 weeks ago

I meant truenas yes.

But if you are using host network. You can't use the solution mentioned in the forum you shared. Maybe check that the interface selected in the pihole settings is the correct one

TimvanDijkNL commented 2 weeks ago

Sadly that's not it either.

I think it's a Docker specific thing, because with 24.03 it worked like a charm, but it stopped working when migrating to 24.10

Untitled

stavros-k commented 2 weeks ago

I meant this

image
TimvanDijkNL commented 2 weeks ago

Ah. I was mistaken.. the default is not to use the host network it seems.

stavros-k commented 1 week ago

So did setting the interface fixed the issue?

TimvanDijkNL commented 1 week ago

Unfortunately, no... enabling Host Network for PiHole and setting the server's network card ( eno1 in this case) seems to have no impact what so ever.

Running the client container (firefox in this case) on Host Network does solve the issue. That gives me the impression that it's definitely a routing issue between containers ?

As a side issue... PiHole gives 0.0.0.0 as destination for blocked domains. Running the client container on Host Nework and trying to navigate to a blocked domain will cause the browser to navigate to 0.0.0.0 instead, which means it opens the TrueNAS UI.. this is not a desired outcome.