Reply

Simultaneous requests for next available IP

Member
Posts: 1
3137     0

We've built a service that uses the Infoblox REST APIs to request the next available IP in a specified subnet. If we run multiple instances of the service in a highly-available configuration, it's conceivable that two requests from two instances of the service (running on different servers) could hit Infoblox "at the same time" with identical looking requests (give me next available IP in same subnet).

 

Can Infoblox handle this correctly?

Re: Simultaneous requests for next available IP

Community Manager
Community Manager
Posts: 248
3138     0

The short answer is 'first write wins'.

 

There is also no restriction on multiple hostnames sharing the same IP address.

 

So yes, there could be confilicts and you can either get errors like 'host already exists' or just multiple hostnames with the same address.

 

However, the workaround is to ask for the next available address at the same time as you create the record.

 

POST /wapi/v1.2/record:host
 Content-Type: application/json

    { "name":"wapi.test.org",
      "ipv4addrs":[
          {
             "ipv4addr":"func:nextavailableip:10.1.1.0/24"
          }
        ]
    }

If you do that you avoid most of the race conditions, and every request to create a record will get a different address.

 

If you just want a list of the next batch of free addresses however, all bets are off, you will just get the state at the time of the request. (and the longer you wait to use one of those addresses, the more chance it gets taken by someone else). To workaround out that you have to hand code a reservation system (and matching garbage collection when someone doesn't decide to use an address or their client dies mid process)

 

 

Showing results for 
Search instead for 
Did you mean: 

Recommended for You