Open moya2162 opened 1 month ago
The one occurrence you have seen
2024-05-28 21:09:34.501 DEBUG_RESOLVER Trying to obtain host name of "fd71:2002:f23:0:f50c:11f0:e53b:8d1c" from network_addresses table 2024-05-28 21:09:34.502 DEBUG_RESOLVER Found database host name (same device) fd71:2002:f23:0:f50c:11f0:e53b:8d1c -> XXXXX.lan
likely comes from an API call which may have tried to resolve the IPv6 host name on its own for the API response.
Yes, "the order matters" is the problem here. Once looking up has failed once, IPv6 addresses are not tried again unless you configured resolver.refreshNames=ALL
. The issue is that we cannot know that we learned a host name through another IP address of the same device by now. At any later point (e.g. after a restart of pihole-FTL
), Pi-hole should be able to resolve this address through the "same device" trick.
You second example with the IPv6 GUA address does not work because this device seemingly is not known also not through another device? I'm somewhat lacking a it of context here. (is it the same device? if so, we could try to identify why Pi-hole wasn't able to see the MAC address)
So the question is: What could be the compromise here? Seemingly simply skipping because of "not new" is an issue here. But I also wouldn't want to simply do the database lookup always (and just skip the PTR) for IPv6 addresses because all this skipping was introduced because users complaining about poor performance in networks with many devices rotating their IPv6 address in matters of seconds, i.e., they had several thousand IPv6 "clients" during a normal day. Performing multi-stage database lookups for each of them every minute is definitely not the way to go.
Thank you for providing some context here. In all examples above the devices logs i posted are for the same client. I think most of my problems are from a lack of understand of how Pihole works internally. I try my best with flipping switches and observing outcomes to try to learn. Thank you for working with me, being patient, and educating me.
I have taken some time to play around with the settings and try to figure what triggers Pihole to write hostnames to pihole-FTL.db
. As you stated above I played with setting resolver.refreshNames=ALL
to see if having Pihole trigger a PTR request for IPv6 would cause resolving and writing IPv6 client hostnames into the database via the "same device" mechanism. So far based on my testing I think it is doing it, but there seems to be a delay. Does Pihole store recently defined hostnames in a cache for a while and then write updates to pihole-FTL.db
?
here seems to be a delay. Does Pihole store recently defined hostnames in a cache for a while and then write updates to pihole-FTL.db?
Yes, it is buried down in the fine details as we have to balance I/O on the database (Pi-hole is still designed to run on Raspberry Pi like hardware and SD card I/O is heavily wear-limited). The delay shouldn't bee all that long, though. It is user-controlled via the config setting database.DBinterval
defaulting to 60 seconds.
I'm still unsure about how the compromise we are looking for should look like exactly....
Could the compromise be by making a new setting which we could call resolver.retryoveride=
with options as true or false. If set to true, every time an ip comes back as "not new" it can retry for a name rather than skipping. If set to false, it stays as currently programed?
Or another way could be to instead of going with true or false, a number is the value provided, in seconds, where a user could override the refresh of "not new". Then when a "not new" address shown up and lastQuery > resolver.retryoveride then a check is done. If no value is provided it stays as currently programmed.
Not sure if these ideas have performance implications.
Problem:
Pihole does assign hostname to
ipv6
clients addresses properly whenresolver.networkNames=true
. When examiningpihole-FTL.db
only Pihole correctly assigns MAC address values toipv4
andipv6
client addresses, however hostname is left blank.When Pihole identifies an
ipv6
address it adds it to the database without resolving the hostname. When the same clientsipv4
address is discovered and resolved, Pihole then is able to correlate MAC address of the same device and understand it is the same device, however because theipv6
address was discovered first, according to the logs its not new and is skipped.Build:
Logs:
Here are some logs of when it does work. I ran a simple test on a single client. I first disabled
ipv6
, the client hostname was established throughipv4
. I then enabledipv6
, and then theipv6
hostname of that was established, however not on the first attempt:Here is logs of it not working:
Notice that most of the logs between working and not working are the same with the only difference being the last few lines. Not entirely sure as to what promts pihole to try to obtain host name from
network_addresses table
in the logs where it works vs where it doesnt work.Additional Info:
Another problem is that
pihole-FTL.db
is not updatingipv6
hostname after it is found.Network Tab
Database
And i believe another byproduct of this this issue problem is the following issue: https://github.com/pi-hole/pi-hole/issues/5544