gcloud network-connectivity internal-ranges create

NAME
gcloud network-connectivity internal-ranges create - create a new internal range
SYNOPSIS
gcloud network-connectivity internal-ranges create(INTERNAL_RANGE :--region=REGION)--network=NETWORK(--ip-cidr-range=IP_CIDR_RANGE    | [--prefix-length=PREFIX_LENGTH :--allocation-strategy=ALLOCATION_STRATEGY--exclude-cidr-ranges=[EXCLUDE_CIDR_RANGES,…]--first-available-ranges-lookup-size=FIRST_AVAILABLE_RANGES_LOOKUP_SIZE--target-cidr-range=[TARGET_CIDR_RANGE,…]])[--async][--description=DESCRIPTION][--immutable][--labels=[KEY=VALUE,…]][--overlaps=[OVERLAPS,…]][--peering=PEERING; default="for-self"][--usage=USAGE; default="for-vpc"][--migration-source=MIGRATION_SOURCE--migration-target=MIGRATION_TARGET][GCLOUD_WIDE_FLAG]
DESCRIPTION
Create a new internal range with the given name.
EXAMPLES
Create an internal range with namemy-rangeand ip-cidr-range192.168.0.0/25 in networkhttps://www.googleapis.com/compute/v1/projects/my-project/locations/global/networks/my-network:
gcloudnetwork-connectivityinternal-rangescreatemy-range--ip-cidr-range="192.168.0.0/25"--network="https://www.googleapis.com/compute/v1/projects/my-pro\ject/locations/global/networks/my-network"--project=my-project

Create an internal range with namemy-rangeand auto-allocated /25 block (prefix-length25) in networkmy-network:

gcloudnetwork-connectivityinternal-rangescreatemy-range--prefix-length=25--network="my-network"--project=my-project
POSITIONAL ARGUMENTS
Internal range resource - Name of the internal range to be created. Thearguments in this group can be used to specify the attributes of this resource.(NOTE) Some attributes are not given arguments in this group but can be set inother ways.

To set theproject attribute:

  • provide the argumentinternal_range on the command line with afully specified name;
  • provide the argument--project on the command line;
  • set the propertycore/project.

This must be specified.

INTERNAL_RANGE
ID of the internal range or fully qualified identifier for the internal range.

To set theinternal_range attribute:

  • provide the argumentinternal_range on the command line.

This positional argument must be specified if any of the other arguments in thisgroup are specified.

--region=REGION
The location ID.To set theregion attribute:
  • provide the argumentinternal_range on the command line with afully specified name;
  • provide the argument--region on the command line;
  • use default global location .
REQUIRED FLAGS
--network=NETWORK
The URL or resource ID of the network in which to reserve the internal range.Legacy network is not supported. This can only be specified for a globalinternal address.

For example:

Exactly one of these must be specified:
--ip-cidr-range=IP_CIDR_RANGE
IP range that this internal range defines.
--prefix-length=PREFIX_LENGTH
An alternative to ip-cidr-range. Can be set when trying to create a reservationthat automatically finds a free range of the given size.

This flag argument must be specified if any of the other arguments in this groupare specified.

