Soru

Zorluk: OrtaDeploying Virtual Private Cloud (VPC) Networks, Subnets, and Firewall Rules

A DevOps engineer needs to create an ingress firewall rule in a Virtual Private Cloud (VPC) network named `production-vpc` to allow HTTPS traffic (TCP port 443) to Compute Engine virtual machines tagged as `secure-app`. An existing firewall rule with a priority of 1000 currently denies all ingress traffic to instances with the `secure-app` tag. The new rule must take precedence over the existing deny rule to allow HTTPS traffic. Which `gcloud` command should the engineer run?

  1. `gcloud compute firewall-rules create allow-https-secure --network=production-vpc --action=ALLOW --direction=INGRESS --rules=tcp:443 --target-tags=secure-app --priority=500`Cevap
  2. B
    `gcloud compute firewall-rules create allow-https-secure --network=production-vpc --action=ALLOW --direction=INGRESS --rules=tcp:443 --target-tags=secure-app --priority=2000`
  3. C
    `gcloud compute firewall-rules create allow-https-secure --network=production-vpc --action=ALLOW --direction=INGRESS --rules=tcp:443 --target-tags=secure-app --priority=1000`
  4. D
    `gcloud compute firewall-rules update default-deny --network=production-vpc --allow=tcp:443 --target-tags=secure-app --priority=1`

Cevap

The command specifying `--priority=500` is correct because Google Cloud VPC firewall rules process lower priority numbers before higher numbers, allowing priority 500 to override the existing priority 1000 deny rule.
In Google Cloud Platform, firewall rules are processed sequentially based on priority numbers, where a lower numerical value indicates higher priority (higher precedence). A rule with priority 500 is evaluated before a rule with priority 1000. When traffic matches the allow rule at priority 500, processing stops, effectively overriding the deny rule at priority 1000.

Adım Adım Çözüm

1
Analyze GCP firewall priority ordering rules.
GCP firewall rule priorities range from 0 to 65535, where lower numerical values represent higher precedence in rule evaluation.
To override an existing firewall rule with priority 1000, the new rule must be assigned a priority number strictly less than 1000 (such as 500).
2
Construct the required `gcloud` CLI command flags.
Specify `--action=ALLOW`, `--direction=INGRESS`, `--rules=tcp:443`, `--target-tags=secure-app`, and `--priority=500` on the network `production-vpc`.
These flags properly define the target VMs, allowed protocol/port, network scope, and precedence order.

Anahtar Kavram

GCP Firewall Priority Ordering and Rule Precedence
Bu soruyu puanla