PDA

View Full Version : [all variants] idea: DHCPd MAC Filtering with MySql backend


eaglestrike7339
July 30th, 2008, 04:06 PM
I just wanted to see if anyone knew anything about this, or could offer an alternative.

Goal: -Have a DHCP server be filter MAC addresses and only give IPs to a computer if its MAC was on the allowed list.
-Have this list be read from a column in a MySql database.
[even trickier] -Have this action occur in real time [/et]

This system would be used to allow a PC to join a small subnet of other PCs, for the purpose of, say, gaming.
Could there be a system of registering a PC, through the user-accessible means of an intranet webpage, and then allowing to connect within a short period of time (<2minutes?)

MAC filtering by itself is not difficult with dhcpd. The problem with a short-termed cron'd script, to print the MACs and replace the dhcpd.conf file is that the DHCP server would have to restart, which would drop connections (?).

Any ideas on how to do this? Any input at all would be great, even if it was little more than gasping, pointing a finger and saying "oohh, good luck" or something.

Thanks guys,
eagle

antantant
March 29th, 2010, 06:26 AM
Hi eagle,

I'm also looking to implement a similar system, did you ever have any luck with this?

Pulling new connections' MACs from a mySQL database in realtime would be the goal, but also time limiting the already-approved connections, which I've not yet looked into.

For me, this would actually be better done at routing level, rather than DHCP/IP level, so instead of dropping the connection the client is forced to a 'blocked' page as such.

Sorry to post in such an old thread..!

Ant

dwarfolo
March 29th, 2010, 07:45 AM
An alternative could be a combination of MySQL+PHP and iptables.
Upon registering a PC to the system you can use PHP (or whatever cgi or scripting tool you prefer) to update and run an iptables script with specific rules to deny/allow access to the DHCP server from that specific MAC address.

antantant
March 31st, 2010, 06:11 AM
Interesting, I'm going to look more into an iptables method, sounds like it could be a good solution for me. Thanks for the suggestion, I'll post with how I get on.