Adding regions to prefixes #4554

Closed
opened 2025-12-29 18:37:27 +01:00 by adam · 10 comments
Owner

Originally created by @elixdreamer on GitHub (Feb 11, 2021).

Environment

  • Python version: unknown
  • NetBox version: v2.10.4

Proposed Functionality

Add a region to a specific prefix and not only a site.

Use Case

In our network design we have many sites(+4k) that will divided in 5 major regions.
Since we will allocating prefixes to specific regions we want to create some automatic IP allocation based on the region where the site is in.
I have tried adding the regions to a specific prefix but this isn't saved. Only sites are stored to the prefix.

Database Changes

Adding the region field to a prefixes

Originally created by @elixdreamer on GitHub (Feb 11, 2021). <!-- NOTE: IF YOUR ISSUE DOES NOT FOLLOW THIS TEMPLATE, IT WILL BE CLOSED. This form is only for proposing specific new features or enhancements. If you have a general idea or question, please start a discussion instead: https://github.com/netbox-community/netbox/discussions NOTE: Due to an excessive backlog of feature requests, we are not currently accepting any proposals which significantly extend NetBox's feature scope. Please describe the environment in which you are running NetBox. Be sure that you are running an unmodified instance of the latest stable release before submitting a bug report. --> ### Environment * Python version: unknown * NetBox version: v2.10.4 <!-- Describe in detail the new functionality you are proposing. Include any specific changes to work flows, data models, or the user interface. --> ### Proposed Functionality Add a region to a specific prefix and not only a site. <!-- Convey an example use case for your proposed feature. Write from the perspective of a NetBox user who would benefit from the proposed functionality and describe how. ---> ### Use Case In our network design we have many sites(+4k) that will divided in 5 major regions. Since we will allocating prefixes to specific regions we want to create some automatic IP allocation based on the region where the site is in. I have tried adding the regions to a specific prefix but this isn't saved. Only sites are stored to the prefix. <!-- Note any changes to the database schema necessary to support the new feature. For example, does the proposal require adding a new model or field? (Not all new features require database changes.) ---> ### Database Changes Adding the region field to a prefixes
adam added the type: feature label 2025-12-29 18:37:27 +01:00
adam closed this issue 2025-12-29 18:37:27 +01:00
Author
Owner

@sdktr commented on GitHub (Feb 12, 2021):

How would this 'region allocation' be used? Where would this user seeking for a new site assignment get the hint that it is prefered to come from this region allocation?

@sdktr commented on GitHub (Feb 12, 2021): How would this 'region allocation' be used? Where would this user seeking for a new site assignment get the hint that it is prefered to come from this region allocation?
Author
Owner

@jeremystretch commented on GitHub (Feb 12, 2021):

This directly conflicts with the assignment of a site. IMO it would make more sense to allow the assignment of multiple sites.

@jeremystretch commented on GitHub (Feb 12, 2021): This directly conflicts with the assignment of a site. IMO it would make more sense to allow the assignment of multiple sites.
Author
Owner

@pkomissarov commented on GitHub (Feb 13, 2021):

For us it also would be usefull if prefix can be "super-prefix" for region and bound to the whole region, but not bound to any site. Important moment that one region can have several such "super-prefixes".

Use case

We need to build ACL for every site in region. In this ACL "super-prefixes" are used as destinations, to allow traffic within region.

Example

RegionX already owns two "super-prefixes" 10.100.0.0/16 and 10.200.0.0/16, and has a lot of sites.
Site1 and Site2 are two sites from this region but from different super-prefixes.
Site1 owns prefix 10.100.1.0/24.
Site2 owns prefix 10.200.1.0/24.

ACL for Site1:

permit ip 10.100.1.0/24 to 10.100.0.0/16
permit ip 10.100.1.0/24 to 10.200.0.0/16
deny ip any to any

ACL for Site2:

permit ip 10.200.1.0/24 to 10.100.0.0/16
permit ip 10.200.1.0/24 to 10.200.0.0/16
deny ip any to any

Such ACL is short. Another approach is to write "permit" line for every site in region, but ACL becomes much longer if there are a lot of sites in region.

Database Changes

Add region field to prefix. May be prohibit to set site field, if region field is set.

