-
-
Notifications
You must be signed in to change notification settings - Fork 214
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
MAC-based client grouping #245
Comments
Hey, Regarding the grouping of clients: you can use wildcards. For example: 2 devices with hostnames "alex-laptop" and "alex-mobile" can be defined as "alex-*" Regarding the MAC address: yes, it would be (theoretically) possible. The problem is: if a client request is received by blocky, there is no possibility to retrieve the MAC address directly (only source IP address is available). The MAC address can be retrieved by using the ARP protocol (or using the ARP table of the operating system). This will work only for IPv4. For IPv6, the NDP protocoll can be used. So, basically, the challenge is to implement 2 lookups (ipv4 with ARP and ipv6 with NDP) and to test it. |
@0xERR0R Wildcards are not always applicable since devices can have complexely different hostnames (as far as I know, the hostname is controlled by the device itself). At least, it would be great if there was some sort of configuration option (alternative to wildcards) that allows to define a group of client names for which a certain groups of rules apply. As for the MAC-based filtering, isn't the physical address retrievable by the frame (OSI lv.2) containing the DNS request? Or is it hidden by the operating system? However, I don't actually know that much about IPv6 and I'm not even sure of what NDP is. Thank you anyway! |
Some routers (like AVM FritzBox) allow to define custom names for devices. In this case, blocky will retrieve custom name via rDNS from router. But you're right, hostname can be out of control and in this case it would be handy to define different names for one group. I'll create an issue to separate it from the MAC-based grouping request. -> #251 Regarding the MAC-address: yes, this information is available in the layer 2, but not on the DNS request layer (there is no possibility to obtain the MAC address programmatically, only IP address and port is available). I'll try out, how the ARP tables work for IP4, maybe this would be the first step |
@0xERR0R Yeah I am currently using Ubiquiti UniFi hardware on my network - custom names are allowed but rDNS queries get the hostnames, basing on the tests I performed. However, if the MAC-based grouping is too much of a hassle, feel free to just ignore the request - I just switched from PiHole to Blocky and I already love it a lot :) |
Looked into it and it should be possible if the host arp table is obtained. The drawback would be that the first response time of every client would be slower. Most users propably are using rDNS therfore the arp refresh should be disabled by default to minimize the performance impact. |
Upon further investigation it seems quite troublesome getting an ARP based MAC to IP mapping done. It seems to be a very complicated aproach. I stop further investigation because this seems way to complicated for the little benefit. |
What if Blocky held its own intern kind-of-arp-table and used that instead of the system's one? I guess a table can be built with e.g. |
The library which I first suggested does just that: it creates a cached version of the underlying os ARP table an periodically updates it. However this works only for the current subnet. I use an TP-Link Omada network controller which also lacks an rDNS service. |
I would agree with @kwitsch: the benefit of apr lookup is low due to limitations:
You can try to workaround:
|
Got this issue stuck in the head for a while. 😅 I figured out a way to solve it in an IPv4 environment using additional services inside an docker swarm. Maybe this helps others to.😄 |
Follow up: Because of the tiny use case and excessive config maintenance I will abandon this approach. My second approach will be a OmadaSiteDns.
It uses the controller api to read client information and converts these to DNS/rDNS entries. Thought this might be interesting for people with similar use cases. 😅 |
Would it be possible to implement client groups (and therefore specific DNS filtering) basing on the clients' MAC addresses, as an alternative to the rDNS lookup? Moreover, it would be nice if there was a way to group different clients in order to apply the same filtering rules.
The text was updated successfully, but these errors were encountered: