문제

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!

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top