Reply

URGENT, PLEASE HELP

Authority
Posts: 29
3241     0

Hi Team,

 

I have an urgent question.

 

I have a question wrt API.

 

If I ask for next available IP from a subnet using Infoblox API and don’t create any host record against it.

Now after 5 sec , I shoot another API asking for next available IP , will I get the same IP???

 

My question is will the Infoblox save the IP temporarily for some time or not ?? If yes, what’s the time??

Re: URGENT, PLEASE HELP

[ Edited ]
Moderator
Moderator
Posts: 315
3241     0

Calling next_available_ip on a network does not reserve it for any future use.  If you run next_available_ip on the same network multiuple times, you will get the same address back every time.

 

 

$ curl -k1 -u admin:infoblox -X POST 'https://192.168.1.6/wapi/v2.9/network/ZG5zLm5ldHdvcmskMTAuOS4xNi4wLzI0LzA:192.168.1.0/2/default?_function=next_available_ip'
{
    "ips": [
        "192.168.1.25"
    ]
}
$ curl -k1 -u admin:infoblox -X POST 'https://192.168.1.6/wapi/v2.9/network/ZG5zLm5ldHdvcmskMTAuOS4xNi4wLzI0LzA:192.168.1.0/2/default?_function=next_available_ip'
{
    "ips": [
        "192.168.1.25"
    ]
}
$ curl -k1 -u admin:infoblox -X POST 'https://192.168.1.6/wapi/v2.9/network/ZG5zLm5ldHdvcmskMTAuOS4xNi4wLzI0LzA:192.168.1.0/2/default?_function=next_available_ip'
{
    "ips": [
        "192.168.1.25"
    ]
}
$

 

 

 

To reserve it immediately against future use, you would need to create an object on that ip address, or create an object using the next_available_ip function.

 

Here's a host record example, which excludes the .1 address in the requested network:

 

 

curl -k1 -u admin:infoblox -H 'Content-Type: application/json' -X POST \ 'https://192.168.1.6/wapi/v2.9/record:host' -d '{"name": "test.example.org", "ipv4addrs": [{"ipv4addr": {"_object_function": "next_available_ip", "_object": "network", "_object_parameters": {"network": "192.168.1.0/24"}, "_result_field": "ips", "_parameters": {"num": 1, "exclude": ["192.168.1.1"]}}}]}'

 

 

Re: URGENT, PLEASE HELP

Authority
Posts: 29
3241     0

Thanks for your answer. 

 

Can I use API asking for next available IP and in the same request pass on few IP's which Infoblox should ignore while giving me next available IP ??

Re: URGENT, PLEASE HELP

Moderator
Moderator
Posts: 315
3241     0

Yes, anything in square brackets is an array.  That section would look like this:

 

"exclude": ["192.168.1.1","192.168.1.2","192.168.1.3"]

 You could also place an exclusion range or a set of reservations in the network, to block out addresses.

Showing results for 
Search instead for 
Did you mean: 

Recommended for You