6.1 VPC Design, Subnets, Shared VPC & VPC Peering
Key Takeaways
- Google Cloud Virtual Private Clouds (VPCs) are global software-defined networking resources that span all regions without inter-region gateways, containing regional subnets that host zonal compute resources.
- Auto mode VPCs create a /20 subnet in every region using the 10.128.0.0/9 CIDR block, introducing severe IP overlap risks; production enterprise architectures mandate custom mode VPCs with tailored IP space planning.
- Shared VPC establishes centralized network administration by designating a Host Project managed by Network Admins while delegating compute resource deployment to Service Projects via granular subnet-level IAM permissions.
- VPC Network Peering enables decentralized, private, low-latency communication between independent VPCs; peering is strictly non-transitive, requires non-overlapping RFC 1918 CIDRs, and supports custom route import/export.
- Private Google Access (PGA) allows internal-only instances to reach Google APIs without external IP addresses, while Private Service Connect (PSC) provides secure consumer-producer service publishing over private IP endpoints.
VPC Design, Subnets, Shared VPC & VPC Peering
Core Principle: In Google Cloud, the Virtual Private Cloud (VPC) is not a physical router or regional container—it is a global, software-defined network (SDN) built on Google's Andromeda network virtualization stack. A single VPC network spans every Google Cloud region worldwide without requiring inter-region VPN tunnels or complex routing gateways. Architecting an enterprise Google Cloud network requires mastering global VPC primitives, multi-project connectivity models, and secure private access mechanisms.
Virtual Private Cloud (VPC) Fundamentals & Global Scope
Unlike traditional on-premises networks and other major cloud providers where virtual networks are bound to a single geographic datacenter or region, a Google Cloud VPC is inherently global.
+-----------------------------------------------------------------------------------------+
| GLOBAL VPC NETWORK |
| |
| +-----------------------------+ +-------------------------+ |
| | Region: us-central1 | Google Andromeda SDN | Region: europe-west1 | |
| | Subnet: 10.10.0.0/20 | <=======================> | Subnet: 10.20.0.0/20 | |
| | VM: 10.10.0.4 (Zone a) | Encrypted Global Fiber | VM: 10.20.0.8 (Zone b) | |
| +-----------------------------+ +-------------------------+ |
+-----------------------------------------------------------------------------------------+
Key Characteristics of Global VPCs
- Global Control Plane & Routing: The VPC routing table is global. A virtual machine in
us-central1can communicate directly with a virtual machine ineurope-west1orasia-east1using internal RFC 1918 IP addresses. Packets traverse Google's private global fiber backbone with high throughput and low latency, never touching the public internet. - Regional Subnets: While the VPC itself is global, subnets are regional resources. Each subnet defines a contiguous IP address range (CIDR block) within a specific Google Cloud region.
- Zonal Compute Placement: Compute resources (Compute Engine virtual machines, Google Kubernetes Engine nodes) are zonal resources instantiated within a specific zone (e.g.,
us-central1-a) and allocated an IP address from that region's subnet CIDR range.
Auto Mode vs. Custom Mode VPC Networks
Google Cloud provides two creation modes for VPC networks: Auto Mode and Custom Mode.
| Architectural Attribute | Auto Mode VPC | Custom Mode VPC |
|---|---|---|
| Subnet Creation | Automatically creates one /20 subnet in every GCP region. | Zero subnets created by default; architect defines each subnet manually. |
| IP Address Allocation | Uses fixed, predefined IP ranges within 10.128.0.0/9. | Architect selects arbitrary RFC 1918 CIDR blocks (e.g., 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16). |
| New Region Behavior | Automatically creates a new /20 subnet whenever Google launches a new region. | New regions have no subnets until explicitly provisioned by the architect. |
| Default Firewall Rules | Generates pre-populated rules allowing SSH, RDP, ICMP, and internal traffic. | Zero firewall rules created; all ingress traffic is denied by default. |
| CIDR Overlap Risk | Extremely high when interconnecting with on-premises networks or peered VPCs. | Zero (provided an enterprise IP address management [IPAM] plan is enforced). |
| Enterprise Recommendation | Prototyping, sandbox exploration, and introductory labs only. | Mandatory for all enterprise production and multi-cloud architectures. |
+-----------------------------------------------------------------------------------------+
| VPC SUBNET CONVERSION PATH |
| |
| [ Auto Mode VPC ] ======( gcloud compute networks switch-mode )=====> [ Custom Mode ]|
| * Note: Conversion is ONE-WAY. A Custom Mode VPC can NEVER be reverted to Auto Mode. |
+-----------------------------------------------------------------------------------------+
[!CAUTION] Auto Mode Overlap Hazard: Auto Mode VPCs allocate subnets from the contiguous
10.128.0.0/9address space. If two different projects use Auto Mode VPCs, their subnets will share identical CIDR blocks (e.g.,10.128.0.0/20forus-central1), making VPC Network Peering and Cloud VPN connections impossible due to routing collisions. Always build enterprise networks in Custom Mode.
Primary and Secondary IP Ranges (Alias IPs)
In standard compute deployments, each virtual machine interface (vNIC) is allocated a single primary private IP address from the subnet's primary CIDR range. However, modern containerized platforms such as Google Kubernetes Engine (GKE) require multiple distinct IP addresses per node to assign directly to container Pods and Services.
+-----------------------------------------------------------------------------------------+
| SUBNET IP RANGE ARCHITECTURE (GKE) |
| |
| Subnet CIDR Range: |
| - Primary Range: 10.100.0.0/20 (Allocated to GKE Node VM vNICs) |
| - Secondary Range 1: 10.101.0.0/16 (Allocated to GKE Pods via Alias IPs) |
| - Secondary Range 2: 10.102.0.0/20 (Allocated to GKE ClusterIP Services) |
+-----------------------------------------------------------------------------------------+
Alias IP Ranges & Container-Native Routing
- Primary Subnet Range: Sized to accommodate node instances, internal load balancers, and managed infrastructure VMs.
- Secondary Subnet Ranges: Designated address pools attached to the subnet. In VPC-native GKE clusters, Kubernetes assigns Pod IP addresses directly from secondary IP ranges using Alias IP functionality.
- Benefits of VPC-Native Alias IPs:
- Direct Routing: Pod IPs are first-class citizens in the Google Cloud SDN routing table; traffic between Pods on different nodes does not require packet overlay encapsulation (e.g., VXLAN/Flannel) or node-level iptables NAT.
- Security & Observability: VPC Flow Logs and Cloud Armor can inspect and filter traffic down to individual Pod IP endpoints.
- IP Expansion: Subnet primary and secondary ranges can be expanded non-disruptively to accommodate cluster growth without recreating the subnet (provided contiguous address space is available).
Shared VPC Architecture (Centralized Network Administration)
In multi-project enterprise organizations, managing independent VPCs in every project leads to security fragmentation, administrative sprawl, and massive routing complexity. Shared VPC is the primary Google Cloud pattern for enterprise network centralization.
+-----------------------------------------------------------------------------------------+
| SHARED VPC HOST PROJECT |
| |
| VPC Network: production-vpc (Global) |
| +-------------------------------------+ +-----------------------------------------+ |
| | Subnet A: 10.10.0.0/20 (us-central1)| | Subnet B: 10.20.0.0/20 (europe-west1) | |
| +-------------------------------------+ +-----------------------------------------+ |
| | Centralized Cloud NAT, Cloud Interconnect, HA VPN, Cloud DNS, Firewall Rules | |
+------------------------------------+----------------------------------------------------+
| Shared Subnet Access (IAM Delegation)
+-------------------+-------------------+
| |
v v
+---------------------------------+ +---------------------------------+
| SERVICE PROJECT 1 | | SERVICE PROJECT 2 |
| (Payments Team) | | (Analytics Team) |
| | | |
| - GKE Clusters in Subnet A | | - Compute Engine in Subnet B |
| - Cloud SQL Private Instances | | - Dataproc Clusters in Subnet B|
| - Billed to Payments Project | | - Billed to Analytics Project |
+---------------------------------+ +---------------------------------+
Structural Components & Roles
- Host Project: A centralized Google Cloud project designated as the owner of the Shared VPC network, subnets, firewall rules, Cloud NAT gateways, and hybrid connectivity attachments (Cloud Interconnect / Cloud VPN).
- Service Projects: Application-specific projects attached to the Host Project. Workloads in service projects (Compute Engine VMs, GKE clusters, Cloud Run via serverless VPC access) attach their virtual interfaces directly to the shared subnets in the Host Project.
- Administrative Separation of Duties (IAM):
- Shared VPC Admin (
roles/compute.xpnAdmin): Granted only at the Organization or Folder level. Authorizes network security engineers to designate host projects and attach service projects. - Service Project Admin (
roles/compute.networkUser): Granted at the Host Project level or on specific subnets. Allows developers in service projects to instantiate compute resources attached to authorized subnets without granting them permission to modify firewall rules, routes, or network topology.
- Shared VPC Admin (
Subnet-Level IAM Principle of Least Privilege
An architect can restrict Service Project 1 (e.g., Payment Processing) to use only Subnet A in us-central1, while Service Project 2 (e.g., Marketing Analytics) is restricted to Subnet B in europe-west1. This prevents application teams from provisioning workloads into unauthorized regions or overlapping network segments.
VPC Network Peering (Decentralized Multi-VPC Connectivity)
When independent business units, autonomous subsidiaries, or third-party SaaS partners require private network interconnectivity without sharing administrative control, VPC Network Peering provides high-speed, decentralized connectivity.
+---------------------------+ +---------------------------+
| ORGANIZATION A | | ORGANIZATION B |
| Project: corp-fintech | | Project: partner-saas |
| VPC: internal-vpc | VPC Network Peering | VPC: saas-prod-vpc |
| CIDR: 10.100.0.0/16 | <=====================> | CIDR: 10.200.0.0/16 |
| (VM: 10.100.1.5) | (0 ms Gateway Latency)| (VM: 10.200.50.2) |
+---------------------------+ +---------------------------+
Peering Rules, Constraints & The Non-Transitive Law
- Bidirectional Agreement: Peering is not established until both network administrators create a peering connection pointing to the other VPC. If VPC-A initiates peering to VPC-B, no traffic flows until VPC-B explicitly creates a reciprocal peering connection to VPC-A.
- Non-Overlapping CIDRs: Peering will fail immediately if any subnet CIDR block in VPC-A overlaps with any subnet CIDR block in VPC-B (including primary and secondary ranges).
- Zero Gateway Latency: Peering introduces zero packet latency and zero throughput bottlenecks because routing is executed directly within the Andromeda SDN kernel—no intermediary proxy or VPN gateway VM is traversed.
+-----------------------------------------------------------------------------------------+
| THE NON-TRANSITIVE PEERING RULE |
| |
| [ VPC-A: 10.1.0.0/16 ] <====== Peered ======> [ VPC-B: 10.2.0.0/16 ] |
| ^ |
| | Peered |
| v |
| [ VPC-C: 10.3.0.0/16 ] |
| |
| * Result: VPC-A can talk to VPC-B. VPC-B can talk to VPC-C. |
| * TRANSIT IS BLOCKED: VPC-A CANNOT communicate with VPC-C through VPC-B! |
+-----------------------------------------------------------------------------------------+
Custom Route Exchange Over Peering
By default, VPC Peering exchanges only subnet routes (RFC 1918 internal subnets). To share on-premises routes (learned via Cloud Interconnect/HA VPN) or custom static routes across a peering connection, both sides must explicitly configure:
--import-custom-routes: Instructs the local VPC to accept custom routes advertised by the peer.--export-custom-routes: Instructs the local VPC to send its custom static and dynamic routes to the peer.
Private Service Consumption: PGA vs. PSC
Securing access to managed Google APIs and internal SaaS services without exposing workloads to the public internet is a cornerstone of enterprise security architecture.
+-----------------------------------------------------------------------------------------+
| PRIVATE GOOGLE ACCESS vs. PRIVATE SERVICE CONNECT |
+-----------------------------------------------------------------------------------------+
| 1. PRIVATE GOOGLE ACCESS (PGA) |
| - Subnet-level flag (enablePrivateGoogleAccess: true). |
| - Allows VMs without external public IPs to access *.googleapis.com. |
| - Routes to Google VIPs (199.36.153.8/30 restricted or 199.36.153.4/30 private). |
| - Enforces VPC Service Controls (VPC-SC) perimeters. |
+-----------------------------------------------------------------------------------------+
| 2. PRIVATE SERVICE CONNECT (PSC) |
| - Consumer-Producer architectural pattern using internal IP Endpoints. |
| - Consumer provisions an internal Forwarding Rule (e.g., 10.10.5.50). |
| - Producer publishes a Service Attachment behind an Internal Load Balancer. |
| - Supports overlapping IP spaces between organizations via automatic NAT. |
| - Eliminates VPC Peering route limits and non-transitive routing constraints. |
+-----------------------------------------------------------------------------------------+
Architectural Comparison Matrix
| Feature | Shared VPC | VPC Network Peering | Private Google Access | Private Service Connect |
|---|---|---|---|---|
| Primary Objective | Centralized enterprise network governance. | Interconnecting independent VPC networks. | Internal access to Google APIs (Cloud Storage, BigQuery). | Private consumption of third-party/managed services. |
| Administrative Scope | Single organization (multi-project). | Cross-project / Cross-organization. | Subnet-level configuration within a single VPC. | Cross-project, cross-VPC, and cross-organization. |
| IP Address Constraint | Unified, non-overlapping IPAM plan. | Strictly non-overlapping RFC 1918 CIDRs. | Uses standard Google API virtual VIPs. | Overlapping IP spaces fully supported (NAT-encapsulated). |
| Routing Transitivity | Fully transitive across all subnets in the VPC. | Non-transitive (strictly point-to-point). | N/A (Applies to Google API endpoints). | Point-to-point endpoint forwarding. |
| VPC-SC Support | Enforced via perimeter boundaries. | Enforced across peered projects. | Requires restricted.googleapis.com VIP. | Supported natively via PSC endpoints. |
Concrete Architectural Scenario: Multi-Tier Financial Banking Platform
Scenario Profile
- Organization: Global Financial Institution migrating core retail banking and wealth management systems.
- Requirements:
- Centralized network security and egress inspection managed strictly by the Cloud Network Operations team.
- Isolation between Retail Banking (Team A) and Wealth Management (Team B) workloads.
- Workloads must access Google Cloud Storage and BigQuery without traversing the public internet, satisfying PCI-DSS and VPC Service Controls.
- An external payment fraud analytics SaaS hosted in a separate GCP organization must be accessed privately, but the SaaS provider uses the same
10.10.0.0/16IP range.
Solution Architecture Blueprint
- Shared VPC Deployment: Create a dedicated
net-host-prodproject. Establish a custom mode VPC withsubnet-retail-us(10.50.0.0/20) andsubnet-wealth-us(10.60.0.0/20). - Granular IAM Binding: Assign
roles/compute.networkUseronsubnet-retail-usexclusively to the Retail Banking Service Project, and onsubnet-wealth-usexclusively to the Wealth Management Service Project. - Private Google Access: Enable Private Google Access on all subnets. Configure internal DNS zones mapping
*.googleapis.comtorestricted.googleapis.com(199.36.153.8/30) to enforce VPC Service Controls data exfiltration perimeters. - Private Service Connect for SaaS: Deploy a PSC Endpoint in
subnet-retail-usallocated with IP10.50.0.99mapped to the SaaS provider's Service Attachment. This completely bypasses the10.10.0.0/16CIDR collision and provides private, encrypted Layer 4 connectivity.
[!IMPORTANT] Exam Watch: On the Google Cloud Architect exam, whenever two VPC networks have overlapping CIDR ranges and must exchange service traffic, VPC Network Peering is impossible. The correct architectural solution is Private Service Connect (PSC). If a question asks how to allow developers in a service project to create VMs while preventing them from modifying network topology or seeing other teams' subnets, grant
roles/compute.networkUserscoped to individual subnets in the Host Project.
An enterprise organization utilizes a Shared VPC topology where the central networking team manages the Host Project. The security team mandates that the Development Team (managing Service Project Dev) must be able to provision Compute Engine instances in us-central1, but must NOT be permitted to deploy instances into the production subnet in us-east1 or alter any VPC firewall rules. How should the Cloud IAM roles be configured?
A solutions architect has configured VPC Network Peering between VPC-A (10.1.0.0/16) and VPC-B (10.2.0.0/16), and also configured VPC Network Peering between VPC-B (10.2.0.0/16) and VPC-C (10.3.0.0/16). A virtual machine in VPC-A attempts to send packets to an internal database VM in VPC-C (10.3.0.45). What occurs, and why?
A company is designing a large-scale Google Kubernetes Engine (GKE) environment using a VPC-native cluster architecture. During cluster planning, the network team needs to ensure that Pods can communicate directly with on-premises resources over Cloud Interconnect without Network Address Translation (NAT). What subnet configuration is mandatory for this architecture?
A financial analytics company needs to securely consume a database service hosted in an external vendor's Google Cloud project. Both the financial company and the external vendor utilize the 172.16.0.0/16 address space internally. Due to regulatory compliance, no public IP addresses can be used, and data must remain completely on Google's private network. Which solution solves this requirement without IP renumbering?