when a static lease is set in the DHCP portion of the admin page should be possible to write the lease to /etc/hosts as well allowing for simple adding of hostnames
Will test when I get home but to my knowledge this did not bring the hostnames into the webgui instead of ip’s this feature request was based off of a troubleshooting thread from Reddit that I will link when not on mobile
Make sure you disable your router’s DHCP if you use Pi-hole’s otherwise clients might get an address from one or the other.
I do not have this issue personally I just edit the hosts file myself
The hosts file is intended to be used by the own host itself and not to be shared by other hosts.
The hosts file may contain entries like for example below one:
Lets assume a second system tries to connect to “pihole.your.domain” reading from that same hosts file, it gets IP address “127.0.1.1” returned via DNS.
That localhost IP address will make the other host try to connect to itself on the loopback interface instead of connecting to the intended host “pihole.your.domain”.
Pi-Hole does some trickery so the hosts file can be read by dnsmasq but this file was never intended to be used by the other hosts on the network.
See the hosts file more as a personalized map of the network from the own hosts point of view.
More complex systems have multiple hosts entries that would make no sense for the other hosts on the network when trying to resolve from host to host.
Below an example of two different hosts files for if you might want to cluster the Pi-Hole services:
# /etc/hosts file for "ph-node1.your.domain" 10.0.0.10 ph-cluster.your.domain 127.0.0.1 ph-node1.your.domain 10.0.0.12 ph-node2.your domain 127.0.0.1 ph1-heartbeat.your.domain 192.168.0.2 ph2-heartbeat.your.domain
# /etc/hosts file for "ph-node2.your.domain" 10.0.0.10 ph-cluster.your.domain 10.0.0.11 ph-node1.your.domain 127.0.0.1 ph-node2.your domain 192.168.0.1 ph1-heartbeat.your.domain 127.0.0.1 ph2-heartbeat.your.domain