g0Idfinger/docker-HTPC

PiHole was working now it is having DNS issues

Closed this issue · 22 comments

I had it up and running for a day or two then on a reboot the pihole container keeps erroring stating that the nameserver in /etc/resolv.conf is 127.0.0.11 which is wrong, I have tried to swap out the environment variables for this:
dns:
- 127.0.0.1
- 1.1.1.1
which is what was advised by the oracles or reddit but it had no luck, I cant work out why this has changed and stopped working.

Also on an unrelated note once I get this working again is there a way to get pihole to work with cloudflared for dnssec I noticed this was commented out in your yml file and was wondering if it is possible to do with treafik etc without defining ipv4 addresses as usually when I do that and restart my containers it says the address is already in use.

Apologies if this is the wrong forum.

In my resolv.conf, I have the actual LAN IP address of my server 'nameserver 192.168.1.10' as an example. can you try changing yours to that and see if that works?

I removed cloudeflared as it doesn't allow me to use to use DNS 1.0.0.2 for secure yet. 1.0.0.2 allows for filtering out known malware sites and is a cloudflare DNS server. It should work if you enable it. If not open it up under a new issue and I will resolve as I get time.

in your resolvconf are you refering to the one in the pihole container? if so you cant edit this ?. Would you be able to tell me how to get it working with pihole once I get pihole up or does the commented out config in your yml work ?

This is the resolve.conf on my host server. not in the pihole container.

the one in my host server is my router ip

so far I have run these commands
sudo systemctl disable systemd-resolved.service
sudo systemctl stop systemd-resolved.service
sudo nano /etc/NetworkManager/NetworkManager.conf
added dns=default
sudo mv /etc/resolv.conf /etc/resolv.conf.bak
sudo service network-manager restart
The used the same setup as you in your compose file for pihole but without ip addresses as when I tried it with them when the container restarted it said the ips were in use everytime, but now a few days later pihole stopped working and started complaining about 127.0.0.11 which if you bash into the pihole container and check out /etc/resolv.conf it has nameserver = 127.0.0.11 and then wont start up.

I noticed that your yml for pihole had this
- DNS1=1.1.1.2
- DNS2=1.0.0.2
how does this work with the latest pihole image it states you need to have 127.0.0.1 as the first dns entry ?

My pihole is working, with no issues with that config. I'm also using my pihole as my DHCP server so I can see the computer names in the pihole dashboard.

My pihole /etc/resolve.conf:
nameserver 127.0.0.11
options ndots:0

Make sure you put your host IP address in your local /etc/resolv.conf this is the IP address of your Ubuntu server.

So in my host resolv.conf it should have my router up and host ip?

My host resolv.conf only has my host IP.

Did you run any of the above commands ?

Ive updated the resolv.conf to my server ip and rebooted with the same yml as you but pihole logs still show the dns service failed?

Let me see if I can lab this out and check the process.

Thank you so much

It also seems adding the network manager part above auto replaces the resolvconf to the router ip something to consider in the lab

Just to update I have ran the following and got it working again.

Commented out the dns=default in the NetworkManager conf file
sudo apt-get remove --purge resolvconf && sudo apt-get install resolvconf
This put my resolv.conf back in place, I then editted it to only contain my ip for my server, then stoped and disabled the systemd-resolved.service and edited my compose file to match yours but added in the below.
dns: 127.0.0.1

once it came up it worked and then I rebooted for good measure, but on reboot it still works however the /etc/resolv.conf is now empty of any entries except for commented out ones which is odd, but it still seems to be working.

Not sure which part has got it working but I am unsure as to why its working, could just use some pointers from you to get the static ips working along with cloudflared for dnssec

Thanks for pointing out this issue to me and forcing me to lab out my project. I found tons of errors. It looks like I'm missing a few files for the DHCP portion to work properly and the log file directory was wrong. Once I fixed that it seams to start up. I'm not sure how my prod one is working. I will be updating files here shortly.

it also broke grafana, did you have this issue

and oauth is dead and hydra by the looks of it

@adradloff no problem, I also spotted in the readme youll need to update the docker exec switch to -ti :)

I'm not sure what you are saying here. can you elaborate?

I'm not using Grafana, so I don't know. Oauth is working just fine for me in my lab.

I’ve got it all working smoothly the only thing that breaks grafana is when I use cloudflared as well I think it breaks the dns for that container as it’s saying it can’t contact grafana.com to pull its dependencies