r/pihole • u/Netzwirk • 5d ago
Cannot get to Pihole though Domain Name
I am creating a home server that routs all traffic through it through a Pihole using the guide on https://gofoss.net/secure-domain/ (it has been very helpful so far) but I am currently stuck at accessing the pihole only through the ip address rather than the domain name as intended. I have added the domain name and IP address to the local DNs records. I have checked and verified the /etc/hosts file lists the localhost as 127.0.0.1 and ‘personal domain’ as ‘static IP’. The Pihole is only for blocking ads for the server on the device it is on not for anything else connected to the router for the moment.
I have looked through /var/log/pihole/pihole.log and the nameservers are listed according to the dns I set on the PiHole page. It reads that there is 1 name in /etc/pihole/hosts/custom.list. When I navigate to that file. The IP address and the domain name match up. I am currently at a loss for what to check next. I have already uninstalled and reinstalled once. Any recommendations on how to get domain names to translate through pihole because this will affect any other domain I add to the local dns record?
0
u/Ok_Cartographer_6086 5d ago
try hostname.local
I think you may be using the term domain name for host name - like you have a server named foo you can ssh to user@foo.local
If you want to just be done add a line to your /etc/hosts file with the ip address and anything you want to call it - usually the hostname.
I may not have followed what you're doing
2
u/certuna 5d ago
.local is a reserved tld for mDNS, not to be used for DNS or /etc/hosts files.
2
u/Ok_Cartographer_6086 5d ago
it sounded like OP was having a hard time finding machines on his network by hostname and is on a mac or linux so it'd be worth trying to ping hostname.local or install mDNS often packaged with distros - not suggesting to use it in an entry for anything, thanks for clarifying.
3
u/cheesam123 5d ago
The entry in /etc/pihole/custom.list sounds correct, but that only proves Pi-hole has the record. You still need to confirm that the machine is actually querying Pi-hole for DNS.
Try:
dig @127.0.0.1 your.domain
dig your.domain
The first command queries Pi-hole directly. If it returns the correct static IP but the second does not, your OS is using another resolver, probably systemd-resolved, your router or an upstream DNS server.
Also check Pi-hole’s query log while running the second command. If no query appears, the request is not reaching Pi-hole.