Additional options for the internal range's address auto-allocation (allowedonly when prefix-length is set):
--allocation-strategy=ALLOCATION_STRATEGY
Allocation strategy to be used when searching for a free range.ALLOCATION_STRATEGY must be one of:
first-available
Pick the first available address range. This strategy is deterministic and theresult is easy to predict.
first-smallest-fitting
Pick the smallest but fitting available range. This deterministic strategyminimizes fragmentation of the address space.
random
Random strategy, the legacy algorithm, used for backwards compatibility. Thisallocation strategy remains efficient in the case of concurrent allocationrequests in the same peered network space and doesn't require providing thelevel of concurrency in an explicit parameter, but it is prone to fragmentingavailable address space.
random-first-n-available
Pick an arbitrary range out of the first N available ones. The N will be set inthe first_available_ranges_lookup_size flag. This strategy should be used whenconcurrent allocation requests are made in the same space of peered networkswhile the fragmentation of the addrress space is reduced.
--exclude-cidr-ranges=[EXCLUDE_CIDR_RANGES,…]
A list of CIDR ranges to exclude from the search for a free range. This can beused to exclude specific ranges that are already intended to have some otheruse.
--first-available-ranges-lookup-size=FIRST_AVAILABLE_RANGES_LOOKUP_SIZE
The number of ranges to be considered when using the RANDOM_FIRST_N_AVAILABLEallocation strategy. This is only allowed when allocation-strategy is set toRANDOM_FIRST_N_AVAILABLE.
--target-cidr-range=[TARGET_CIDR_RANGE,…]
Can be set to narrow down or pick a different address space while searching fora free range. If not set, defaults to the "10.0.0.0/8" address space. This canbe used to search in other rfc-1918 address spaces like "172.16.0.0/12" and"192.168.0.0/16" or non-rfc-1918 address spaces used in the VPC.
OPTIONAL FLAGS
--async
Return immediately, without waiting for the operation in progress to complete.
--description=DESCRIPTION
Description of the internal range to be created.
--immutable
Mark the internal range as immutable. Then only non-semantic fields likedescription and labels could be modified after creation.
--labels=[KEY=VALUE,…]
List of label KEY=VALUE pairs to add.
--overlaps=[OVERLAPS,…]
Overlap specifications for the range being created.OVERLAPS must be one of:
overlap-existing-subnet-range
Allows for creation of internal ranges that overlap with existing subnets.
overlap-route-range
Allows for creation or existence of routes that have a more specific destinationthan the created range.
--peering=PEERING; default="for-self"
The type of peering set for the internal range.PEERINGmust be one of:
for-peer
This behavior can be set when the internal range is being reserved for usage bythe peers. This means that no resource within the VPC in which it is beingcreated can use this to associate with a cloud resource, but one of the peerscan. This represents "donating" a range for peers to use.
for-self
This beharior represents the case that the internal range is intended to be usedin the VPC on which it is created and is accessible from its peers. This impliesthat peers or peer-of-peers cannot use this range.
not-shared
This behavior can be set when the internal range is being reserved for usage bythe VPC on which it is created but not shared with the peers. In a sense it islocal to the VPC. This can be used to create internal ranges for variouspurposes like HTTP_INTERNAL_LOAD_BALANCER or for interconnect routes that arenot shared with peers. This also implies that peers cannot use this range in away that is visible to this VPC, but can re-use this range as long as it isNOT_SHARED from the peer VPC too.
--usage=USAGE; default="for-vpc"
The type of usage set for the internal range.USAGE mustbe one of:
external-to-vpc
Ranges created with EXTERNAL_TO_VPC cannot be associated with cloud resourcesand are meant to block out address ranges for various use cases, like forexample, usage on-prem, with dynamic route announcements via interconnect.
for-migration
Ranges created with FOR_MIGRATION are used as locks for migrating subnetworksbetween peered VPC networks.
for-vpc
A cloud resource can use the reserved CIDR block by associating it with theinternal range resource if usage is set to FOR_VPC.
Endpoints of a for-migration internal range. This is only applicable when--usage is set to for-migration. Both MIGRATION_SOURCE and MIGRATION_TARGET musteither belong to the same VPC or their VPCs must be peered (they may then evenbelong to different projects). MIGRATION_SOURCE must belong to the VPC networkspecifed by the --network flag. MIGRATION_TARGET may name a subnetwork whichdoes not exist yet; it must be a valid resource path, and parent resources(network and project) and their locations must exist.
--migration-source=MIGRATION_SOURCE
The migration source subnetwork (of a for-migration internal range) resource URIor resource ID.

This flag argument must be specified if any of the other arguments in this groupare specified.

--migration-target=MIGRATION_TARGET
The migration target subnetwork (of a for-migration internal range) resource URIor resource ID.

This flag argument must be specified if any of the other arguments in this groupare specified.

GCLOUD WIDE FLAGS
These flags are available to all commands:--access-token-file,--account,--billing-project,--configuration,--flags-file,--flatten,--format,--help,--impersonate-service-account,--log-http,--project,--quiet,--trace-token,--user-output-enabled,--verbosity.

Run$gcloud help for details.

API REFERENCE
This command uses thenetworkconnectivity/v1 API. The fulldocumentation for this API can be found at:https://cloud.google.com/network-connectivity/docs/reference/networkconnectivity/rest
NOTES
This variant is also available:
gcloudalphanetwork-connectivityinternal-rangescreate

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-12-09 UTC.