API & Integration

Reply

next_available_ip for DHCP Range

MPateman
Techie
Posts: 14
376     0

Most of our subnets for workstations are large DHCP Ranges.  If we want to automate allocation of Fixed/Host+Mac entries within that Range, is there a function to allocate the next available ?

 

As I understand, just using the nextavailableip will choose those with status UNUSED.  As a DHCP Range marks all as USED it fails to return an address.

 

Alternate homebrew script to extract all Lease State = Free, Ping candidate, Create.

 

As mentioned in other posts this exposes a higher risk of collision as spreading the process across multiple script servers, instances, multi-threading, or even DHCP may try and allocate the same entry while I'm processing :-)

Re: next_available_ip for DHCP Range

Adviser
Posts: 147
376     0

You can leverage the nextavailableip function via the WAPI to request an IP address from a specific range.

 

Using a range lookup (if the view is not specified, the default view will be used):

 

      • func:nextavailableip:<start_addr-end_addr>[,<network view>]

 

Here is an example using curl for a 192.168.1.150-192.168.1.199 range:

 

curl -k1 -u admin:infoblox -X POST https://192.168.1.2/wapi/v1.4/record:host -H "Content-Type:application/json" -d '{"name":"foo11.newzone.com","ipv4addrs":[{"ipv4addr":"func:nextavailableip:192.168.1.150-192.168.1.199"}]}'

 

You should be able to build on this to include the MAC address and enable DHCP to create the Host+Mac entry you are looking for.

Check out our new Tech docs website at http://docs.infobox.com for latest documentation on Infoblox products

Re: next_available_ip for DHCP Range

MPateman
Techie
Posts: 14
376     0

Thanks.  Interesting methodology.  So force with a range and does add host record inside DHCP range.

Just need to ensure we collect the range(s) per subnet.

Highlighted

Re: next_available_ip for DHCP Range

BHanson
Techie
Posts: 9
376     0

So when a range is wanted to select a range within the subnet, it seems you can't just set a start and end IP.. that this needs to be defined as a range (DHCP) on the appliance.

 

And it seems that the caller has to know what this range is. 

While the range can be named, it doesn't seem to allow that name to be used as the reference (and apparently names are arbritrary and aren't used--they don't have to be unique).

 

I would like the caller to not need to know the subnet nor the range IP addresses.. 

if any change is needed on the range or IP subnet then anything calling it has to be updated as well.. apparently.

 

perhaps there is a method to address this?  I'd be very intereseted in hearing solutions..

 

Showing results for 
Search instead for 
Do you mean 

Recommended for You