Bitzu

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

Single choice

Which firewall rule is evaluated first when two rules match the same traffic?

  1. The one with the lower priority number
  2. The one with the higher priority number
  3. The one created most recently
  4. 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.

Select all that apply

Which fields of an existing VPC firewall rule can be changed with an update?

  1. Priority
  2. Target tags
  3. Whether the rule is disabled
  4. The network the rule belongs to
  5. 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

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.

Download on the App StoreGet it on Google Play

More Associate Cloud Engineer topics in this module