6οΈβ£ Networking¶
Complete guide to Google Cloud Platform networking - one of the most critical skills for cloud architects.
π What You'll Learn¶
Master GCP networking to build secure, scalable, and high-performance cloud architectures:
- VPC Fundamentals: Virtual Private Cloud design and implementation
- Network Connectivity: Connect resources securely
- Traffic Management: Load balancing and routing
- Security: Firewall rules and network isolation
- Hybrid Cloud: Connect on-premises to GCP
- Performance: CDN, DNS, and optimization
π Table of Contents¶
1. VPC (Virtual Private Cloud)¶
Foundation of GCP Networking
Topics Covered:
β’ VPC architecture and concepts
β’ Auto mode vs Custom mode VPCs
β’ VPC network characteristics
β’ Shared VPC
β’ VPC peering
β’ VPC network design patterns
β’ Best practices
Key Concepts: - Global VPC networks - Regional subnets - Software-defined networking - Network isolation
2. Subnets¶
IP Address Management
Topics Covered:
β’ Subnet creation and management
β’ Primary and secondary IP ranges
β’ Subnet expansion
β’ Regional subnets
β’ Private Google Access
β’ Subnet design patterns
β’ CIDR planning
Key Concepts: - Regional scope - IP address allocation - Subnet sizing - Secondary ranges for GKE
3. Firewall Rules¶
Network Security
Topics Covered:
β’ Firewall rule structure
β’ Ingress and egress rules
β’ Priority and evaluation
β’ Target tags and service accounts
β’ Firewall logs
β’ Common firewall patterns
β’ Security best practices
Key Concepts: - Stateful firewall - Implicit deny - Rule priority - Network tags
4. IP Addressing¶
Public and Private IPs
Topics Covered:
β’ Internal (private) IP addresses
β’ External (public) IP addresses
β’ Ephemeral vs static IPs
β’ IP address reservation
β’ Alias IP ranges
β’ IPv6 support
β’ IP address planning
Key Concepts: - RFC 1918 private ranges - External IP costs - Static IP reservation - Bring Your Own IP (BYOIP)
5. Routing¶
Traffic Direction
Topics Covered:
β’ Route types (system, custom, peering)
β’ Route priority
β’ Next hop types
β’ Policy-based routing
β’ Route advertisements
β’ Multi-NIC routing
β’ Troubleshooting routes
Key Concepts: - Default internet gateway - Route tables - Next hop selection - Route propagation
6. Cloud NAT¶
Outbound Internet Access
Topics Covered:
β’ Cloud NAT architecture
β’ NAT gateway configuration
β’ IP address allocation
β’ Port allocation
β’ Logging and monitoring
β’ High availability
β’ Cost optimization
Key Concepts: - Managed NAT service - No external IPs needed - Regional service - Automatic scaling
7. Load Balancing¶
Traffic Distribution
Topics Covered:
β’ Load balancer types
β’ Global vs Regional LBs
β’ HTTP(S) Load Balancing
β’ TCP/UDP Load Balancing
β’ Internal Load Balancing
β’ Backend services
β’ Health checks
Key Concepts: - Anycast IP - Cross-region load balancing - SSL termination - Session affinity
8. Cloud DNS¶
Domain Name System
Topics Covered:
β’ Public DNS zones
β’ Private DNS zones
β’ DNS records management
β’ DNSSEC
β’ DNS policies
β’ Split-horizon DNS
β’ Performance optimization
Key Concepts: - Managed DNS service - 100% SLA - Global anycast network - Low latency
9. Cloud CDN¶
Content Delivery Network
Topics Covered:
β’ CDN architecture
β’ Cache configuration
β’ Cache invalidation
β’ Signed URLs and cookies
β’ Custom origins
β’ Performance optimization
β’ Cost management
Key Concepts: - Edge caching - Global distribution - Cache hit ratio - Origin shielding
10. Cloud VPN¶
Hybrid Connectivity
Topics Covered:
β’ Classic VPN
β’ HA VPN (recommended)
β’ VPN tunnels
β’ BGP routing
β’ IPsec configuration
β’ Redundancy and HA
β’ Troubleshooting
Key Concepts: - Site-to-site VPN - 99.99% SLA (HA VPN) - Encrypted tunnels - Hybrid cloud
11. Cloud Interconnect¶
Dedicated Connectivity
Topics Covered:
β’ Dedicated Interconnect
β’ Partner Interconnect
β’ VLAN attachments
β’ Bandwidth options
β’ Redundancy design
β’ Cost comparison
β’ Use cases
Key Concepts: - Private connectivity - Higher bandwidth - Lower latency - Predictable performance
12. Network Security¶
Advanced Security
Topics Covered:
β’ Cloud Armor (DDoS protection)
β’ VPC Service Controls
β’ Private Service Connect
β’ SSL policies
β’ Network security best practices
β’ Zero-trust networking
β’ Compliance
Key Concepts: - Defense in depth - Security perimeters - Private connectivity - DDoS mitigation
π GCP Network Architecture¶
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β GCP Global Network β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
ββββββββββββββββββββ
β Internet β
β Users β
ββββββββββ¬ββββββββββ
β
ββββββββββΌββββββββββ
β Cloud CDN β β Edge caching
β (Global) β 200+ PoPs
ββββββββββ¬ββββββββββ
β
ββββββββββΌββββββββββ
β Global Load β β Anycast IP
β Balancer β SSL termination
ββββββββββ¬ββββββββββ
β
ββββββββββββββββΌβββββββββββββββ
β β β
βββββββΌββββββ ββββββΌβββββ βββββββΌββββββ
β Region 1 β βRegion 2 β β Region 3 β
β us-cent1 β βeu-west1 β βasia-se1 β
βββββββ¬ββββββ ββββββ¬βββββ βββββββ¬ββββββ
β β β
βββββββΌββββββ βββββΌβββββ ββββββΌββββββ
β VPC β β VPC β β VPC β
β Network β β Networkβ β Network β
βββββββ¬ββββββ βββββ¬βββββ ββββββ¬ββββββ
β β β
βββββββΌββββββ ββββΌββββββ βββββΌβββββββ
β Subnets β βSubnets β β Subnets β
β 10.0.x.x β β10.1.x.xβ β10.2.x.x β
βββββββ¬ββββββ βββββ¬βββββ ββββββ¬ββββββ
β β β
βββββββΌββββββ ββββΌββββββ βββββΌβββββββ
β VMs β β VMs β β VMs β
β GKE β β GKE β β GKE β
β Services β βServicesβ β Services β
βββββββββββββ ββββββββββ ββββββββββββ
Key Features:
β’ Global VPC (spans all regions)
β’ Regional subnets
β’ Private Google network
β’ No inter-region bandwidth charges
β’ Software-defined networking
π‘ Key Networking Concepts¶
1. VPC Network Scope¶
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β VPC Network Characteristics β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β β
β Global Scope: β
β β’ VPC spans all GCP regions β
β β’ Single VPC across multiple regions β
β β’ No region boundaries β
β β
β Regional Subnets: β
β β’ Subnets are regional resources β
β β’ Each subnet in one region β
β β’ Multiple subnets per region β
β β
β Benefits: β
β β’ Simplified network architecture β
β β’ Easy multi-region deployment β
β β’ No VPN between regions β
β β’ Consistent security policies β
β β
β Example: β
β VPC: prod-vpc (global) β
β ββ Subnet: us-central1 (10.0.1.0/24) β
β ββ Subnet: europe-west1 (10.0.2.0/24) β
β ββ Subnet: asia-southeast1 (10.0.3.0/24) β
β β
β VMs in different regions can communicate directly β
β using internal IPs without VPN or peering β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
2. Network Tiers¶
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Premium Tier vs Standard Tier β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Premium Tier (Default):
βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β User β Edge PoP β Google Network β Destination β
β (Enters Google network immediately) β
β β
β Benefits: β
β β’ Lowest latency β
β β’ Highest reliability β
β β’ Global load balancing β
β β’ Better performance β
β β’ SLA guarantees β
β β
β Cost: Higher β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Standard Tier:
βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β User β ISP β Internet β Region β Destination β
β (Uses public internet) β
β β
β Trade-offs: β
β β’ Lower cost (50% cheaper) β
β β’ Higher latency β
β β’ Less reliable β
β β’ Regional load balancing only β
β β’ No global LB β
β β
β Cost: Lower β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Use Cases:
Premium: Production apps, global users, low latency
Standard: Cost-sensitive, regional apps, batch jobs
3. Private vs Public IP¶
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β IP Address Types β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β β
β Internal (Private) IP: β
β β’ RFC 1918 ranges (10.x, 172.16-31.x, 192.168.x) β
β β’ Free (no cost) β
β β’ Not routable on internet β
β β’ Used for internal communication β
β β’ Assigned to all VMs β
β β
β External (Public) IP: β
β β’ Routable on internet β
β β’ Costs money (charged per hour) β
β β’ Optional (not required) β
β β’ Ephemeral or static β
β β’ Used for internet access β
β β
β Best Practice: β
β β’ Use internal IPs for inter-VM communication β
β β’ Use Cloud NAT for outbound internet β
β β’ Minimize external IPs (cost + security) β
β β’ Use load balancers for inbound traffic β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
ποΈ Common Network Architectures¶
1. Single Region Architecture¶
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Single Region Deployment β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Internet
β
βΌ
βββββββββββββββββββββββ
β Global Load β
β Balancer β
β (External IP) β
ββββββββββββ¬βββββββββββ
β
ββββββββΌβββββββ
β Region: β
β us-central1β
ββββββββ¬βββββββ
β
ββββββββΌβββββββββββββββββββββββββββ
β VPC: prod-vpc β
β β
β βββββββββββββββββββββββββββββββ
β β Subnet: web-tier ββ
β β 10.0.1.0/24 ββ
β β ββββββ ββββββ ββββββ ββ
β β βVM-1β βVM-2β βVM-3β ββ
β β ββββββ ββββββ ββββββ ββ
β βββββββββββββββββββββββββββββββ
β β
β βββββββββββββββββββββββββββββββ
β β Subnet: app-tier ββ
β β 10.0.2.0/24 ββ
β β ββββββ ββββββ ββ
β β βVM-4β βVM-5β ββ
β β ββββββ ββββββ ββ
β βββββββββββββββββββββββββββββββ
β β
β βββββββββββββββββββββββββββββββ
β β Subnet: db-tier ββ
β β 10.0.3.0/24 ββ
β β ββββββββββββ ββ
β β βCloud SQL β ββ
β β ββββββββββββ ββ
β βββββββββββββββββββββββββββββββ
βββββββββββββββββββββββββββββββββββ
Firewall Rules:
β’ Allow HTTP/HTTPS to web-tier
β’ Allow app-tier to web-tier
β’ Allow db-tier to app-tier
β’ Deny all other traffic
2. Multi-Region Architecture¶
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Multi-Region Global Deployment β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Internet
β
βΌ
ββββββββββββββββββββ
β Global Load β β Anycast IP
β Balancer β (1.2.3.4)
β + Cloud CDN β
ββββββββββ¬ββββββββββ
β
ββββββββββββββΌβββββββββββββ
β β β
ββββββΌβββββ βββββΌβββββ βββββΌβββββ
βus-cent1 β βeu-west1β βasia-se1β
β β β β β β
βSubnet: β βSubnet: β βSubnet: β
β10.0.1.x β β10.0.2.xβ β10.0.3.xβ
β β β β β β
βββββββββ β ββββββββββ ββββββββββ
ββ VMs β β ββ VMs ββ ββ VMs ββ
ββ GKE β β ββ GKE ββ ββ GKE ββ
βββββββββ β ββββββββββ ββββββββββ
βββββββββββ ββββββββββ ββββββββββ
β β β
ββββββββββββββ΄βββββββββββββ
Cloud Spanner
(Global Database)
Benefits:
β’ Low latency worldwide
β’ High availability
β’ Disaster recovery
β’ Automatic failover
3. Hybrid Cloud Architecture¶
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Hybrid Cloud with VPN β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
On-Premises Data Center Google Cloud Platform
βββββββββββββββββββββββ βββββββββββββββββββββββ
β β β β
β Network: β β VPC: prod-vpc β
β 192.168.0.0/16 β β β
β β β Subnet: β
β βββββββββββββββββ β β 10.0.1.0/24 β
β β Servers β β β β
β β Databases β β β βββββββββββββββββ β
β β Applications β β β β VMs β β
β βββββββββββββββββ β β β GKE β β
β β β β β Cloud SQL β β
β β β β βββββββββββββββββ β
β ββββββββΌβββββββββ β β β β
β β VPN Gateway βββΌβββββββββββΌβββββββββΊβ β
β β (On-prem) β β IPsec β Cloud VPN Gateway β
β βββββββββββββββββ β Tunnel β (HA VPN) β
βββββββββββββββββββββββ βββββββββββββββββββββββ
Features:
β’ Secure encrypted tunnel
β’ Private IP connectivity
β’ BGP routing
β’ 99.99% SLA (HA VPN)
β’ Hybrid workloads
π Quick Start Guide¶
Step 1: Create VPC Network¶
# Create custom VPC
gcloud compute networks create prod-vpc \
--subnet-mode=custom \
--bgp-routing-mode=regional
# Create subnet
gcloud compute networks subnets create web-subnet \
--network=prod-vpc \
--region=us-central1 \
--range=10.0.1.0/24
Step 2: Create Firewall Rules¶
# Allow SSH from specific IP
gcloud compute firewall-rules create allow-ssh \
--network=prod-vpc \
--allow=tcp:22 \
--source-ranges=203.0.113.0/24
# Allow HTTP/HTTPS
gcloud compute firewall-rules create allow-web \
--network=prod-vpc \
--allow=tcp:80,tcp:443 \
--source-ranges=0.0.0.0/0 \
--target-tags=web-server
Step 3: Create VM with Network¶
# Create VM in custom network
gcloud compute instances create web-vm \
--zone=us-central1-a \
--machine-type=e2-medium \
--network=prod-vpc \
--subnet=web-subnet \
--tags=web-server \
--no-address # No external IP (use Cloud NAT)
Step 4: Set Up Cloud NAT¶
# Create Cloud Router
gcloud compute routers create nat-router \
--network=prod-vpc \
--region=us-central1
# Create Cloud NAT
gcloud compute routers nats create nat-config \
--router=nat-router \
--region=us-central1 \
--auto-allocate-nat-external-ips \
--nat-all-subnet-ip-ranges
Step 5: Create Load Balancer¶
# Create instance group
gcloud compute instance-groups managed create web-group \
--base-instance-name=web \
--template=web-template \
--size=3 \
--zone=us-central1-a
# Create health check
gcloud compute health-checks create http web-health-check \
--port=80
# Create backend service
gcloud compute backend-services create web-backend \
--protocol=HTTP \
--health-checks=web-health-check \
--global
# Add instance group to backend
gcloud compute backend-services add-backend web-backend \
--instance-group=web-group \
--instance-group-zone=us-central1-a \
--global
π Network Performance¶
Latency Optimization¶
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Latency Reduction Strategies β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β β
β 1. Use Premium Network Tier β
β β’ Traffic on Google's network β
β β’ Lower latency β
β β
β 2. Deploy in Multiple Regions β
β β’ Closer to users β
β β’ Global load balancing β
β β
β 3. Enable Cloud CDN β
β β’ Edge caching β
β β’ 200+ PoPs worldwide β
β β
β 4. Use Regional Resources β
β β’ Reduce cross-region traffic β
β β’ Keep data close to compute β
β β
β 5. Optimize DNS β
β β’ Use Cloud DNS β
β β’ Low TTL for failover β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
π° Network Costs¶
Cost Components¶
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Network Pricing β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β β
β Free: β
β β’ Ingress (incoming traffic) β
β β’ Traffic within same zone β
β β’ Traffic between zones in same region (internal IP) β
β β’ Internal IP communication β
β β
β Charged: β
β β’ Egress to internet ($0.12/GB) β
β β’ Cross-region traffic ($0.01/GB) β
β β’ External IP addresses ($0.004/hour) β
β β’ Load balancer usage β
β β’ VPN tunnels ($0.05/hour) β
β β’ Cloud NAT ($0.045/hour + data) β
β β
β Cost Optimization: β
β β Use internal IPs β
β β Minimize external IPs β
β β Use Cloud CDN for static content β
β β Keep traffic in same region β
β β Use Standard tier for non-critical β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Networking Checklist¶
Design Phase¶
- [ ] Plan IP address ranges (avoid conflicts)
- [ ] Design VPC architecture
- [ ] Plan subnet layout
- [ ] Document network topology
- [ ] Plan firewall rules
- [ ] Design for high availability
Implementation Phase¶
- [ ] Create VPC networks
- [ ] Create subnets
- [ ] Configure firewall rules
- [ ] Set up Cloud NAT
- [ ] Configure load balancers
- [ ] Set up DNS records
Security Phase¶
- [ ] Implement least privilege firewall rules
- [ ] Enable VPC Flow Logs
- [ ] Configure Cloud Armor
- [ ] Set up VPC Service Controls
- [ ] Enable Private Google Access
- [ ] Audit network access
Operations Phase¶
- [ ] Monitor network performance
- [ ] Set up alerting
- [ ] Regular security audits
- [ ] Document changes
- [ ] Test disaster recovery
- [ ] Optimize costs
π Next Steps¶
After mastering GCP Networking:
- Compute Services - Deploy workloads
- Storage & Databases - Data management
- Security - Advanced security features
- Monitoring - Network observability
- Hybrid Cloud - Connect on-premises
Last Updated: March 2026 Version: 2.0