How can I assign DHCP leases from a script?
        Posted  
        
            by 
                devicenull
            
        on Server Fault
        
        See other posts from Server Fault
        
            or by devicenull
        
        
        
        Published on 2012-10-03T19:46:45Z
        Indexed on 
            2012/10/03
            21:42 UTC
        
        
        Read the original article
        Hit count: 228
        
I have an environment where there is one DHCP server servicing a number of different hosts/vlans. The switches are configured to forward the DHCP requests over (via ip-helper) and include information about the port (option 82). I'd like to take that information and translate it into an actual lease for the server.
I don't think it's particularly feasible for me to pregenerate a list of available leases, but I should be able to determine an address for a lease as it comes in.
Is there an DHCP server that can execute a script when it receives a request? (Note: I'm looking to assign the IP from the script, not have the DHCP server assign an IP then execute the script)
Edit: So, ultimately I'm trying to provide DHCP/PXE services over a large number of distinct vlans. This is so we can do OS installs via PXE booting without having to have a separate PXE vlan. I've got the switch config down no problem, and I have the DHCP server recognizing option 82.
I need a way to pull DHCP assignments from another system (this other system would know what subnet to use on what vlan), but I do not want to have to pregenerate a list of vlan:DHCP range pairs.
© Server Fault or respective owner