Allow duplicate ASNs in different RIRs #7274

Closed
opened 2025-12-29 20:21:06 +01:00 by adam · 8 comments
Owner

Originally created by @zacho112 on GitHub (Nov 23, 2022).

NetBox version

v3.3.8

Feature type

Change to existing functionality

Proposed functionality

Allow duplicate ASN's if in different RIR's.

Today Netbox fails with ASN with this ASN already exists.

Use case

If you for some reason uses the same private AS numbers across your infrastructure, it would be nice to be able to document them i Netbox. This is not possible today, because you're not allowed to have duplicate ASN's, even if the RIR's is set to Private.

Database changes

No response

External dependencies

No response

Originally created by @zacho112 on GitHub (Nov 23, 2022). ### NetBox version v3.3.8 ### Feature type Change to existing functionality ### Proposed functionality Allow duplicate ASN's if in different RIR's. Today Netbox fails with `ASN with this ASN already exists.` ### Use case If you for some reason uses the same private AS numbers across your infrastructure, it would be nice to be able to document them i Netbox. This is not possible today, because you're not allowed to have duplicate ASN's, even if the RIR's is set to Private. ### Database changes _No response_ ### External dependencies _No response_
adam added the type: featurepending closurestatus: under review labels 2025-12-29 20:21:06 +01:00
adam closed this issue 2025-12-29 20:21:06 +01:00
Author
Owner

@github-actions[bot] commented on GitHub (Jan 23, 2023):

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. Do not attempt to circumvent this process by "bumping" the issue; doing so will result in its immediate closure and you may be barred from participating in any future discussions. Please see our contributing guide.

@github-actions[bot] commented on GitHub (Jan 23, 2023): 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. **Do not** attempt to circumvent this process by "bumping" the issue; doing so will result in its immediate closure and you may be barred from participating in any future discussions. Please see our [contributing guide](https://github.com/netbox-community/netbox/blob/develop/CONTRIBUTING.md).
Author
Owner

@jeremystretch commented on GitHub (Jan 24, 2023):

While I understand the use case, it seems a bit niche, and the corollary of your proposal is that AS numbers alone can no longer be employed as unique identifiers. My gut says this would do more harm than good.

@jeremystretch commented on GitHub (Jan 24, 2023): While I understand the use case, it seems a bit niche, and the corollary of your proposal is that AS numbers alone can no longer be employed as unique identifiers. My gut says this would do more harm than good.
Author
Owner

@sleepinggenius2 commented on GitHub (Jan 27, 2023):

We have a number of BGP peerings with our customers where we use the same range of private ASNs at each site for ones that don't have their own. I was trying to utilize the NetBox BGP Plugin to document these and am now getting hit with this limitation. It looks like that plugin used to include its own ASN model that only had to be unique to a site, which would have worked very well for my use case, but it now uses the core ASN model, which has this globally unique constraint. I agree that marking an RIR as private to exclude its ASNs from the global uniqueness constraint makes sense, but maybe it would be worth a different option called something like ASN Uniqueness that has three states, Global (Default), Within RIR, and None?

@sleepinggenius2 commented on GitHub (Jan 27, 2023): We have a number of BGP peerings with our customers where we use the same range of private ASNs at each site for ones that don't have their own. I was trying to utilize the [NetBox BGP Plugin](https://github.com/k01ek/netbox-bgp) to document these and am now getting hit with this limitation. It looks like that plugin used to include its own ASN model that only had to be unique to a site, which would have worked very well for my use case, but it now uses the core ASN model, which has this globally unique constraint. I agree that marking an RIR as private to exclude its ASNs from the global uniqueness constraint makes sense, but maybe it would be worth a different option called something like *ASN Uniqueness* that has three states, Global (Default), Within RIR, and None?
Author
Owner

@zacho112 commented on GitHub (Jan 27, 2023):

While I understand the use case, it seems a bit niche, and the corollary of your proposal is that AS numbers alone can no longer be employed as unique identifiers. My gut says this would do more harm than good.

This make sense, for non-private AS numbers

@zacho112 commented on GitHub (Jan 27, 2023): > While I understand the use case, it seems a bit niche, and the corollary of your proposal is that AS numbers alone can no longer be employed as unique identifiers. My gut says this would do more harm than good. This make sense, for non-private AS numbers
Author
Owner

@jeremystretch commented on GitHub (Jan 27, 2023):

@zacho112 to be clear, the limitation applies to private ASNs as well. As soon as you have, for example, two ASNs numbered 65001, you can no longer ever just refer to "ASN 65001;" it always needs to be accompanied by some other qualifying attribute (e.g. site or tenant) to uniquely identify the specific object.

I'm not saying that this is an unacceptable burden, just calling it out as a trade-off.

@jeremystretch commented on GitHub (Jan 27, 2023): @zacho112 to be clear, the limitation applies to private ASNs as well. As soon as you have, for example, two ASNs numbered 65001, you can no longer ever just refer to "ASN 65001;" it always needs to be accompanied by some other qualifying attribute (e.g. site or tenant) to uniquely identify the specific object. I'm not saying that this is an unacceptable burden, just calling it out as a trade-off.
Author
Owner

@sleepinggenius2 commented on GitHub (Jan 27, 2023):

Looking through our dataset, the combination of ASN and Tenant (may be null/empty) currently appears to be unique, so that should work for my use case as well. I can see where companies that use the same private ASN in multiple places internally within the same tenant could have issues though. It would be nice to have something that would enforce global uniqueness for public ASNs, but allow for applying different restrictions to private ASNs. I'm not sure that hard-coding those values would make sense (maybe a configuration option for a list of excluded ranges that defaults to the RFC-defined ones?), but that would certainly help enforce uniqueness where there has to be uniqueness and allow some flexibility where there doesn't. If we went the exclusion route (there should be an option, like an empty list/tuple or boolean False, that would remove all exclusions, including RFC defaults), then I would propose just leaving it up to the end user to write whatever custom validator they need to enforce their given situation for those excluded values, while the core enforces global uniqueness for the non-excluded values.

@sleepinggenius2 commented on GitHub (Jan 27, 2023): Looking through our dataset, the combination of ASN and Tenant (may be null/empty) currently appears to be unique, so that should work for my use case as well. I can see where companies that use the same private ASN in multiple places internally within the same tenant could have issues though. It would be nice to have something that would enforce global uniqueness for public ASNs, but allow for applying different restrictions to private ASNs. I'm not sure that hard-coding those values would make sense (maybe a configuration option for a list of excluded ranges that defaults to the RFC-defined ones?), but that would certainly help enforce uniqueness where there has to be uniqueness and allow some flexibility where there doesn't. If we went the exclusion route (there should be an option, like an empty list/tuple or boolean False, that would remove all exclusions, including RFC defaults), then I would propose just leaving it up to the end user to write whatever custom validator they need to enforce their given situation for those excluded values, while the core enforces global uniqueness for the non-excluded values.
Author
Owner

@github-actions[bot] commented on GitHub (Apr 28, 2023):

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. Do not attempt to circumvent this process by "bumping" the issue; doing so will result in its immediate closure and you may be barred from participating in any future discussions. Please see our contributing guide.

@github-actions[bot] commented on GitHub (Apr 28, 2023): 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. **Do not** attempt to circumvent this process by "bumping" the issue; doing so will result in its immediate closure and you may be barred from participating in any future discussions. Please see our [contributing guide](https://github.com/netbox-community/netbox/blob/develop/CONTRIBUTING.md).
Author
Owner

@github-actions[bot] commented on GitHub (May 28, 2023):

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.

@github-actions[bot] commented on GitHub (May 28, 2023): 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#7274