I've been trying to resolve a local ip address, so I can enter "myrouter.local" to replace the local ip of my router. This is a test; I wanted to ultimately do something similar to my home server so that I can replace its IP address with "myserver.local". I did this by entering the local address and IP under " Local DNS Records > DNS Records"
Actual Behaviour:
Whenever I enter the address, I get a blank screen.
First time poster and user of pihole, please excuse my ignorance. I've gotten pihole set up as an app on TrueNAS Scale. I know there's many posts about resolving local addresses via local DNS, but I can't seem to figure it out. The web UI seems to have correctly resolved the IP address of my router to the local address I set.
Using *.local names isn't tied to DNS: .local is the TLD reserved for the mDNS protocol, and should not be used with plain DNS.
For mDNS capable devices, any device attached to the same link will be resolvable by its self-assigned .local name, without involving DNS resolution at all.
Thank you for the explanation. Is what I'm asking for even possible with pihole? Can I resolve a local hostname to a local IP? It doesn't even have to be ".local", I just want some simple address I can type that only needs to work on my local network.
As explained, using myrouter.local works without DNS, provided your router and the machine resolving it both support mDNS, and your router would be configured to claim that name for itself. Similar would be true for myserver.local.
To define local DNS records for any other names in Pi-hole, use Local DNS records.
You can do so for plain hostnames as well as FQDNs.
For the latter, you should use your local/search domain as propagated by your router.
For some router brands, that could be fixed value (e.g. fritz.box), or it is configurable, in which case you should set it to one if the non-public domains reserved for private usage (e.g. internal, home.arpa, lan).
Thanks for the information. Since your last reply, I've learned that since I've been using a VPN on the machine that I've been attempting this on, resolving local hostnames to a local IP is more complicated, perhaps impossible. It only works with the VPN off, and if I enter the exact address to the router's default landing address.
Example: "myrouter.local" doesn't work doesn't resolve but "myrouter.local/home.php" does (Not the real landing page, just an arbitrary example.)
Using the local domain provided by the router sounds like a good alternative. However, I have a router provided by my ISP and the help provided on the router's portal page is not helpful, and documentation is practically non-existent, so I don't even know if how to configure the router to provide the services I need. Might need to look into a 3rd party router.
Of course all this assumes that using a VPN wouldn't interfere with it, which I assume it does.
Also to add, I just realized that I didn't add the fact that I'm hosting pi-hole as an app on TrueNAS Scale. This means that even if I wanted to use mDNS, there's this extra complication of figuring out if mDNS should be configured at the server level, or within the context of the app. I posted about this on their forum, and no response yet.
sigh
Again, I thank you for trying to help me with what should be a simple thing, but instead became a mess with no obvious direction to research to rectify it.
mDNS is a peer protocol. For a peer being able to learn the name of another peer, both of those peers must support mDNS.
Most recent OSs support mDNS out of the box.
For any other piece of software, it would depend whether they'd request mDNS resolution via their OS, e.g. most browsers should do so.
On a Linux system, you can run avahi-resolve -v -4 -n <name>.local to resolve a name for a quick check. Or, if the peer runs a webserver, you should also be able to open that in a browser using http://name.local.
Again, note that Pi-hole is not involved in mDNS at all.
Pi-hole will answer DNS requests only.
Just omit the local domain and define plain hostnames via Pi-hole's UI then, e.g. laptop for your laptop. Usage of the local domain isn't a strict requirement.
This will work instantly on any client that is using Pi-hole for DNS exclusively.
It won't work on a client that does not do so.
That would depend on the type of VPN.
VPN service providers commonly force redirection of DNS traffic to their own DNS servers, to avoid DNS leakages, which would cut off clients from using Pi-hole.
If you'd host a VPN server in your own network, then chances are that can be configured to use Pi-hole.
Do I do this under "Local DNS Records > DNS Records"?
Also, regarding what I said here, is there a way to redirect the local hostname to go to the default landing page? The page doesn't load otherwise. The setting I mentioned above allows me to set direct IP addresses only.
How would you suggest that Pi-hole would be involved here?
As explained, using "myrouter.local" would use mDNS resolution and should work as long as your router and the requesting client both would be on the same link and both would support mDNS, as well as the requesting software.
Also, even if you'd use a DNS domain here instead of "myrouter.local", page redirection is done by a webserver rather than a DNS server.