Soru

Zorluk: OrtaManaging Networking Resources

An operations engineer needs to expand the primary IPv4 address range of an existing custom subnet named `prod-subnet-us-east` located in region `us-east1` from 10.1.0.0/2410.1.0.0/24 to 10.1.0.0/2310.1.0.0/23 without disrupting existing workloads running in the Virtual Private Cloud (VPC). Which `gcloud` command should the engineer execute to perform this operation?

  1. `gcloud compute networks subnets expand-ip-range prod-subnet-us-east --prefix-length=23 --region=us-east1`Cevap
  2. B
    `gcloud compute networks create prod-subnet-us-east --subnet-mode=custom --range=10.1.0.0/23`
  3. C
    `gcloud compute firewall-rules update prod-subnet-us-east --priority=23`
  4. D
    `gcloud compute instances update prod-subnet-us-east --zone=us-east1-a --network=corp-vpc`

Cevap

The command `gcloud compute networks subnets expand-ip-range prod-subnet-us-east --prefix-length=23 --region=us-east1` expands the IP address range of an existing subnet dynamically.
To expand the IP address range of an existing Google Cloud VPC subnet, you use the command `gcloud compute networks subnets expand-ip-range [SUBNET_NAME]` with the `--prefix-length` flag indicating the new (smaller numerical prefix) subnet mask. This operation is non-disruptive and allows expanding a subnet range (e.g., from /24/24 to /23/23).

Adım Adım Çözüm

1
Identify the required networking resource and operational task.
The target resource is a VPC subnet named `prod-subnet-us-east` in region `us-east1`, and the objective is to expand its primary IP address range.
Expanding an existing subnet CIDR block requires modifying the subnet resource without recreating it or affecting running VMs.
2
Determine the appropriate `gcloud` CLI command structure.
The command group for subnet operations is `gcloud compute networks subnets` and the specific subcommand for increasing IP capacity is `expand-ip-range`.
`expand-ip-range` modifies the existing subnet's netmask without altering deployed resources.
3
Specify the required flags for prefix length and region.
The `--prefix-length=23` flag specifies the target netmask (2323 bits), and `--region=us-east1` specifies the subnet location.
Subnet ranges can only be expanded (prefix length decreased), not shrunk.

Anahtar Kavram

VPC Subnet IP Address Expansion
Tahmini Süre:1m 15s
Bu soruyu puanla