Hey guys. I was gone for a while; returned and saw that although any device with the .local suffix is browsable from my laptop, pi.hole still does not resolve! The /etc/hosts file on the pi-hole looks like:
As you can see, the custom entries are at the bottom (I even appended the static IP of the device, though I don't think it's needed). My server is pingale with the .local suffix, but alas, nothing at pi.hole.
Very frustrating when I want to modify the web UI (though I can obviously still use the IP).
In some cases, intermittent performance problems are indicative of a hardware problem. What power supply are you using for your Pi, what card brand, and how do you have the Pi connected to the network?
If that were the case I'd see other issues. Ad-blocking works perfectly, and I'm seeing no network issues (drops, ping/traceroute tests, etc)
The thing is, it's resolving now, so nslookup is resolving as it should. Other times it does not resolve (but everything else works properly).
It uses 1.1.1.1 for itself, and hands out the pihole ip for DNS through DHCP.
That said, I think I fixed it. In my previous configuration, I had the router handing out the pihole as the primary DNS, and then (without much thought) I had set the secondary and tertiary DNS servers as 1.1.1.1 and 1.0.0.1.
A few days ago, I realized this was superfluous, and removed them, leaving only the primary. Since then I have had no problems with local hostname resolution, and my mobile ads were more consistently being blocked! It likely affected my Linux machines as well, but I wouldn't have noticed because they have adblockers. It's strange, though - pihole was definitely blocking (I had to frequently whitelist domains for my wife's work) before these changes.
So I think I'm ok now - thanks for your help, everyone! And Graysky, see you in Archland.
The right way to do it is to put your entries into /etc/hosts and in the pihole admin interface Settings > DNS tab uncheck the "Never forward non-FQDNs" and the "Never forward reverse lookups for private IP ranges" checkboxes. After that on the System tab restart the DNS resolver.
You can also map them in a dnsmasq configuration file in directory /etc/dnsmasq.d The advantage of mapping here is that this configuration file will be exported by the teleporter, while the /etc/hosts file will not be. This is true for V4.x; in V5 the hosts file will be exported.
Hi, I am finding this a little confusing as I am using Pi-hole as an add-in to Home Assistant.
I find the suggestion to remove the secondary dns server from the dns section in the router also works for me. The primary dns server is the local address of the rpi4 that is running hassio, which has pi-hole set up as an add-in.
I am a little worried not having a secondary dns server set up as the rpi4 may be offline from time to time.....
I have tried the pihole admin interface settings and turned the unchecked both these boxes but have not put my entries into /etc/hosts.
I do not know exactly where this /etc/hosts file will be located. My understanding is that the hass io system has pihole running in a docker and I cannot see any volumes mounted. I will probably need to ask the hass io people about gaining access to the /etc/hosts file, but need to know what to ask for.
I believe that I have the most updated version of Pi-Hole on Raspberry Pi (I just installed it a couple of days ago).
/etc/dnsmasq.d says that it is a directory, but I was able to edit /etc/dnsmasq.config with the following and it worked: address=/RaspberryPi/192.168.1.105
I also read https://www.reddit.com/r/pihole/comments/6eeo6z/static_dns_entries/ that I could use code in the dnsmasq.config file this to re-direct all local queries? but this didn't seem to work: server=/local.lan/192.168.1.1
server=/1.168.192.in-addr.arpa/192.168.1.1
I also tried to use the web portal and setup Conditional Formatting. (using the IP of my router that does DHCP and the domain name of Local) Note, my Router is ISP provided so I'm not 100% about using local as the domain, the LAN doesn't say anything about a domain, the WAN says 'telus' but I'm not sure that's what I should be using? Anyways, considering that Conditional Formatting is built into the system, wouldn't this be the best way to do this?
However that seems to overload (Spam) my system with SOA requests.
On my Pi3 (10.0.0.26) Pi Hole and Nginx is running. I used virtual hosts in order to access some docker instances of my synology (10.0.0.250) as well as the web interface of my sat receiver (10.0.0.152).
I use a Domain mydomain.com and various Subdomains to access the services from outside. They are mapped to my public IP and my router forward it to nginx with virtual hosts: vu.mydomain.com - - > 10.0.0.152 Sonarr.mydomain.com - - -> 10.0.0.250
In order to access the services within my network as well, I used local dns domain definition of pi hole to let nginx take care vu.mydomain.com - - > 10.0.0.206 Sonarr.mydomain.com - - > 10.0.0.206
On my router dns is set to pi hole, 10.0.0.206
This setup is working, I can access the services both inside the network and outside, but sometimes I get timeouts or errors inside my network. I have e.g. disable the wifi and try vu mydomain.com and then it is working again.
Where is the error? Why is it only partly working?
Thx for any advice.
Best regards
Michael
I have solved local hostname resolution without involving my router. I have an ubiquiti edge router, which does not have the Additional DNSMasq Options dhcp-option, plus I want the router as the DHCP server.
How I did it: In my router, I have assigned static IPs to all my internal hosts. Then I added all that info to my /etc/hosts file on the pi-hole host. The Edge admin has a page listing all the static IP assignments, so it is an easy copy - paste into /etc/hosts. I used awk to swap the IP address to be in front of the hostname -- awk '{print $2,$1}'. One reboot and pi-hole is showing names instead of IPs for all the hosts.
Disadvantages of this method:
(1) Double work -- have to maintain the IP assignments in both the router and the pi-hole /etc/hosts
(2) Guests using DHCP on my network dont have their device names visible on the pi-hole
(3) You need Pi-Hole 5 or above for /etc/hosts to work, if you cannot upgrade to 5.
Advantages of this method:
(1) Keep my Edge router as the DHCP server, I have plans to configure the Edge to split the household into two virtual lans to keep the home computers protected from the home automation devices.
(2) The router is configured as the secondary DNS server, after the pihole, so if I unplug the pi-hole host, the vital internet activities of the ungrateful other residents of the household can continue.
(3) Basic and simple. No need to investigate if pi-hole upgrades are blowing away the local.list file or other fixes like dnsmasq that I'm unfamiliar with.