gcloud network-connectivity internal-ranges create Stay organized with collections Save and categorize content based on your preferences.
- 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 name
and ip-cidr-rangemy-rangein network192.168.0.0/25:https://www.googleapis.com/compute/v1/projects/my-project/locations/global/networks/my-networkgcloudnetwork-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-projectCreate an internal range with name
and auto-allocated /25 block (prefix-lengthmy-range) in network25:my-networkgcloudnetwork-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 the
projectattribute:- provide the argument
internal_rangeon the command line with afully specified name; - provide the argument
--projecton the command line; - set the property
core/project.
This must be specified.
INTERNAL_RANGE- ID of the internal range or fully qualified identifier for the internal range.
To set the
internal_rangeattribute:- provide the argument
internal_rangeon the command line.
This positional argument must be specified if any of the other arguments in thisgroup are specified.
- provide the argument
--region=REGION- The location ID.To set the
regionattribute:- provide the argument
internal_rangeon the command line with afully specified name; - provide the argument
--regionon the command line; - use default global location .
- provide the argument
- provide the argument
- 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.
- 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:
- https://www.googleapis.com/compute/v1/projects/my-project/locations/global/networks/my-network
- /projects/my-project/locations/global/networks/my-network
- my-network
- 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_STRATEGYmust 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.
OVERLAPSmust 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.
USAGEmustbe 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 helpfor details. - API REFERENCE
- This command uses the
networkconnectivity/v1API. 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.