Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clients IP vs MAC Address #2010

Closed
iteqla opened this issue Oct 19, 2021 · 9 comments
Closed

Clients IP vs MAC Address #2010

iteqla opened this issue Oct 19, 2021 · 9 comments
Labels

Comments

@iteqla
Copy link

iteqla commented Oct 19, 2021

Versions

  • Pi-hole version is v5.6 (Latest: v5.6)
  • AdminLTE version is v5.8 (Latest: v5.8)
  • FTL version is v5.11 (Latest: v5.11)

Platform

OS and version:
PRETTY_NAME="Raspbian GNU/Linux 10 (buster)"
NAME="Raspbian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=raspbian
ID_LIKE=debian

  • Platform: Raspberry Pi 3 Model B Rev 1.2

Expected behavior

When adding clients, they should be described also by their IP address in the client list, they should be described also by their hostname/assigned commentary name in the top lists of long term data, and they should disappear from the drop-down menu of the client list

Actual behavior / bug

One can either select them from the drop down menu and they disappear from the available option but show only with their Mac Address. Alternatively, one can manually type their IP instead of selecting them, they will then be shown with their Mac Address AND their IP, but they won't disappear from the drop-down menu. They are always described by their IP address in the top lists

Steps to reproduce

Steps to reproduce the behavior:

  1. Go to 'Group Management > Clients'
  2. Click on 'Known Clients drop-menu'
  3. Scroll down to 'any client'
  4. See error

Debug Token

Screenshots

If applicable, add screenshots to help explain your problem.

Additional context

Add any other context about the problem here.
toplist
host lists
mac address

@github-actions
Copy link
Contributor

This issue is stale because it has been open 30 days with no activity. Please comment or update this issue or it will be closed in 5 days.

@iteqla
Copy link
Author

iteqla commented Jan 18, 2022

Happy new year everyone!
Is there any update on this front?

@jgrisham
Copy link

jgrisham commented Feb 2, 2022

As mentioned in #2032 and #1889, recent / log-term log pages and the tables on the dashboard currently use the hostname-IP address mappings from Local Hosts / DNS Records, not those from Group Management / Clients, ...

... supplemented by information accumulated from the ARP table over time (this is all then stored in the network_addresses table of pihole-FTL.db.

Quick hack for the impatient: add desired mappings on the Local Hosts / DNS Records page. Optionally press the "Flush network table" button on the 'Settings' page. Maybe reboot afterwards.

tl;dr: it’s complicated™.

Background:

As I seem to recall, the query database stored/stores records with the IP address of the host that made the query.

  • I also believe there was (in mid-late 2021?) some discussion of replacing or augmenting that with a relational link to another SQLite3 table of hosts that also contains MAC addresses.
    • I don’t know if that has been implemented yet (or if another table besides that used by “Group Management - Clients” might be required, since these two functions might not perfectly overlap).

Comments:

Making the change to use the names in “Group Management - Clients” for clarity could be nice, of course, as the dashboard and query log could then display something like “Darcy’s iPhone” instead of “darcy_iphone.local”.

Complicating the status quo, the “Local IP” table can contain multiple entries with the same IP address, e.g.:

 dns.local          192.168.1.4
 pihole.local       192.168.1.4
 help.local         192.168.1.4
 adblock.local      192.168.1.4
 darcy_iphone.local 192.168.1.182
 darcy.local        192.168.1.182
 darcy.lan          192.168.1.182

In this scenario, even if the interface chooses the display name in a deterministic way, that could be tough to communicate to the average user.

A mass switch to only using Client Group Management ‘comments’ / ‘friendly names’ (regardless of whether linked to IP address or MAC address of the query) wouldn’t help those who don’t use that feature (and would be a breaking change for those who currently have things configured in a way that works for them).

Possible goal state

Not sure what an ideal solution (for both users and devs!) would exactly be, but perhaps a ‘gravity’ type of lookup / substitution table could be generated / periodically updated (daily? upon request? every time a source is manually changed in AdminLTE / version 6 UI?) from:

  1. Group Management - Clients
  2. Local IPs
  3. Pi-Hole DHCP server
  4. Network DHCP server (e.g. I use RouterOS for a DHCP server, for unrelated reasons)
  5. Network resolved reverse-DNS (if configured)
  6. Pi-Hole ARP table
    (not necessarily all of those sources, and not necessarily in that order)

Optionally, that combined mapping table could be also be displayed in a read-only format (e.g. in the settings portion of UI, with a brief description of the priority order).

  • That read-only table could be co-located with the toggle to enable display substitutions at all, and would facilitate user education, administration, and debugging all in one shot; e.g.

    IP addresses on the dashboard and query log pages can be replaced with labels.

    ^
    |
    … read-only mapping table …
    |
    v

    Note: The above list is automatically updated once daily. To determine the label used for each host, the following sources are checked (in order) until a match is found:

    1. Group Management / Clients {hyperlink}
    2. hostname from Local Hosts / DNS Records page {hyperlink}
    3. DHCP reservations {hyperlink}
    4. Reverse-DNS (if PiHole is configured to look up local subnet reverse DNS entries from the network)

Caveat: my memory may be incorrect, and my knowledge in general is absolutely many months behind current development.
  • Feel free to ignore any of the above, or share it on discord … (you can even take credit for the idea yourself if you like it!) … I just was brain-dumping while I had the thoughts and a few spare minutes. - Jim

(see also PR #1931, and PR pi-hole/FTL#1255).

@github-actions
Copy link
Contributor

This issue is stale because it has been open 30 days with no activity. Please comment or update this issue or it will be closed in 5 days.

@github-actions github-actions bot added the stale label Mar 12, 2022
@iteqla
Copy link
Author

iteqla commented Mar 13, 2022

That sounds like a reasonable solution. I would add one more idea to the table: in case of a scenario in your screenshot, where the same IP address corresponds to many hostnames. If you look at my screenshots at the top of the thread, you can see that Group Managements already displays two lines with IP and hostname. Perhaps more lines could be shown with the remaining hostnames (maybe up to a limit?). Or the hostnames could be shown separated by a ";" on the same line.

@github-actions github-actions bot removed the stale label Mar 13, 2022
@github-actions
Copy link
Contributor

This issue is stale because it has been open 30 days with no activity. Please comment or update this issue or it will be closed in 5 days.

@github-actions github-actions bot added the stale label Apr 16, 2022
@iteqla
Copy link
Author

iteqla commented Apr 17, 2022

Any thought?

@github-actions github-actions bot removed the stale label Apr 17, 2022
@PromoFaux
Copy link
Member

Just to echo some thoughts in the linked thread:

The way around this is to use Pi-hole as your DHCP server and assign static leases to each client - one can define the hostname there (or use that which is reported by the client)

It gets complex when trying to tie the IP address of an historical query to an existing (or even no longer existing) client, we can't store it in the database at the time of the query, because a DNS packet does not contain the MAC address of the client that is requesting.

I know @DL6ER has done some work on the query table to pave the way for a more optimal way of looking at this, which is mentioned above in pi-hole/FTL#1255

Beyond that, there isn't really much more to discuss currently. @jgrisham summed it up nicely with:

tl;dr: it’s complicated™.

@github-actions
Copy link
Contributor

This issue is stale because it has been open 30 days with no activity. Please comment or update this issue or it will be closed in 5 days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants