Google Cloud networks are usually secured by several overlapping firewall layers that few teams can explain in order, which is how a folder-level allow or an old default-network rule ends up exposing SSH to the internet. This guide covers Google Cloud VPC security and Cloud Next Generation Firewall (Cloud NGFW): hierarchical and network firewall policies, the evaluation order, secure tags and service account targets, Shared VPC roles, Private Google Access, IAP TCP forwarding, organisation policy guardrails and VPC Flow Logs. It is written for platform and network engineers and cloud security reviewers. For cross-cloud principles, see the Cloud Network Security Guide; this page stays specific to Google Cloud.
This is an independent guide from NHI Mgmt Group, based on Google Cloud's public documentation as of November 2026. It is not sponsored or reviewed by Google Cloud. Product features change, so confirm settings against Google Cloud's current documentation.
Key takeaways
- Know the evaluation order. By default Google Cloud evaluates hierarchical policies (organisation, then folders), regional system policies, VPC firewall rules, global network policies, regional network policies, then the implied action.
- Delete the default network. It ships with default-allow-ssh, default-allow-rdp, default-allow-icmp and default-allow-internal at priority 65534; enforce skipDefaultNetworkCreation so new projects never get it.
- Target by identity, not network tag. Anyone who can edit an instance can change its network tags; service account targets and IAM-governed secure tags are harder to tamper with.
- Shared VPC separates duties. Keep firewall control (compute.securityAdmin) in the host project with the network team, and grant compute.networkUser at subnet level, not project level.
- Private access needs DNS and routes. Private Google Access is per subnet; restricted.googleapis.com (199.36.153.4/30) only serves VPC Service Controls supported APIs and reduces exfiltration paths.
How identity and access work in Google Cloud VPC
A VPC network is a global resource in a project. Who can change it is decided by IAM; what traffic flows is decided by firewall rules and policies whose targets can themselves be identities. That second point is what makes Google Cloud different: firewall rules can target the service account a VM runs as, or IAM-controlled secure tags, so network policy can follow workload identity.
Firewall layers and evaluation order
| Step | Layer | Attached to | Notes |
|---|---|---|---|
| 1 | Hierarchical firewall policies | Organisation, then each folder down to the project | Central guardrails; goto_next hands evaluation to the next level |
| 2 | Regional system firewall policies | Managed by Google | You can only toggle logging; no charge |
| 3 | VPC firewall rules | One VPC network | Priority 0 to 65535, default 1000; deny wins only at equal priority |
| 4 | Global network firewall policies | One or more VPC networks | Support secure tags, FQDN, geolocation and threat intelligence by tier |
| 5 | Regional network firewall policies | Networks in one region | No apply_security_profile_group action |
| 6 | Implied action | Every network | Ingress to VM interfaces deny; egress allow |
This is the default AFTER_CLASSIC_FIREWALL enforcement order. Setting networkFirewallPolicyEnforcementOrder to BEFORE_CLASSIC_FIREWALL moves global and regional network policies ahead of VPC firewall rules, which is useful when migrating off classic rules. Within a policy, rules have priorities from 0 to 2,147,483,547 and at most one rule matches; actions are allow, deny, goto_next and apply_security_profile_group.
Choosing targets
| Target type | Who can change membership | Strength | Use when |
|---|---|---|---|
| All instances | Not applicable | Broad | Baseline denies and logging rules |
| Network tags (VPC rules) | Anyone with instance edit permission | Broad: a workload owner can add a tag and inherit access | Legacy rules only; plan migration |
| Service accounts | Needs Service Account User and an instance stop | Strong: tied to workload identity | Most allow rules between tiers |
| Secure tags (network policies) | Governed by IAM on the tag key and value | Strong and centrally controlled | Micro-segmentation across projects and in hierarchical policies |
Admin roles and privileged access
Network administration in Google Cloud is split across predefined roles. The split is useful only if you keep it.
- compute.securityAdmin: manages firewall rules and SSL certificates. This is the role that can open the network; hold it in the host project for a small network security group.
- compute.networkAdmin: manages other network resources (subnets, routes, peering, Private Google Access) but not firewall rules. By default a Network Admin for one network can peer it with any other network, so constrain peering with
constraints/compute.restrictVpcPeering. - compute.xpnAdmin (Shared VPC Admin): enables host projects, attaches service projects and delegates subnet access. Grant at organisation or folder level to very few people.
- compute.networkUser: lets service project admins create resources in shared subnets. Granted at project level it covers every current and future subnet in the host project; grant it per subnet instead and review bindings when subnets are added.
- Firewall policy administrators: whoever can edit an organisation or folder hierarchical policy controls traffic for every project below it. Treat those bindings as tier zero and review them with organisation IAM.
- Remote administration: use IAP TCP forwarding instead of external IPs. Allow ingress only from
35.235.240.0/20on 22 or 3389, and grantroles/iap.tunnelResourceAccessorwith IAM Conditions such asdestination.port == 22. Note that Owners bypass these conditions. See the Identity-Aware Proxy Guide.
Use groups, not individual bindings, and time-bound elevation for the security admin roles. See the Google Cloud IAM and Service Accounts Guide.
Integrations, API tokens and service accounts
Most traffic leaving a Google Cloud VPC goes to Google APIs on behalf of service accounts. The network design decides which API front doors those identities can reach.
| Domain option | IPv4 range | APIs reachable | Use when |
|---|---|---|---|
| Default domains | Google's published dynamic ranges | Most APIs and Workspace web apps | Simple estates without VPC Service Controls |
| private.googleapis.com | 199.36.153.8/30 | Most APIs, not Workspace web apps; works whether or not the API supports VPC SC | You need APIs outside VPC SC support |
| restricted.googleapis.com | 199.36.153.4/30 | Only APIs supported by VPC Service Controls | Sensitive projects inside a perimeter |
- Private Google Access: enabled per subnet, it lets VMs with only internal IPs reach Google APIs. It needs a route to the VIP range whose next hop is the default internet gateway, egress firewall allows for the range (Google also recommends 34.126.0.0/18), and a private DNS zone for
googleapis.comwith A records for the chosen VIP and a*.googleapis.comCNAME. Do not mix the two VIPs. - Pair with VPC Service Controls: network paths decide reachability; perimeters decide whether a credential used from outside can read the data. See the VPC Service Controls Guide.
- Service account keys bypass network design: a downloaded key works from any internet host against default domains. Block key creation and use attached service accounts or workload identity federation. See the Google Cloud Service Account Keys Security Guide.
- Metadata server: traffic to 169.254.169.254 is always allowed and cannot be blocked with firewall rules. Protect it in the application (SSRF defences) because it issues service account tokens (ATT&CK T1552.005).
- Producer services: managed services such as Cloud SQL are reached through private services access or Private Service Connect. See the Cloud Private Connectivity Guide.
Logging and detection
Three log sources matter: Cloud Audit Logs (Admin Activity) for firewall, route and peering changes, firewall rules logging for allow and deny decisions per rule, and VPC Flow Logs for sampled traffic. See the Google Cloud Audit Logs and Log Sinks Guide.
- VPC Flow Logs: enable at organisation, VPC network, subnet, VLAN attachment or Cloud VPN tunnel level. Aggregation intervals run from 5 seconds to 15 minutes. Configurations made through the Compute Engine API keep 50% of sampled entries by default; Network Management API configurations keep 100%. Egress packets are sampled before egress firewall rules (so denied outbound attempts can appear), ingress packets after ingress rules (so denied inbound packets do not). Logs stay 30 days in Cloud Logging unless you set retention or export them.
- Firewall rules logging: enabled per rule and billed, so turn it on for deny rules on sensitive tiers, for rules allowing internet ingress, and during migrations. Firewall Insights shows shadowed and unused rules.
- Cloud NGFW Enterprise threat logs: intrusion prevention detections from firewall endpoints; route them to your SIEM.
| Detection | Source | ATT&CK |
|---|---|---|
| Firewall rule or policy rule created allowing 0.0.0.0/0 to 22, 3389 or database ports | Admin Activity audit log (for example v1.compute.firewalls.insert) | T1133, T1021.004 |
| Hierarchical policy association removed or rule changed to goto_next | Admin Activity audit log at organisation or folder | T1599 |
| New VPC peering, route with custom next hop, or VM with IP forwarding | Admin Activity audit log | T1599 |
| External IP attached to a VM in a restricted project | Audit log and org policy violation | T1578 |
| One source hitting many ports or hosts | VPC Flow Logs, firewall deny logs | T1046 |
| Large egress to new external destinations, unusual DNS volume | VPC Flow Logs, Cloud DNS logs, NGFW threat logs | T1048, T1071.004 |
Metrics
- Default networks remaining: projects still holding a network named default. Target zero.
- Internet-exposed admin ports: rules allowing 0.0.0.0/0 to 22 or 3389. Target zero, with IAP range rules instead.
- Identity-targeted rules: share of allow rules targeting service accounts or secure tags rather than network tags or all instances.
- External IP exceptions: VMs allowed by vmExternalIpAccess, each with an owner and review date.
- Flow log coverage: subnets with VPC Flow Logs enabled and exported to the SIEM.
- Unused rules: rules Firewall Insights reports with no hits in 90 days, removed each quarter.
Hardening baseline
Organisation policy guardrails
| Constraint | Effect |
|---|---|
compute.skipDefaultNetworkCreation | New projects do not get the default network and its permissive rules |
compute.vmExternalIpAccess | Only listed VMs may hold external IPv4 addresses (IPv6 not covered: use the IPv6 constraints) |
compute.restrictVpcPeering | Limits which networks can peer |
compute.restrictSharedVpcHostProjects, compute.restrictSharedVpcSubnetworks | Which host projects and subnets service projects may use (not retroactive) |
compute.restrictCloudNATUsage | Which subnets may use Cloud NAT for egress |
compute.restrictLoadBalancerCreationForTypes | Blocks external load balancer types where not approved |
compute.managed.vmCanIpForward | Restricts IP forwarding, which turns a VM into a router |
compute.requireOsLogin | OS Login on new projects, so SSH access follows IAM |
See the Google Cloud Organization Policy Guide for rollout of these constraints in dry-run mode.
Choosing a Cloud NGFW tier
- Essentials (no charge): IP, port and protocol rules, secure tags and service account targets. Enough for segmentation in most estates.
- Standard: adds FQDN objects and threat intelligence lists, so egress can be limited to named domains and known bad ranges blocked. A good fit for controlled egress without a separate proxy.
- Enterprise: adds intrusion prevention through zonal firewall endpoints, URL filtering and TLS inspection, using security profile groups referenced by apply_security_profile_group rules. Use it for internet-facing and regulated tiers; endpoints are zonal, so plan one per zone in use.
Small organisations can run one Shared VPC host with a global network policy and Essentials rules; large estates should put organisation-wide denies in a hierarchical policy, delegate with goto_next to folder policies per business unit, and keep application rules in network policies.
Egress design
The implied egress rule allows everything, and Google Cloud blocks only a few flows regardless of rules (for example TCP port 25 to external addresses). An outbound deny posture has to be built deliberately.
- Remove external IPs: with vmExternalIpAccess enforced, VMs can only reach the internet through Cloud NAT, and restrictCloudNATUsage limits which subnets get NAT at all.
- Add a low-priority egress deny: a network policy rule denying 0.0.0.0/0 egress for all instances, then higher-priority allows for the Private Google Access VIP, 34.126.0.0/18, internal ranges and named dependencies.
- Use FQDN objects (Standard tier): allow egress to package mirrors, partner APIs and update services by domain name instead of chasing changing IP ranges.
- Block known bad destinations: Google Threat Intelligence lists in egress rules stop traffic to known malicious ranges before it reaches NAT.
- Inspect what remains: send internet egress from regulated tiers through apply_security_profile_group rules to Enterprise firewall endpoints.
Test each egress change with firewall rules logging enabled on the deny rule, since denied outbound attempts also appear in VPC Flow Logs (egress is sampled before firewall evaluation). This gives a quick list of dependencies the allow rules missed.
Framework mapping
| Control area | NIST SP 800-53 Rev. 5 | NIST CSF 2.0 | CIS Controls v8.1 | ISO/IEC 27001:2022 |
|---|---|---|---|---|
| Hierarchical denies, segmentation by secure tag | SC-7, SC-7(5), AC-4 | PR.IR-01 | 12 | A.8.22 |
| Admin role separation, Shared VPC delegation | AC-6 | PR.AA-05 | 6 | A.8.2 |
| Org policy constraints, default network removal | CM-6, CM-7 | PR.PS-01 | 4 | A.8.9 |
| IAP for SSH and RDP | AC-17 | PR.AA-05 | 12 | A.8.20 |
| Flow logs, firewall logs, NGFW IPS | AU-12, SI-4 | DE.CM-01 | 13 | A.8.16 |
Rollout
- Inventory and log: list every network, rule, policy and association; enable firewall rules logging on broad allow rules and VPC Flow Logs for two weeks.
- Guardrails in dry run: apply the organisation policy constraints above in dry-run mode, fix violations, then enforce.
- Organisation denies: add a hierarchical policy that denies 0.0.0.0/0 to 22 and 3389 except 35.235.240.0/20, with goto_next for everything else. Test on a sandbox folder first.
- Migrate rules: recreate VPC firewall rules as global network policy rules targeting secure tags or service accounts. Switch the network to BEFORE_CLASSIC_FIREWALL, confirm hits move to the new rules, then delete classic rules.
- Private access: enable Private Google Access with restricted.googleapis.com on sensitive subnets, remove external IPs, add Cloud NAT only where internet egress is needed.
- Roll back: keep policies in Terraform; rollback is reapplying the previous state, or detaching a hierarchical policy association, which takes effect without editing project rules.
Common misconfigurations
- Default network left in place: default-allow-ssh and default-allow-rdp expose every VM with an external IP to the internet.
- Network tags as security boundaries: a developer with instance edit rights adds the tag a database rule trusts, and gains access without any IAM review.
- Project-level Network User: service projects can deploy into every shared subnet, including those meant for other trust zones.
- Folder policy that allows instead of delegating: a broad allow in a hierarchical policy stops evaluation, so stricter project rules never run. Use goto_next for anything the folder should not decide.
- Private Google Access with broken DNS or routes: replacing the default route without adding a route for 199.36.153.4/30, or mixing private and restricted VIPs, causes failures that teams "fix" by adding external IPs.
- Relying on the network to protect API credentials: a leaked service account key works from any internet host against the default API domains, whatever the firewall says. Perimeters and keyless authentication are the fix, not firewall rules.
Practitioner checklist
- skipDefaultNetworkCreation is enforced and no project still has a default network.
- An organisation hierarchical policy denies internet ingress to admin ports, allowing only the IAP range.
- Allow rules target service accounts or secure tags; network-tag rules are on a migration list.
- compute.securityAdmin and Shared VPC Admin are held by small groups; compute.networkUser is granted per subnet.
- vmExternalIpAccess, restrictVpcPeering, restrictSharedVpcSubnetworks and vmCanIpForward constraints are enforced.
- Sensitive subnets use Private Google Access with restricted.googleapis.com inside a VPC Service Controls perimeter.
- VPC Flow Logs and firewall logging on key rules are exported to the SIEM with retention beyond 30 days.
- Alerts exist for firewall, policy association, route and peering changes in Admin Activity logs.
- The Cloud NGFW tier is chosen per tier of workload, with IPS endpoints in every zone that hosts internet-facing workloads.
Standards and references
- Google Cloud: Cloud NGFW overview
- Google Cloud: Policy and rule evaluation order
- Google Cloud: VPC firewall rules
- Google Cloud: Shared VPC
- Google Cloud: Configure Private Google Access
- Google Cloud: VPC Flow Logs
- Google Cloud: Use IAP for TCP forwarding
- NIST: SP 800-53 Rev. 5
Related NHI Mgmt Group resources: Google Cloud Security Guide · Cloud Network Security Guide · Google Cloud Enterprise Foundations Blueprint Guide · VPC Service Controls Guide · GKE Security Hardening Guide