That's my router. When logging in to it, it shows all local IPs and hostnames.
From other machines, I could input the hostname directly, for example my Unraid server has a hostname of "Tower" and I can go to the browser from another machine and type in "Tower" and it would take me to the server's webpage.
Here's a screenshot from the router's DHCP (some hostnames have been obfuscated intentionally):
The router at 192.168.2.1 (the only one, actually) does know the answer - but maybe there's something I need to configure on it, specifically for Pi-Hole?
Maybe. That dig command is essentially what we do for finding the hostname to IP mapping. As you displayed, there is no response from 192.168.2.1 that provides any information. A proper response would be something like:
Where your problem may also lie is in the fact that your Pi-hole IP address is not what you have set the DHCP server to use.
IPV4_ADDRESS=192.168.2.11/24
*** [ DIAGNOSING ]: Name resolution (IPv4) using a random blocked domain and a known ad-serving domain
[✓] www.ellads.com is 0.0.0.0 via localhost (127.0.0.1)
[✗] Failed to resolve www.ellads.com via Pi-hole (192.168.2.11)
[✓] doubleclick.com is 142.250.185.110 via a remote, public DNS server (8.8.8.8)
*** [ DIAGNOSING ]: Discovering active DHCP servers (takes 10 seconds)
Scanning all your interfaces for DHCP servers
Timeout: 10 seconds
* Received 300 bytes from eth0:192.168.2.1
Offered IP address: 192.168.2.12
Server IP address: N/A
Relay-agent IP address: N/A
BOOTP server: (empty)
BOOTP file: (empty)
DHCP options:
Message type: DHCPOFFER (2)
server-identifier: 192.168.2.1
lease-time: 86400 ( 1d )
netmask: 255.255.255.0
router: 192.168.2.1
dns-server: 192.168.2.12
renewal-time: 43200 ( 12h )
rebinding-time: 75600 ( 21h )
--- end of options ---
DHCP packets received on interface eth0: 1
DHCP packets received on interface wlan0: 0
DHCP packets received on interface lo: 0
I think I know what happened. I have first set up Pi-hole with Wireless enabled, then connected it to wired, and now they are both enabled. I think they are fighting each other
I can connect to pi-hole using both .11 and .12 local addresses.
Update: I have disabled wireless connection from the pi-hole, do I have to do something else to get rid of the leftover .11 local address? Rebooting pi-hole did not help in making local hostnames work.
To fix the .11 to .12 you should run pihole -r and reconfigure to the intended IP address.
I don't think that will solve the hostname issue as that still won't return an PTR record from 192.168.2.1 which is currently returning NXDOMAIN responses.
Seeing that you are using Ubiquiti routing equipment, this likely fails due to lack of appropriate DNS record creation on DHCP lease registration, i.e. your router cannot answer the corresponding DNS requests (just as demonstrated by you executing Dan's earlier dig command).
Some Ubiquiti models would be able to mitigate this by switching the on-device DHCP server to dnsmasq .
You'd have to consult with Ubiquiti support whether your router would support that and how to enable it.
In case that's not possible, you can still create Local DNS records for your IP addresses in Pi-hole.
Obviously, this will only be a viable option if your devices are assigned with a fixed IP address.