Availables IP includes Broadcast and subnets IP when an slot is left available between two assignation #3728

Closed
opened 2025-12-29 18:30:48 +01:00 by adam · 4 comments
Owner

Originally created by @jorgeNeutrona on GitHub (May 26, 2020).

Environment

  • Python version: 3.6
  • NetBox version: 28011873b3d2 (v2.8.4) (Docker)

Steps to Reproduce

Add a prefix /24 192.168.0.0/24 (active/is_pool = false)
create 1/30
create 2/30
Add a prefix /30 192.168.0.4/30 (active/is_pool = false)
create 5/30
create 6/30
keep next slot available
Add a prefix /30 192.168.0.12/30 (active/is_pool = false)
create 13/30
create 14/30

Create mssing prefix 192.168.0.8/30
create 9/30
create 10/30

12/30 is taken as available IP (NETWORK)
8/30 is taken as available IP (SUBNET)

So the global calculation is wrong.

Real Case: (tab IP address)

  IP Address VRF Status Role Tenant Parent Interface DNS Name Description
  12 IPs available Global Available
  162.251.216.13/30 Global Active
  162.251.216.14/30 Global Active
  2 IPs available Global Available — (this ip should not be taken as available.
  162.251.216.17/29 Global Active
  162.251.216.18/29 Global Active
  162.251.216.19/29 Global Active
  162.251.216.20/29 Global Active

Expected Behavior

For calculation of utilization shoud not be taken into account broadcast IP of a subnet

Observed Behavior

If the subnet is set as a is_pool = true and set /30 broadcast and network as used, the problem is solved.

Originally created by @jorgeNeutrona on GitHub (May 26, 2020). ### Environment * Python version: 3.6 * NetBox version: 28011873b3d2 (v2.8.4) (Docker) <!-- When a slot for assignation is left available between two assigments, broadcast and subnet are counted as available IPs. --> ### Steps to Reproduce Add a prefix /24 192.168.0.0/24 (active/is_pool = false) create 1/30 create 2/30 Add a prefix /30 192.168.0.4/30 (active/is_pool = false) create 5/30 create 6/30 keep next slot available Add a prefix /30 192.168.0.12/30 (active/is_pool = false) create 13/30 create 14/30 Create mssing prefix 192.168.0.8/30 create 9/30 create 10/30 12/30 is taken as available IP (NETWORK) 8/30 is taken as available IP (SUBNET) So the global calculation is wrong. Real Case: (tab IP address)   | IP Address | VRF | Status | Role | Tenant | Parent | Interface | DNS Name | Description -- | -- | -- | -- | -- | -- | -- | -- | -- | --   | 12 IPs available | Global | Available | — | — | — | — | — | —   | 162.251.216.13/30 | Global | Active | — | — | — | — | — | —   | 162.251.216.14/30 | Global | Active | — | — | — | — | — | —   | 2 IPs available | Global | Available | — | — | — | — | — | — (this ip should not be taken as available.   | 162.251.216.17/29 | Global | Active | — | — | — | — | — | —   | 162.251.216.18/29 | Global | Active | — | — | — | — | — | —   | 162.251.216.19/29 | Global | Active | — | — | — | — | — | —   | 162.251.216.20/29 | Global | Active | — | — | — | — | — | — ## Expected Behavior For calculation of utilization shoud not be taken into account broadcast IP of a subnet ### Observed Behavior If the subnet is set as a is_pool = true and set /30 broadcast and network as used, the problem is solved.
adam added the pending closure label 2025-12-29 18:30:48 +01:00
adam closed this issue 2025-12-29 18:30:48 +01:00
Author
Owner

@DanSheps commented on GitHub (May 26, 2020):

Are you looking at this from the /24 prefix view? If so, this is not unexpected as you are looking at a /24 and not a /30 and in a /24 the network and broadcasts of a prefix would in theory be available.

We could in theory add logic to check and see if there are child prefixes and automatically mark them as reserved in the IP table, however that might not be what people are looking for and it would add some substantial logic to the ip address table.

@DanSheps commented on GitHub (May 26, 2020): Are you looking at this from the /24 prefix view? If so, this is not unexpected as you are looking at a /24 and not a /30 and in a /24 the network and broadcasts of a prefix would in theory be available. We could in theory add logic to check and see if there are child prefixes and automatically mark them as reserved in the IP table, however that might not be what people are looking for and it would add some substantial logic to the ip address table.
Author
Owner

@jorgeNeutrona commented on GitHub (May 26, 2020):

Are you looking at this from the /24 prefix view? If so, this is not unexpected as you are looking at a /24 and not a /30 and in a /24 the network and broadcasts of a prefix would in theory be available.

We could in theory add logic to check and see if there are child prefixes and automatically mark them as reserved in the IP table, however that might not be what people are looking for and it would add some substantial logic to the ip address table.

The problem behind this is that general utilization of the prefix is based on total amount of free availables IP whether are broacast or network IPs. So the value in % percentage could change.

Inside a prefix broadcast and network should not be taken as available except for /31. When is_pool is false, Netbox shoul exclude or mark those ip as not valid for the global counter.

For example I have a public ASN Subnet /22 to retrieve the % utilization y should mark is_pool to the /22 and each /24 or /23 and all subprefix to be able to report the correct % of utilization.

The logic should be attached to is_pool true/false. if false, networks and broadcast should not be taken into account for global prefix count or similar.

I have opened other issue while investigation this one.

phpIPAM uses an option called, mark as full in which no matter the ip inside a subnet are created or not, for the glocal accounting the subnet is full. May be the trick is that just add extra parameter when the prefix is created to mark then as full.

thanks

@jorgeNeutrona commented on GitHub (May 26, 2020): > Are you looking at this from the /24 prefix view? If so, this is not unexpected as you are looking at a /24 and not a /30 and in a /24 the network and broadcasts of a prefix would in theory be available. > > We could in theory add logic to check and see if there are child prefixes and automatically mark them as reserved in the IP table, however that might not be what people are looking for and it would add some substantial logic to the ip address table. The problem behind this is that general utilization of the prefix is based on total amount of free availables IP whether are broacast or network IPs. So the value in % percentage could change. Inside a prefix broadcast and network should not be taken as available except for /31. When is_pool is false, Netbox shoul exclude or mark those ip as not valid for the global counter. For example I have a public ASN Subnet /22 to retrieve the % utilization y should mark is_pool to the /22 and each /24 or /23 and all subprefix to be able to report the correct % of utilization. The logic should be attached to is_pool true/false. if false, networks and broadcast should not be taken into account for global prefix count or similar. I have opened other issue while investigation this one. phpIPAM uses an option called, mark as full in which no matter the ip inside a subnet are created or not, for the glocal accounting the subnet is full. May be the trick is that just add extra parameter when the prefix is created to mark then as full. thanks
Author
Owner

@stale[bot] commented on GitHub (Jun 9, 2020):

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. NetBox is governed by a small group of core maintainers which means not all opened issues may receive direct feedback. Please see our contributing guide.

@stale[bot] commented on GitHub (Jun 9, 2020): This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. NetBox is governed by a small group of core maintainers which means not all opened issues may receive direct feedback. Please see our [contributing guide](https://github.com/netbox-community/netbox/blob/develop/CONTRIBUTING.md).
Author
Owner

@stale[bot] commented on GitHub (Jun 16, 2020):

This issue has been automatically closed due to lack of activity. In an effort to reduce noise, please do not comment any further. Note that the core maintainers may elect to reopen this issue at a later date if deemed necessary.

@stale[bot] commented on GitHub (Jun 16, 2020): This issue has been automatically closed due to lack of activity. In an effort to reduce noise, please do not comment any further. Note that the core maintainers may elect to reopen this issue at a later date if deemed necessary.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#3728