Allow /32 (v4) and /128 (v6) prefixes #731

Closed
opened 2025-12-29 16:25:12 +01:00 by adam · 8 comments
Owner

Originally created by @asenci on GitHub (Feb 28, 2017).

Is there any specific reason why Netbox won't allow /32 and /128 prefixes?
As far as I can tell from looking at the code, allowing ir would not have any impact on the project, also the test code do not cover this.

The use case for this would be to allocate prefixes for customers point-to-point links and loopback/anycast addresses.

Originally created by @asenci on GitHub (Feb 28, 2017). Is there any specific reason why Netbox won't allow /32 and /128 prefixes? As far as I can tell from looking at the code, allowing ir would not have any impact on the project, also the test code do not cover this. The use case for this would be to allocate prefixes for customers point-to-point links and loopback/anycast addresses.
adam closed this issue 2025-12-29 16:25:12 +01:00
Author
Owner

@th3goose commented on GitHub (Feb 28, 2017):

I would think the /31 and /127 would be more the prefix, and the /32 /128 would be more the ip on the interfaces.

@th3goose commented on GitHub (Feb 28, 2017): I would think the /31 and /127 would be more the prefix, and the /32 /128 would be more the ip on the interfaces.
Author
Owner

@jeremystretch commented on GitHub (Feb 28, 2017):

Yep. In NetBox, /32s and /128s are modeled only IP addresses, so that they can be assigned to interfaces.

@jeremystretch commented on GitHub (Feb 28, 2017): Yep. In NetBox, /32s and /128s are modeled only IP addresses, so that they can be assigned to interfaces.
Author
Owner

@asenci commented on GitHub (Feb 28, 2017):

But that would not be accurate, would it?

The /32 address in this case is not part of a larger prefix, it is the prefix on its own.
Using /31's would not match the routing database, not to mention you can have a point-to-point link with IP addresses further apart then a /31.
Remote access concentrators will typically use the same IP address on all the point-to-point interfaces for example.

@asenci commented on GitHub (Feb 28, 2017): But that would not be accurate, would it? The /32 address in this case is not part of a larger prefix, it is the prefix on its own. Using /31's would not match the routing database, not to mention you can have a point-to-point link with IP addresses further apart then a /31. Remote access concentrators will typically use the same IP address on all the point-to-point interfaces for example.
Author
Owner

@jeremystretch commented on GitHub (Feb 28, 2017):

@asceni The /32 is both a prefix and an IP address. Semantics aside, it is modeled as an IP address in NetBox. Modeling a /32 as a prefix would require NetBox to support assigning IP addresses and prefixes (but only /32s and /128s) to interfaces, which would be needlessly complex. Further, replicating a routing table is not NetBox's intended function; modeling the assignment of IP addresses to interfaces is.

@jeremystretch commented on GitHub (Feb 28, 2017): @asceni The /32 is both a prefix and an IP address. Semantics aside, it is modeled as an IP address in NetBox. Modeling a /32 as a prefix would require NetBox to support assigning IP addresses _and_ prefixes (but only /32s and /128s) to interfaces, which would be needlessly complex. Further, replicating a routing table is not NetBox's intended function; modeling the assignment of IP addresses to interfaces is.
Author
Owner

@asenci commented on GitHub (Feb 28, 2017):

Hi @jeremystretch, just did a few test on my dev environment.
By simply removing the prefix size check on the "clean" method of the "Prefix" class, I was able to create a /32 prefix and then a /32 IP address inside that prefix.
Everything worked as expected, so I see no need to assign a prefix to the device interface.

@asenci commented on GitHub (Feb 28, 2017): Hi @jeremystretch, just did a few test on my dev environment. By simply removing the prefix size check on the "clean" method of the "Prefix" class, I was able to create a /32 prefix and then a /32 IP address inside that prefix. Everything worked as expected, so I see no need to assign a prefix to the device interface.
Author
Owner

@goallight commented on GitHub (Nov 13, 2017):

I am running into this issue as well while trying to port over my old IPAM system. My old system allowed for /32 prefix to be assigned to individual customers so I need these to show as not available. I am new to netbox but like it a lot so far. Maybe I am missing it, but where is the setting to verify size check on prefix length?

@goallight commented on GitHub (Nov 13, 2017): I am running into this issue as well while trying to port over my old IPAM system. My old system allowed for /32 prefix to be assigned to individual customers so I need these to show as not available. I am new to netbox but like it a lot so far. Maybe I am missing it, but where is the setting to verify size check on prefix length?
Author
Owner

@asenci commented on GitHub (Nov 13, 2017):

Hi @goallight,

If you really need it, you might want to take a look at this commit:
30aa83025d

Please note I haven't look into it since earlier this year, so I am not sure how it would affect the newer versions.

@asenci commented on GitHub (Nov 13, 2017): Hi @goallight, If you really need it, you might want to take a look at this commit: https://github.com/asenci/netbox/commit/30aa83025d475be7e2603cff103bb31f18260ccf Please note I haven't look into it since earlier this year, so I am not sure how it would affect the newer versions.
Author
Owner

@goallight commented on GitHub (Nov 14, 2017):

Thanks! This worked exactly as I needed

@goallight commented on GitHub (Nov 14, 2017): Thanks! This worked exactly as I needed
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#731