ip space / pools #597

Closed
opened 2025-12-29 16:23:40 +01:00 by adam · 4 comments
Owner

Originally created by @moolinet on GitHub (Jan 2, 2017).

would it be possible to add a IP/prefix pool feature?

here's how I see this could be used:

admin: create a pool

  • define size of pool item (/32 for fixed ip or any other prefix length)
  • assign one or more IP ranges (prefixes) to the pool from which items can be requested
  • assign a role to the pool (infrastructure, dhcp, nat, ssl, etc..)

user: request an IP/prefix

  • choose an IP / prefix length
  • choose a role
  • provide description

ipspace/pool module:

  • pick the next free IP/prefix available from the pool matching prefix length and role and assign it
  • calculate the usage of a pool and send a notification when it reaches a certain threshold (80%?)

if the request mechanism is available via api then it will become very easy to script IP assignation without having to search through the whole ip space.

we could use the new 'is_pool' prefix type to mark prefixes used in pools

Thanks,

Originally created by @moolinet on GitHub (Jan 2, 2017). would it be possible to add a IP/prefix pool feature? here's how I see this could be used: admin: create a pool - define size of pool item (/32 for fixed ip or any other prefix length) - assign one or more IP ranges (prefixes) to the pool from which items can be requested - assign a role to the pool (infrastructure, dhcp, nat, ssl, etc..) user: request an IP/prefix - choose an IP / prefix length - choose a role - provide description ipspace/pool module: - pick the next free IP/prefix available from the pool matching prefix length and role and assign it - calculate the usage of a pool and send a notification when it reaches a certain threshold (80%?) if the request mechanism is available via api then it will become very easy to script IP assignation without having to search through the whole ip space. we could use the new 'is_pool' prefix type to mark prefixes used in pools Thanks,
adam closed this issue 2025-12-29 16:23:40 +01:00
Author
Owner

@jeremystretch commented on GitHub (Jan 3, 2017):

NetBox already has the ability to track pools of IP addresses, by creating IP addresses with the "DHCP pool" status. A pool must be defined as a set of IP addresses, because a pool is not necessarily bound to prefix size (e.g. you can create a pool of .10 through .100 inside a /24). Release 1.8.0 will support wildcard expansion during the creation of IP addresses to make this approach more practical.

Any interaction beyond what's currently supported will need to be accomplished via some external component; I want to avoid NetBox functioning as any sort of brokerage system. Once the API has been made fully writeable (#113) this should be much easier to accomplish.

Does this address your suggestion?

@jeremystretch commented on GitHub (Jan 3, 2017): NetBox already has the ability to track pools of IP addresses, by creating IP addresses with the "DHCP pool" status. A pool must be defined as a set of IP addresses, because a pool is not necessarily bound to prefix size (e.g. you can create a pool of .10 through .100 inside a /24). Release 1.8.0 will support wildcard expansion during the creation of IP addresses to make this approach more practical. Any interaction beyond what's currently supported will need to be accomplished via some external component; I want to avoid NetBox functioning as any sort of brokerage system. Once the API has been made fully writeable (#113) this should be much easier to accomplish. Does this address your suggestion?
Author
Owner

@moolinet commented on GitHub (Jan 3, 2017):

Hi

I had to play a bit more with NetBox to understand how to DHCP pool
currently works.
(using the v1.7.3 docker version as a sandbox)

First:

  • create a few IPs with DHCP status
  • created a new device.

At this point I have 2 choices:

  1. edit device and add IP address manually (the IP address needs to be
    looked up and reserved separately)
  2. go to IP addresses listings, find a DHCP marked IP address, select
    it and assign it to the device

My suggestion is aiming at providing the following workflow:

  • add new device
  • add new IP address : choose a pool fitting the role/site/etc..
    -> the next available IP is assigned out of the pool
    Is this what you mean by brokerage system?

As the input and the output remains within NetBox I believe it would be
useful.
Once the new write API is available this could be done via external
scripts but we'd loose the benefit of the web interface.

It also helps to separate roles (IP resources provider and IP resources
consumer)
This way you could imagine an external script doing VM provisioning:
simply request an IP from a VM pool.

So I tried to play a bit more with custom fields:
By adding two fields: "pool" (text or selection) and "pool-assigned"
(boolean)
I can reproduce the structure suggested above but without the intelligence.
Prepopulate the database with IP addresses having the DHCP status and
assign them a pool and pool-assigned as false.
Via API it would be possible to retrieve information about IP addresses
belonging to a "pool"
and then calculate out the next available IP address and make callback
to the API to assign the IP (pool-assigned=true)

My suggestion was going a bit further:
If we can define a pool of /32s, then we could as well define a pool of /27s
In this case instead of filling the pool with a range of IPs (.10 to .100)
We'd choose some bigger ranges for example out of which we can pick /27
prefixes.

So in the end:
If the purpose is to use the NetBox web interface to manage the
different resources then it would make sense to implement the suggestion.
If practice shows that users prefer to use the API around the NetBox
data structure then it's not needed.
This is something I was badly missing in phpipam, and that exists in nipap.
Having something similar in NetBox would really bring the DCIM and the
IPAM part together in my point of view.

I hope this makes my suggestion clearer.
I guess if other users also see the benefit then they should voice their
interest.

Thanks

On 03.01.2017 16:21, Jeremy Stretch wrote:

NetBox already has the ability to track pools of IP addresses, by
creating IP addresses with the "DHCP pool" status. A pool must be
defined as a set of IP addresses, because a pool is not necessarily
bound to prefix size (e.g. you can create a pool of .10 through .100
inside a /24). Release 1.8.0 will support wildcard expansion during
the creation of IP addresses to make this approach more practical.

