Reply
Accepted Solution

assigning/reserving based on next_available_ip

Authority
Posts: 31
2252     0

I'm trying to assign IPs from a subnet based on the subnet that I get from another call based on EAs.  I feel like I'm so close because every time I run this command:

 

curl -k -u username:password -H "Content-Type: application/json" -X POST 'https://ipam.myhost.com/wapi/v2.2/record:host?_return_fields=ipv4addrs' -d  '{"configure_for_dns":false,"name": "myname", "ipv4addrs":[{"ipv4addr":"func:nextavailableip:10.1.1.0/24"}]}'

 I get the next IP in the range in the result:

{
    "_ref": "record:host/ZG5zLmhvc3QkLm5vbl9ETlNfaG9zdF9yb290LjAuMTQ5MzY2MTUwOTUwMi5teW5hbWU:myname/%20",
    "ipv4addrs": [
        {
            "_ref": "record:host_ipv4addr/ZG5zLmhvc3RfYWRkcmVzcyQubm9uX0ROU19ob3N0X3Jvb3QuMC4xNDkzNjYxNTA5NTAyLm15bmFtZS4xMC4xLjEuMTIu:10.1.1.12/myname/%20",
            "configure_for_dhcp": false,
            "host": "myname",
            "ipv4addr": "10.1.1.12"
        }
    ]
}


But in the GUI, 10.1.1.12 is still in an 'Unused' status, doesn't have a name at all, and generally just doesn't look different than any other IP in the range.  But every time I run the curl request, I get the next IP in the range, so the next time it would be 10.1.1.13.  Obviously something is changing under the hood, but it's not visible.  I got the command I'm running from cobbling together a lot of examples on the forums and this is the closest I've gotten to getting it to work.

 

What am I missing?  I was hoping by typing it out I would see something I missed, but I still don't see it!

 

FWIW, this will eventually be in PHP, but I'm just trying to get the basic curl request working for now.  Also, if it matters, we're only using Infoblox for an IPAM...not DHCP or DNS.

 

Thanks!

Blair

Re: assigning/reserving based on next_available_ip

Adviser
Posts: 96
2253     0

Works well for me, with the curl command you have provided:

 

curl -k -u admin:infoblox -H "Content-Type: application/json" -X POST 'https://192.168.0.12/wapi/v2.2/record:host?_return_fields=ipv4addrs' -d  '{"configure_for_dns":false, "name": "myname", "ipv4addrs":[{"ipv4addr":"func:nextavailableip:192.168.32.0/24"}]}'
{
    "_ref": "record:host/ZG5zLmhvc3QkLm5vbl9ETlNfaG9zdF9yb290LjAuMTQ5MzcwNTYzNjE4OC5teW5hbWU:myname/%20",
    "ipv4addrs": [
        {
            "_ref": "record:host_ipv4addr/ZG5zLmhvc3RfYWRkcmVzcyQubm9uX0ROU19ob3N0X3Jvb3QuMC4xNDkzNzA1NjM2MTg4Lm15bmFtZS4xOTIuMTY4LjMyLjEu:192.168.32.1/myname/%20",
            "configure_for_dhcp": false,
            "host": "myname",
            "ipv4addr": "192.168.32.1"
        }
    ]
}

 

Tested with NIOS 8.0.3.

Re: assigning/reserving based on next_available_ip

Authority
Posts: 31
2253     0

Thanks, SSieber.  I'm on version 7.3.6, so I guess I'll contact support and see if it's a known bug and if I should upgrade or if they know a way around it.

 

Thanks!

Blair

Showing results for 
Search instead for 
Do you mean 

Recommended for You

Businesses are investing heavily into securing company resources from cyber-attacks form cybercrimin