Reply

Best Practice for Reserving IP Address?

CStover
Techie
Posts: 1
26351     0

Hello,
I want to use the REST API to get an IP address from a particular network in Infoblox during my server build process.  I'm looking for some guidance and best practices in terms of how to go about this:
 - I'm able to get the next IP from a particular network with the next_available_ip function; however, once I have this IP, what's the best way to reserve it in Infoblox?  From what I've seen in the API documentation, I think there are two ways:
  -- DHCP reservation of the IP address to the specific MAC address of the machine
  -- Create DNS records for the server; although, does this reserve the IP in Infoblox so it can't be assigned again?
 - I planned on creating the DNS records through PowerShell WMI calls, but I discovered this can be done through Infoblox.  Any suggestions as to which would be better or pros/cons for each option?

Thank you in advance for your assistance.

Chris

Best Practice for Reserving IP Address

Adviser
Posts: 213
26351     0

You're welcome to run through the Powershell script calls but since you're already "in" the API for Infoblox, I would recommend just reserving the IP by creating a HOST object.  That removes the IP from the "next available" function AND it gets the DNS record published as part of the reservation/provisioning process.

It depends on how long you

GHorne Community Manager
Community Manager
Posts: 254
26351     0

It depends on how long you want to reserve the IP address for. As don says you can ust create the HOST and the delete it later if you don't need it. Or you can created a Reservation, that will also lock the IP address.

If you just want to avoid race conditions with multiple users requesting addreses and creating hosts, as of WAPI 1.2.1 you can now embed the next_ip function in the host creation:

curl -k3 -u admin:infoblox -X POST https://192.168.1.2/wapi/v1.4/record:a -H "Content-Type: application/json" -d '{"name": "b1.foo.com", "ipv4addr": "func:nextavailableip:200.0.0.0/24"}'

You can do this for Hosts or Fixed addresses. And there 4 possible ways to provide "fund:nextavailableip" for your reference.

        • func:nextavailableip:network/ZG54dfgsrDFEFfsfsLzA:10.0.0.0/8/default
        • func:nextavailableip:10.0.0.0/8
        • func:nextavailableip:10.0.0.0/8,external
        • func:nextavailableip:10.0.0.3-10.0.0.10

 

 

Example on how to reserve an IP address

BEpstein
Techie
Posts: 2
26351     0
When we created our networks, we didn't have a good template in place to reserve the first 8 addresses. Now we are trying to figure out a way to programmatically retro fit this template onto our networks. We'd rather not recreate them all. I looked in ibcli to see if it had something, but according to https://github.com/slchorne/ibcli/blob/master/TODO, this is a feature that hasn't been implemented. I'm looking through the Perl API, and I see that you can do an IPAM get type https://ipam.illinois.edu/api/doc/Infoblox/IPAM/Address.html, but I don't see how to set the type. I haven't been able to find any example code for this either. In the Infoblox GUI, I can set an IP to Reserved by going through the IPAM menu, drilling down to the IP address, and then adding a reservation. Is this possible through the Perl or WAPI? If so, can you give some demo code hints? Smiley Happy Thanks, ep

RE: Example on how to reserve an IP address

CCox
Techie
Posts: 14
26351     0

I think that you should look through the examples here:

https://ipam.illinois.edu/api/doc/Infoblox/DHCP/Range.html

From my understanding a reserved range is just a range that isn't assigned to DHCP servers.

I am sure there is many ways to update this, but if I were to do it I would create a CSV and import it:

Header-ReservedRange,start_address,end_address
ReservedRange,10.0.0.1,10.0.0.8

You could probably do a cursor through your networks or even pull a csv of your networks and then add +1 and +8 for all of the values to generate the csv file.

Thanks!

Craig

 

 

Question about this from your

JLeveillee
Techie
Posts: 13
26351     0

Question about this from your message:


You can do this for Hosts or Fixed addresses. And there 4 possible ways to provide "fund:nextavailableip" for your reference.

        • func:nextavailableip:network/ZG54dfgsrDFEFfsfsLzA:10.0.0.0/8/default
        • func:nextavailableip:10.0.0.0/8
        • func:nextavailableip:10.0.0.0/8,external
        • func:nextavailableip:10.0.0.3-10.0.0.10


Is there a way to do this with a DHCP Range?  We'd like to add a fixed address within a range at the next available IP in the range.  These functions seem to only work with a network!!

Thanks!

--jerry

Re: It depends on how long you

tswain
Techie
Posts: 1
26351     0

i tried  to use func:nextavailableip:10.0.0.3-10.0.0.10 , it is not working .  it says oes not match any unique networks/ranges

 

 

curl -k3 --insecure   -u userSmiley Tongueassword -X POST https://testinfoblox/wapi/v2.2.2/record:a -H "Content-Type: pplication/json" -d '{"name": "hostname", "ipv4addr": "func:nextavailableip:'192.128.44.10-192.128.44.50'"}'
{ "Error": "AdmConProtoError: 192.128.44.10-192.128.44.50 does not match any unique networks/ranges (ipv4addr)",
  "code": "Client.Ibap.Proto",
  "text": "192.128.44.10-192.128.44.50 does not match any unique networks/ranges (ipv4addr)"

Highlighted

Re: It depends on how long you

kenmaglio
Techie
Posts: 4
26351     0

We are having the the same problem, we can do the function with   10.0.0.0/24  like your example, however specifying a range resulting in the same error you have.

 

Did you ever find a solution?

Re: It depends on how long you

GHorne Community Manager
Community Manager
Posts: 254
26352     0

You can't get the next available address from within a DHCP range, because all the those addresses are marked as 'used'

 

The 'N-N' syntax is to get an address from a specific range of addresses, not a dhcp range per-se. it is just a convenient way to filter the results to skip some free addresses.

 

Thus if you have a DHCP range from 10.0.0.30-10-0.0.150 in 10.0.0.0/24.

Then the request 'func:nextavailableip:10.0.0.10-10.0.0.50' is valid,

However it can only return free addresses from 10-29 as 30-50 are already used.

 

As always - CHECK THE ERROR MESSAGE, this sometimes helps

Re: It depends on how long you

kenmaglio
Techie
Posts: 4
26352     0

So actually we already thought of this, and we even added an exclusion range -- so that those IP's do NOT show as Used -- they are "free" just like others. -- However yes in the network there is a DHCP range - but it is no longer overlapping or interferring with this range.

 

Still no dice

 

So I went a different way, and we have in our templates a reserved range, for these "auto-selected" ip's I want to automate creating a host..  so I found the range using   /range?network~=10.10.10.0  ( as we use /23 and /24 networks and can't determine that ahead of tiem)  and   &comment~=WACKY  (whatever word is in your range comment you want to filter on).  

 

Then using the reference of the Range object  range/________   I fed that into  nextavailableip:range/____

and it's working!!!

 

Re: Best Practice for Reserving IP Address?

[ Edited ]
karywinters
Techie
Posts: 2
26352     0

Hey. I suggest just reserving the IP by creating a HOST object. I also recommend using VPN to save your personal data. However, I know how to do homework fast. I know everything little by little.

Re: Best Practice for Reserving IP Address?

joshi
Techie
Posts: 1
26352     0

I am not able to find the page from where i can post my question......can someone please reply ...

and my question is ........

i have written one rest call to get free ip address from Infoblox which works fine in my system but if i use try to run the page from some other system it wont work......code is written in sharepoint site which works fine for me and i m able to get the output but not working for others

Showing results for 
Search instead for 
Do you mean 

Recommended for You