Windows PC is displayed with IP instead of hostname

Summoning this old thread back.
Many of my devices are correctly identified as hostname.home but my current windows PC shows up as 192.168.x.x.

if I run cmd and do hostname i get my PC hostname, so I don't understand why it fails.


If I add the hostname on /etc/hosts and restart pihole, then it shows the hostname I have defined (minus .home at the end). I would like all my devices to be automatically identified from the static routes, so that they all automatically become NAME.home

Any idea?

Moved your posting to here bc that other thread/FAQ is a bit outdated I think.
I believe we didnt have the "Conditional Forwarding" setting then which provides a third option.

Three questions:

  1. How are IP details configured on that Windows PC, automatically via DHCP or did you configure static IP details?
  2. Who does DHCP services for your network, the router or Pi-hole?
  3. Is Pi-hole running bare metal or maybe in Docker?

So yeah, after a full day I am somewhat on top of it:

  1. Yup, you probably have already guessed it: all my devices were set manually, definitely a stupid mistake. Because of that they would never send a DHCP request and I assume pihole was then unable to set them up correctly. Putting them back on automatic IP assignment (and restarting them) made it so that pihole would dispense the correct network info.
  2. Pihole does both DNS and DHCP
  3. In Docker

There was something that I didnt understand regarding the pihole UI: I assumed that the first DHCP section was for dynamic leases, and the bottom one was for the static ones. I was finding it really confusing that I'd see my devices in both sections, so I would manually remove them from the top section to keep them only in the static leases. I think this was a mistake on my part, but I think the UI didn't help.

Finally, I still have a minor issue: when I go on Query Logs, many of the Clients still show as IP number, instead of Hostname. I find this a bit annoying as I can clearly see the hostname in the DHCP section. I dont fully understand what is causing this given that some devices show IP and others HOSTNAME.home

I hope this helps, thanks for taking the time to read through all this madness

1 Like

Yeah only hosts that acquire IP details via DHCP will advertise their hostname to the DHCP server.
And Pi-hole will create DNS records for them (A & PTR).

The first section clearly states "Currently active DHCP leases".
Doesnt matter if you configured a static DHCP reservations for a particular host or not.
You might know already, those leases expire after a certain period if not renewed in time (usually 12 or 24 hours).

Wait a bit longer.
Pi-hole updates those hostnames every hour.

Yeah, don't get me wrong, I understand this is me being a noob. I think what confused me was that many connected devices didn't show up on "Currently active DHCP leases". I assume this is because they already knew what network configuration to use, and pihole didn't need to reassign it?

I was actually unaware, so the list will basically empty itself after a while. I guess the point being that without an initial lease, pihole would not be able to read the hostname, and would initially fail to allow hostname.home for that device. Or at least that's my current understanding.

All devices that are configured to acquire IP details via Pi-hole DHCP should immediately be listed on the webGUI.
As soon as the dnsmasq code thats embedded in the pihole-FTL daemon/binary hands out a lease, details are stored in below file thats read by the webGUI:

$ cat /etc/dnsmasq.d/02-pihole-dhcp.conf
[..]
dhcp-leasefile=/etc/pihole/dhcp.leases
$ cat /etc/pihole/dhcp.leases
1738376579 00:16:3e:xx:xx:xx 10.0.0.145 hak01 ff:3e:xx
1738361599 b8:27:eb:xx:xx:xx 10.0.0.9 avr ff:eb:xx
1738377156 e8:94:f6:xx:xx:xx 10.0.0.219 arcade02 01:e8:xx
[..]

Maybe there is still another DHCP service active on your network?
Can check with below one on the Docker host if its got a shell plus you need root/sudo powers:

docker exec -it <CONTAINER_NAME> pihole-FTL dhcp-discover

I dont know when you switched from router DHCP to Pi-hole DHCP?
But maybe some clients still had/have a lease from the router that needs to expire first before they request a new one from Pi-hole.
The lease period is not always 12 or 24 hours and can be much longer.
Above dhcp-discover can show you the lease-time thats advertised by a particular server ^

Not as long as those devices stay connected.
Well before the lease expires, they automatically renew their leases.

Ps. most of us started out as a n00b here including me :wink:

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.