@pkomissarov commented on GitHub (Feb 13, 2021): For us it also would be usefull if prefix can be "super-prefix" for region and bound to the whole region, but not bound to any site. Important moment that one region can have several such "super-prefixes". ### Use case We need to build ACL for every site in region. In this ACL "super-prefixes" are used as destinations, to allow traffic within region. #### Example RegionX already owns two "super-prefixes" 10.100.0.0/16 and 10.200.0.0/16, and has a lot of sites. Site1 and Site2 are two sites from this region but from different super-prefixes. Site1 owns prefix 10.100.1.0/24. Site2 owns prefix 10.200.1.0/24. ACL for Site1: ``` permit ip 10.100.1.0/24 to 10.100.0.0/16 permit ip 10.100.1.0/24 to 10.200.0.0/16 deny ip any to any ``` ACL for Site2: ``` permit ip 10.200.1.0/24 to 10.100.0.0/16 permit ip 10.200.1.0/24 to 10.200.0.0/16 deny ip any to any ``` Such ACL is short. Another approach is to write "permit" line for every site in region, but ACL becomes much longer if there are a lot of sites in region. ### Database Changes Add region field to prefix. May be prohibit to set site field, if region field is set.
Author
Owner

@tbk2 commented on GitHub (Feb 17, 2021):

We'd also need the ability to bind prefixes to regions.

Use case:

We have several regions. There is only one router within a region. A prefix may only be defined on one router. However, the prefix can be present in different sites within a region.

Database changes

Add region field to prefix. May be prohibit to set site field, if region field is set.

@tbk2 commented on GitHub (Feb 17, 2021): We'd also need the ability to bind prefixes to regions. **Use case:** We have several regions. There is only one router within a region. A prefix may only be defined on one router. However, the prefix can be present in different sites within a region. **Database changes** Add region field to prefix. May be prohibit to set site field, if region field is set.
Author
Owner

@elixdreamer commented on GitHub (Feb 26, 2021):

How would this 'region allocation' be used? Where would this user seeking for a new site assignment get the hint that it is prefered to come from this region allocation?

The user will have a custom script where he will add hardware with a possibility to select a region.
If the regions are assigned to prefixes we can assign correct available IP's.

This directly conflicts with the assignment of a site. IMO it would make more sense to allow the assignment of multiple sites.

The problem here is that we will add sites based on implementation plan that is planned over multiple years. So at day one we will not have 4k sites availble in Netbox. They will be added on request. Since we need to add sites we need to know to what subnets they belong based on regions.

I hope we could get such an implementation as i can see some other users are identifying them self with this request.

@elixdreamer commented on GitHub (Feb 26, 2021): > How would this 'region allocation' be used? Where would this user seeking for a new site assignment get the hint that it is prefered to come from this region allocation? The user will have a custom script where he will add hardware with a possibility to select a region. If the regions are assigned to prefixes we can assign correct available IP's. > This directly conflicts with the assignment of a site. IMO it would make more sense to allow the assignment of multiple sites. The problem here is that we will add sites based on implementation plan that is planned over multiple years. So at day one we will not have 4k sites availble in Netbox. They will be added on request. Since we need to add sites we need to know to what subnets they belong based on regions. I hope we could get such an implementation as i can see some other users are identifying them self with this request.
Author
Owner

@aodix commented on GitHub (Feb 26, 2021):

How would this 'region allocation' be used? Where would this user seeking for a new site assignment get the hint that it is prefered to come from this region allocation?

There would be a total of 4000 sites, those 4000 sites will have 1 or more device. Those devices needs to have an IP that is in a prefix for that geographical region. That means

  • Every geographical region has his prefix.
  • When a new site/device will be added we know in what geographical region it would be added.
  • The IP will needs to be selected in the prefix for that geographical region
@aodix commented on GitHub (Feb 26, 2021): > How would this 'region allocation' be used? Where would this user seeking for a new site assignment get the hint that it is prefered to come from this region allocation? There would be a total of 4000 sites, those 4000 sites will have 1 or more device. Those devices needs to have an IP that is in a prefix for that geographical region. That means - Every geographical region has his prefix. - When a new site/device will be added we know in what geographical region it would be added. - The IP will needs to be selected in the prefix for that geographical region
Author
Owner

@jeremystretch commented on GitHub (Feb 27, 2021):

#5892 (the proposed introduction of a SiteGroup model) is likely relevant to this discussion.

@jeremystretch commented on GitHub (Feb 27, 2021): #5892 (the proposed introduction of a SiteGroup model) is likely relevant to this discussion.
Author
Owner

@github-actions[bot] commented on GitHub (Apr 14, 2021):

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.

@github-actions[bot] commented on GitHub (Apr 14, 2021): 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

@hyudra commented on GitHub (Apr 27, 2021):

Is it possible to assign prefix to Site Group without a Site? @jeremystretch

@hyudra commented on GitHub (Apr 27, 2021): Is it possible to assign prefix to Site Group without a Site? @jeremystretch
Author
Owner

@jeremystretch commented on GitHub (May 21, 2021):

Actually, let's fold this into #6414 (prefix assignment to site groups) since it doesn't make sense to do one and not the other.

@jeremystretch commented on GitHub (May 21, 2021): Actually, let's fold this into #6414 (prefix assignment to site groups) since it doesn't make sense to do one and not the other.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#4554