DHCP server supporting port-based IP pool

in my network I want my Linux DHCP server to assign IP addresses based on the location a computer is plugged in. I'm in pretty much the same situation as the person asking this SO question: Assigning IP Addresses to a Physical Location but I don't have such a smart Cisco switch. However, my Netgear switch is somewhat smart and I can ask it with SNMP for the port of a MAC address.

With this I wrote a shell script that answers with an IP pool when given a MAC address. Now I need a DHCP server which asks that script on a DHCP request and assigns a lease from the returned IP pool. My first idea was to customize the ISC dhcpd source but I didn't find the place where the IP pool is generated by the MAC address.

Can anyone help me to find my way through the ISC dhcpd source? Or does anyone know another DHCP server which is easy to customize in this way? Or a library which makes it easy to implement a DHCP Server, preferably in C, C++, Haskell or Python?

Thanks for your time and help!

Answers


I found DHCP snooper. It seems to provide exactly the hook I need. I can manipulate a DHCP Request to set opt 82 with the result of my script and do the rest with ISC DHCP by parsing opt 82 again. I have not tried yet but I'm optimistic.


Need Your Help

remove null column from collection in c#

c# linq collections expandoobject

I have a table Menu and the data is like the attached screen shot