How do I show hostnames instead of IP addresses in the dashboard?


#1

There are two ways to accomplish this:

  1. use Pi-hole’s built in DHCP server
  2. use your router’s DHCP server and modify /etc/hosts on 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.

Edit /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 Network-wide

Normally, /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.

DHCP Reservations

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.

Privacy Settings

Please note that for either option above, if you have the privacy mode enabled, the hostnames will not show in the dashboard.


Names (custom) or device name instead of IP's
How to show hostname instead of ip in query log?
Machine Name List
SOLVED: DD-WRT - DNS issue
Rename Top clients?
DNS Record list editor
Assign alias to IP numbers for easier identification
How do I configure my devices to use Pi-hole as their DNS server?
Complete client info, request info?
New Settings Page Addition
Can't get hostnames to resolve with Conditional Forwarding
How do I determine what device is making a query?
#2

Thanks all for you answer It’s clear.
I was first thinking that the name in my (Not pihole ) DCHP server can be used now i understand why i have always Ip :wink:


#3

Just a quick remark :

Hosts file modification need a reboot to be taken into account (For newbie like me)


#4

Good point. I think we could also probably just

pihole restartdns

but I’ll have to check to make sure.


#5

This is true. Thanks. FYI pihole restartdns does not resolve this. It does in fact require a reboot.


#6

I know this is old but I didn’t need to reboot, I just ran sudo service pihole-FTL restart. I had already restarted dnsmasq so not sure if that needs to be done first or not.


#7

I’m using Pihole 4.0 and i do not see host names anywhere. I’m running in net=host mode, using Pihole’s DHCP server. In order to see hostnames instead of IP addresses i had to edit the hosts file.

Was using pihole 3.3 previously and the behavior was the same.


#8

I never used pihole as dhcp and always got my hostnames in the dashboard. But since 4.0 its not working like before. You broke it.

And working with handmade hostslist cant be the solution…

I can ping every client in my network by the name from my windows client, which has the pihole as dns server. Looks for me like a bug, because the pihole definitly knows the hostnames of the internal ips.


#9

What are you seeing now? Screen shots would be helpful if you have them. And when did this behavior change - as soon as you updated to V4.0 or sometime later?


#10

Now I see the ips of the clients in the dashboard. I did a clean install with 4.0. Since this day i never saw any hostname of my clients in the dashboard. It worked the past 10 months before the update with different older versions.

Even with activated contitional forwarding, disabled “never forward non-FQDNs” and disabled “Never forward reverse lookups for private IP ranges” - no hostnames, only ips.


#11

From a client other than Windows, can you dig local clients in your network?


#12

Yes, I can open the webinterface of my printer on my android device with its hostname.


#13

From the terminal on your Pi, run dig for the hostnames of both the Windows client and Android client and see if the IP is returned.


#14

Nope, this is not working.


#15

What was the output of your commands?


#16

root@DietPi:~# dig pc

; <<>> DiG 9.10.3-P4-Debian <<>> pc
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 4315
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 512
;; QUESTION SECTION:
;pc.                            IN      A

;; AUTHORITY SECTION:
.                       10800   IN      SOA     a.root-servers.net. nstld.verisign-grs.com. 2018110300 1800 900 604800 86400

;; Query time: 19 msec
;; SERVER: 62.109.121.1#53(62.109.121.1)
;; WHEN: Sat Nov 03 18:19:04 GMT 2018
;; MSG SIZE  rcvd: 106

#17

This does not appear to be the case, based on the results of the dig for a local client. If you would like to upload a debug log and post the token, we can take a look at your setup.

Your best option at this point is either map the clients in the /etc/hosts file or use the Pi-Hole as DHCP server. Either of those two options will restore the client names to the logs and dashboard.


#18

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?


#19

Hi Guys,
I’m really enjoying the ad blocking however I’m suffering similarly with (seemingly) a lack of resolution on my local network. Unfortunately this has extended beyond my PiHole console to my Sonos devices which are now unable to resolve the name of our NAS drive for local library streaming.
I’ve read some information on here about altering the DNS suffix for the local lan and using the settings within the console for conditional forwarding which I have done. If I tail the pihole log I can see the requests going over the to my router (which is running DHCP) but I can’t see anything meaning full coming back. Strangely my
Windows (win10) PC is able to ping my NAS by name even after a ipconfig /flushdns but I’m not really sure how its managing to do this. But no such luck with Mac or my Sonos devices.
Surely there is a better option to this other than filling the host file?

Like here… What is the CORRECT way to get local hostname resolution without pihole as DHCP?

Anyone know of a guide to work through these issues?

Thanks.


#20

Have you considered using the Pi-Hole for DHCP services?