Next available ASN #6048

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

Originally created by @trrunde on GitHub (Feb 4, 2022).

Originally assigned to: @jeremystretch on GitHub.

NetBox version

v3.1.7

Feature type

New functionality

Proposed functionality

rfc6996 reserves a certain list of 16 / 32 bits asn for private asn. Simular as rfc1918 for ip-adresses.
https://datatracker.ietf.org/doc/html/rfc6996

Would it be possible to get a function for "get next available private asn" simular as we have next available ip, and next available prefix.

private asn's:
64512 - 65534
4200000000 - 4294967294

Use case

as an isp you could use this function to get available asn for corporate CE

in datacenter you could use this to get available asn to setup spine / leaf topology

Database changes

No response

External dependencies

No response

Originally created by @trrunde on GitHub (Feb 4, 2022). Originally assigned to: @jeremystretch on GitHub. ### NetBox version v3.1.7 ### Feature type New functionality ### Proposed functionality rfc6996 reserves a certain list of 16 / 32 bits asn for private asn. Simular as rfc1918 for ip-adresses. https://datatracker.ietf.org/doc/html/rfc6996 Would it be possible to get a function for "get next available private asn" simular as we have next available ip, and next available prefix. private asn's: 64512 - 65534 4200000000 - 4294967294 ### Use case as an isp you could use this function to get available asn for corporate CE in datacenter you could use this to get available asn to setup spine / leaf topology ### Database changes _No response_ ### External dependencies _No response_
adam added the status: acceptedtype: feature labels 2025-12-29 19:36:01 +01:00
adam closed this issue 2025-12-29 19:36:01 +01:00
Author
Owner

@jeremystretch commented on GitHub (Feb 4, 2022):

With the "next available" functionality for IP address and (in the upcoming v3.2 release) VLANs, NetBox references a parent prefix or group to determine the available range. So I think the first question here is, how would we want to define the available ranges?

Introducing a separate model for this purpose (e.g. ASNRange) seems bit overkill, but maybe not. Another option would be to (IMO reasonably) assume that only private AS numbers can be allocated automatically, and to allow the client to specify a starting and/or ending number.

@jeremystretch commented on GitHub (Feb 4, 2022): With the "next available" functionality for IP address and (in the upcoming v3.2 release) VLANs, NetBox references a parent prefix or group to determine the available range. So I think the first question here is, how would we want to define the available ranges? Introducing a separate model for this purpose (e.g. ASNRange) seems bit overkill, but maybe not. Another option would be to (IMO reasonably) assume that only private AS numbers can be allocated automatically, and to allow the client to specify a starting and/or ending number.
Author
Owner

@trrunde commented on GitHub (Feb 4, 2022):

I would assume that only private ASN can be automaticly allocated. If its a public asn that would have to be entered after getting the data from end customer.

@trrunde commented on GitHub (Feb 4, 2022): I would assume that only private ASN can be automaticly allocated. If its a public asn that would have to be entered after getting the data from end customer.
Author
Owner

@markkuleinio commented on GitHub (Feb 5, 2022):

I would very much need this in 3.2 👍😉

I'd say something like ASNRange would be needed because the user may have need for several ASN ranges for different purposes. As a user I could then tag different ASNRanges differently for my different uses.

For the reference, my current approach to allocating ASNs is to manually create tags like Metadata:ASNs:65100-65149, and my app would first fetch the tags starting with Metadata:ASNs: to get the desired ranges, then fetch all ASNs, and finally loop through them to find an available ASN to use. (These tags are actually not attached in the objects but used only to save this custom configuration data in NetBox and not in an external configuration file. I guess another option would be creating a plugin to save this and other app-specific configuration data in a custom table in the database, but tags will probably do for now.)

@markkuleinio commented on GitHub (Feb 5, 2022): I would very much need this in 3.2 👍😉 I'd say something like ASNRange would be needed because the user may have need for several ASN ranges for different purposes. As a user I could then tag different ASNRanges differently for my different uses. For the reference, my current approach to allocating ASNs is to manually create tags like `Metadata:ASNs:65100-65149`, and my app would first fetch the tags starting with `Metadata:ASNs:` to get the desired ranges, then fetch all ASNs, and finally loop through them to find an available ASN to use. (These tags are actually not attached in the objects but used only to save this custom configuration data in NetBox and not in an external configuration file. I guess another option would be creating a plugin to save this and other app-specific configuration data in a custom table in the database, but tags will probably do for now.)
Author
Owner

@kerryb48 commented on GitHub (Feb 24, 2022):

This is definitely one we need and would love to see added in the near future!

@kerryb48 commented on GitHub (Feb 24, 2022): This is definitely one we need and would love to see added in the near future!
Author
Owner

@brendanbowden commented on GitHub (Feb 24, 2022):

Another +1 to this one :)

I'm following a similar procedure to @markkuleinio using the netbox-bgp-plugin, where I pull all ASNs in a give range and loop through to find the first missing record. Something like @jeremystretch suggested to have the user specify start/end numbers in the API call would be plenty for my use case.

@brendanbowden commented on GitHub (Feb 24, 2022): Another +1 to this one :) I'm following a similar procedure to @markkuleinio using the netbox-bgp-plugin, where I pull all ASNs in a give range and loop through to find the first missing record. Something like @jeremystretch suggested to have the user specify start/end numbers in the API call would be plenty for my use case.
Author
Owner

@jeremystretch commented on GitHub (Feb 25, 2022):

Ok, so let's move this forward with the idea of introducing a new ASNRange model. Aside from a name and minimum & maximum AS number values, are there any other fields the model needs? How about tenancy assignment?

@jeremystretch commented on GitHub (Feb 25, 2022): Ok, so let's move this forward with the idea of introducing a new ASNRange model. Aside from a name and minimum & maximum AS number values, are there any other fields the model needs? How about tenancy assignment?
Author
Owner

@markkuleinio commented on GitHub (Feb 28, 2022):

I'd say tenancy and tags are the ones that I would use.

@markkuleinio commented on GitHub (Feb 28, 2022): I'd say tenancy and tags are the ones that I would use.
Author
Owner

@ITJamie commented on GitHub (Jan 12, 2023):

This topic came up recently internally.

It would be nice to be able to scope private ASNRanges for particular tenants or uses.
When using the proposed "next available asn" it would be excellent if there was some consideration of the tenant or even site/region asn ranges?

@ITJamie commented on GitHub (Jan 12, 2023): This topic came up recently internally. It would be nice to be able to scope private ASNRanges for particular tenants or uses. When using the proposed "next available asn" it would be excellent if there was some consideration of the tenant or even site/region asn ranges?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#6048