There are two ways to accomplish this:
- use Pi-hole's built in DHCP server
- use your router's DHCP server and modify
/etc/hostson your Pi-hole machine
Use Pi-hole's DHCP server
When you enable Pi-hole's DHCP server, you have the option to assign DHCP reservations and pair them with a hostname. Just make a reservation for every device on your network.
/etc/hosts on your Pi-hole
The other option is useful if you want to keep your existing DHCP server (usually your router) and just use Pi-hole for DNS.
All you need to do is edit the
/etc/hosts file on your Pi-hole to add hostnames and IP addresses. These will then show up in the query log.
/etc/hosts applies only to the machine on which the file exists. But since Pi-hole is acting as a DNS server (resolving names into IP's) this file becomes available to any device using Pi-hole for DNS.
You should also note that if you do not use DHCP reservation from your router, if you assign a hostname to an IP and your router hands out that IP to a different device than you are expecting, the names may not be accurate.
Please note that for either option above, if you have the privacy mode enabled, the hostnames will not show in the dashboard.