Question

Difficulty: MediumManaging Networking Resources

A cloud engineer needs to update an existing custom Virtual Private Cloud (VPC) network configuration in Google Cloud. The environment currently has a subnet `prod-subnet-uscentral1` with the primary IP range `10.1.0.0/24`. Due to rapid growth, the team needs to expand the primary IP address range of this existing subnetwork to `10.1.0.0/22` using the `gcloud` CLI without recreating the subnet or disrupting existing resources. Which of the following conditions and actions are required to successfully perform this subnet expansion? (Select TWO.)

  1. The new CIDR prefix length must be smaller than or equal to the existing prefix length (for example, expanding /24 to /22).Answer
  2. B
    Execute `gcloud compute networks subnets update prod-subnet-uscentral1 --region=us-central1 --prefix-length=22` to update the primary IP block.
  3. Execute `gcloud compute networks subnets expand-ip-range prod-subnet-uscentral1 --region=us-central1 --ip-cidr-range=10.1.0.0/22` to increase the primary range.Answer
  4. D
    The existing IP address range can be shrunk or modified to a non-overlapping base IP block such as `172.16.0.0/22` directly via the expand command.

Answer

Expanding an existing Google Cloud VPC subnet primary range requires that the new netmask prefix length be smaller than or equal to the current range (such as expanding from /24 to /22), and it is executed using the command `gcloud compute networks subnets expand-ip-range prod-subnet-uscentral1 --region=us-central1 --ip-cidr-range=10.1.0.0/22`.
To expand an existing VPC subnet's primary IP range without recreating it, Google Cloud requires that the new prefix length be smaller (allocating a larger block of IP addresses, such as moving from /24 to /22). The correct CLI tool procedure is invoking `gcloud compute networks subnets expand-ip-range` specifying the subnet name, `--region`, and the expanded `--ip-cidr-range`.

Step-by-Step Solution

1
Verify subnet expansion constraints for Google Cloud VPC.
Identified that expanding a primary CIDR block requires reducing the prefix length (e.g., from /24 to /22) while keeping the same network starting address.
Subnet IP ranges in Google Cloud can only be expanded, never shrunk or moved to an entirely new network range.
2
Identify the correct gcloud CLI command and parameters for subnet expansion.
Determined that `gcloud compute networks subnets expand-ip-range` with `--ip-cidr-range` is the official command.
The standard `subnets update` command is used for modifying properties like Private Google Access or Flow Logs, whereas `expand-ip-range` is specifically dedicated to extending primary CIDR ranges.

Key Concept

VPC Subnet IP Range Expansion via gcloud CLI
Estimated Time:1m 30s
Rate this question