Associate Cloud Engineer ยท Managing network resources
How do you inspect and maintain VPC firewall rules?
Listing, updating and deleting rules, priority troubleshooting, firewall logging and rule hit counts, auditing policies, Connectivity Tests.
Key points
- gcloud compute firewall-rules list --filter network=NET --sort-by priority: rules in evaluation order.
- describe: one rule; delete: removes it; update: --priority, --target-tags, --source-ranges, --disabled.
- Not updatable (recreate the rule): name, network, direction, action.
- Lower priority number is evaluated earlier (default 1000).
- Logging: enabled per rule, to Cloud Logging.
- Connectivity Tests: find which rule blocks a path.
Source: https://docs.cloud.google.com/vpc/docs/using-firewalls
Practice questions
Which firewall rule is evaluated first when two rules match the same traffic?
- The one with the lower priority number
- The one with the higher priority number
- The one created most recently
- The one whose name sorts first
Show answer
Answer: A. The one with the lower priority number
The lower the priority number, the higher the priority. The rule with the smaller number is applied first.
Which fields of an existing VPC firewall rule can be changed with an update?
- Priority
- Target tags
- Whether the rule is disabled
- The network the rule belongs to
- The action (allow or deny)
Show answer
Answer: A. Priority, B. Target tags, C. Whether the rule is disabled
Priority, target tags and the disabled state are updatable. Network and action cannot be changed; such a change means deleting and recreating the rule.
True or false: VPC firewall rules logging records connections for every rule in the project automatically.
Show answer
Answer: False
False. Logging is enabled individually for each rule whose connections you want to record, and records go to Cloud Logging.
Practice 8 questions on this topic in Bitzu
Short lessons, instant explanations and spaced review of what you get wrong. Free on iOS and Android.
