# How does the IP Allocator work

The **IP Allocator** (the NSO Resource Manager *IP Address Allocator*) assigns **IPv4 or IPv6 subnets/addresses** from configured pools, and keeps the allocation lifecycle in NSO.

## 1) You define what can be allocated (IP pools)

Create a pool under `/resource-pools/ip-address-pool/<pool>` and add:

* **subnets** (network + CIDR mask)
* and/or **IP ranges**
* plus optional **exclude** subnets/ranges (values there are not available)

Example CLI-style pool setup is shown in [IP Address Allocator](/resources/platform-tools/resource-manager/ip-allocator.md).

You can also choose the **allocation method** (e.g. `firstfree` vs `sequential`) at the pool level.

## 2) A service (or admin) creates an allocation request

When an allocation request is created, Resource Manager’s allocation engine:

* allocates a subnet of the requested size (or finds a matching available subnet),
* then writes the result into the allocation **response**.

In [IP Address Allocator](/resources/platform-tools/resource-manager/ip-allocator.md), the CLI allocates via the `/resource-pools/find-ip` action; if `allocate` is set it is persisted right away, otherwise it only returns a free candidate.

## 3) The allocator updates response and redeploys owners

The IP allocator application maintains state and subscribes to changes in the pool and allocation request tree (pool/subnets/excludes/ranges/allocation). On a new allocation request, it:

* allocates from the pool instance,
* writes **`ok`** (with `subnet` and `from`) or **`error`** (with an error message),
* and triggers **redeploy** for services listed in `allocating-service`.\
  See the behavior described in [Resource Manager (4.x)](/resources/platform-tools/resource-manager-4.md#nso-ip-address-allocator-deployment).

## 4) Deallocation happens by deleting the allocation request

When the `allocation` entry is removed, the allocated resource is released back to the pool (and can be reused depending on allocation method).

# Suggested Follow-up Questions:

If you need more information, consider asking one of these follow-up questions by performing an HTTP GET request on the URL:

- [How pools get excluded ranges?](https://nso-docs.cisco.com?ask=How%20pools%20get%20excluded%20ranges%3F)
- [What happens on pool exhaustion?](https://nso-docs.cisco.com?ask=What%20happens%20on%20pool%20exhaustion%3F)
- [How to allocate specific IP via API?](https://nso-docs.cisco.com?ask=How%20to%20allocate%20specific%20IP%20via%20API%3F)

# Sources:

- [IP Address Allocator](https://nso-docs.cisco.com/resources/platform-tools/resource-manager/ip-allocator.md)
- [Resource Manager (4.x)](https://nso-docs.cisco.com/resources/platform-tools/resource-manager-4.md)
- [ID Allocator](https://nso-docs.cisco.com/resources/platform-tools/resource-manager/id-allocator.md)
- [Resource Manager API Guide (4.x)](https://nso-docs.cisco.com/resources/platform-tools/resource-manager-4/resource-manager-api-guide.md)
- [Upgrade from 4.x](https://nso-docs.cisco.com/resources/platform-tools/resource-manager/upgrade-from-4x.md)
- [Resource Manager (5.1)](https://nso-docs.cisco.com/resources/platform-tools/resource-manager.md)
- [README-ned-settings](https://nso-docs.cisco.com/neds/cisco-provided-neds/onf-tapi_rc/readme-ned-settings.md)
- [Nano Services](https://nso-docs.cisco.com/guides/nso-6.1/development/core-concepts/nano-services.md)

