Using isc-dhcp-server
on Debian Jessie, I'd like to block DHCP requests based on parts of their hostnames - specifically, if the hostname contains the RegEx string somewhere "iPhone|android-". My current solution is to wait until they have a lease, and monitor for those devices, and manually add the MAC address to the Blacklist file.
This black list method is getting quite large (almost 256 entries), and getting harder to maintain.
I understand how to check the beginning of the hostname to determine the class, but how do I check from any part of the hostname to determine which class to assign it?
It sounds like you're after the
dhcp-client-identifier
field, which may or may not be what you call the hostname. According todhcp-eval(5)
, there may be a regex option available. If so,And then elsewhere
deny
members of those classes under the appropriatepool
statement. (Or use a more complicated regex to do it in one class.)