Stupid question here: Editing the host file on the Pi worked fine as it now shows names instead of IP addresses in the Pi Hole interface. BUT I would like to see these names also in other programs running on my computer. Is that possible?
E. g. I use the iStat Pro widget in my Mac's dashboard and would like it to show the name instead of the IP address under the network setting.
I was hoping that editing the host file on the Pi would do the trick but it doesn't seem so.
What am I missing?
Here's a script that does exactly this - updates the hosts file with human-friendly hostnames, that the pihole uses in its reporting. There is no need to set the devices to have static IP address, or configure anything on the hosts themselves. This is a script that listens on the network for DHCP messages and updates the hosts file on the pihole server automatically. It does also try to profile to give the the hostname some additional context (like is it a TV, or fridge) but that's optional, and you can eliminate that part, if the basic hostname is enough.
The purpose of conditional forwarding is when Pi-hole is not your DHCP server, but you want to automatically have it resolve client hostnames and get their hostnames from their IP address (reverse lookup).
Is there another way of doing this without having to edit my /etc/hosts file?
I'm able to see the local hostnames on my system using the mdns-scan command, and resolve them to IP addresses using the avahi-resolve-host-name commands, is it possible to somehow get Pihole to do this?
I honestly don't get why pi-hole can't just automate the hostname discovery. I was using pfsense with pfblockerng and it was working just fine. I also miss the posibility to whitelist all subdomains from a domain
Its not done through discovery.
The clients hostname is advertised to the DHCP servers during the DHCP renewal process.
Below client of mine is configured like below to advertise its hostname:
Dont need to script anything.
If the client acquires an IP through the router DHCP, you router gets to know its hostname and creates a "PTR" DNS record for it.
In below example, on a client with IP 10.0.0.9, Pi-hole does DHCP for my network:
Hello. I have pi-hole 5 on a raspberry pi, with dhcp from my router. I only see one client in pi-hole, just the router's IP. I edited etc/hosts adding IP and hostname from other machine on the LAN, but nothing happens. Still only one client, router IP. Any sugestions?
It would be cool to use hw-address to assign aliases to devices and ignore hostnames altogether, ip adresses could change and I do not control all devices setups.
assigning aliases to hw-adresses would be a simple and effective solution that does not need any permissions