The method I use is described here section Q/A - "Why so many local requests?".
I've been using this for over a year now, pihole is NOT involved in this, I simply use a dnsmasq feature (does also work with pihole-FTL - pihole 4.0).
For this to work, you need to:
- have static DHCP addresses (using the MAC address) configured on the router (or whatever you use to provide DHCP)
- have a domain configured in your router.
I use pfsense, the domain is configured under system / general setup / domain. A lot of routers allow you to specify a domain, this will be distributed, using DHCP, to all clients.
On windows, You can verify you have a domain name by using "ipconfig /all", look for
"DNS Suffix Search List. . . . . ."
The solution works with ipconfig and nslookup:
ping y50
Pinging y50.localdomain [192.168.2.228] with 32 bytes of data:
Reply from 192.168.2.228: bytes=32 time=1ms TTL=128
nslookup y50
Server: raspberrypi.localdomain
Address: 192.168.2.57
Name: y50.localdomain
Addresses: 192.168.2.228
reverse lookup:
nslookup 192.168.2.228
Server: raspberrypi.localdomain
Address: 192.168.2.57
Name: y50.localdomain
Address: 192.168.2.228