Any interaction beyond what's currently supported will need to be
accomplished via some external component; I want to avoid NetBox
functioning as any sort of brokerage system. Once the API has been
made fully writeable (#113
https://github.com/digitalocean/netbox/issues/113) this should be
much easier to accomplish.

Does this address your suggestion?


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/digitalocean/netbox/issues/761#issuecomment-270138061,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AXue71vz5-RPJM1QTTm4iEZChDLKIsrvks5rOmeWgaJpZM4LZH2l.

@moolinet commented on GitHub (Jan 3, 2017): Hi I had to play a bit more with NetBox to understand how to DHCP pool currently works. (using the v1.7.3 docker version as a sandbox) First: - create a few IPs with DHCP status - created a new device. At this point I have 2 choices: 1. edit device and add IP address manually (the IP address needs to be looked up and reserved separately) 2. go to IP addresses listings, find a DHCP marked IP address, select it and assign it to the device My suggestion is aiming at providing the following workflow: - add new device - add new IP address : choose a pool fitting the role/site/etc.. -> the next available IP is assigned out of the pool Is this what you mean by brokerage system? As the input and the output remains within NetBox I believe it would be useful. Once the new write API is available this could be done via external scripts but we'd loose the benefit of the web interface. It also helps to separate roles (IP resources provider and IP resources consumer) This way you could imagine an external script doing VM provisioning: simply request an IP from a VM pool. So I tried to play a bit more with custom fields: By adding two fields: "pool" (text or selection) and "pool-assigned" (boolean) I can reproduce the structure suggested above but without the intelligence. Prepopulate the database with IP addresses having the DHCP status and assign them a pool and pool-assigned as false. Via API it would be possible to retrieve information about IP addresses belonging to a "pool" and then calculate out the next available IP address and make callback to the API to assign the IP (pool-assigned=true) My suggestion was going a bit further: If we can define a pool of /32s, then we could as well define a pool of /27s In this case instead of filling the pool with a range of IPs (.10 to .100) We'd choose some bigger ranges for example out of which we can pick /27 prefixes. So in the end: If the purpose is to use the NetBox web interface to manage the different resources then it would make sense to implement the suggestion. If practice shows that users prefer to use the API around the NetBox data structure then it's not needed. This is something I was badly missing in phpipam, and that exists in nipap. Having something similar in NetBox would really bring the DCIM and the IPAM part together in my point of view. I hope this makes my suggestion clearer. I guess if other users also see the benefit then they should voice their interest. Thanks On 03.01.2017 16:21, Jeremy Stretch wrote: > > NetBox already has the ability to track pools of IP addresses, by > creating IP addresses with the "DHCP pool" status. A pool must be > defined as a set of IP addresses, because a pool is not necessarily > bound to prefix size (e.g. you can create a pool of .10 through .100 > inside a /24). Release 1.8.0 will support wildcard expansion during > the creation of IP addresses to make this approach more practical. > > Any interaction beyond what's currently supported will need to be > accomplished via some external component; I want to avoid NetBox > functioning as any sort of brokerage system. Once the API has been > made fully writeable (#113 > <https://github.com/digitalocean/netbox/issues/113>) this should be > much easier to accomplish. > > Does this address your suggestion? > > — > You are receiving this because you authored the thread. > Reply to this email directly, view it on GitHub > <https://github.com/digitalocean/netbox/issues/761#issuecomment-270138061>, > or mute the thread > <https://github.com/notifications/unsubscribe-auth/AXue71vz5-RPJM1QTTm4iEZChDLKIsrvks5rOmeWgaJpZM4LZH2l>. >
Author
Owner

@jeremystretch commented on GitHub (Jan 3, 2017):

It sounds like you're conflating at least two ideas. The first is the creation of DHCP pools in NetBox. As explained, this is done by creating the desired number of IP addresses with a status of "DHCP." It is not done with prefixes because a pool does not typically comprise an entire prefix; rather, they are of arbitrary size within a prefix (e.g. 200 IPs out of a /24).

The other concept is the assignment of an available IP address from a pool. I invite you to read through #665 where this was discussed at length. I'm going to close this issue out as I believe what you're suggesting has already been proposed.

@jeremystretch commented on GitHub (Jan 3, 2017): It sounds like you're conflating at least two ideas. The first is the creation of DHCP pools in NetBox. As explained, this is done by creating the desired number of IP addresses with a status of "DHCP." It is not done with prefixes because a pool does not typically comprise an entire prefix; rather, they are of arbitrary size within a prefix (e.g. 200 IPs out of a /24). The other concept is the assignment of an available IP address from a pool. I invite you to read through #665 where this was discussed at length. I'm going to close this issue out as I believe what you're suggesting has already been proposed.
Author
Owner

@mickaelmonsieur commented on GitHub (Feb 27, 2017):

Hello moolinet,
I have the same problem as you.
I have a block 91.xxx.41.32/27 allocated for my VM and I try to be able to use the API to request an IP and assign it to a device (new VM)
For the moment, I do not see how to do because I only see GET methods in the REST API.
Or go through the PostGres database but it's not the goal when you have an API. 👎

@mickaelmonsieur commented on GitHub (Feb 27, 2017): Hello moolinet, I have the same problem as you. I have a block 91.xxx.41.32/27 allocated for my VM and I try to be able to use the API to request an IP and assign it to a device (new VM) For the moment, I do not see how to do because I only see GET methods in the REST API. Or go through the PostGres database but it's not the goal when you have an API. 👎
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#597