Interview Prep/Networking/Cloud networking: VPC, firewalls, NAT, VPN and proxies

A GCP VM without an external IP can't reach the internet, and an ingress firewall rule you added for port 8080 doesn't work either.

IntermediateTroubleshootingCloud networking: VPC, firewalls, NAT, VPN and proxies
Answer

Likely causes → No Cloud NAT configured on the Cloud Router for that region/subnet, so there's no egress path. For the ingress rule: GCP firewall rules apply via target tags or service accounts; the VM doesn't have the tag, or a higher-priority deny rule wins.

Diagnose →

gcloud compute routers nats list --router=<router> --region=<region>
gcloud compute instances describe <vm> --zone=<zone> --format='value(tags.items)'
gcloud compute firewall-rules list --filter="network=<vpc>" \
  --format='table(name,direction,priority,sourceRanges.list(),allowed[].map().firewall_rule().list(),targetTags.list())'

Connectivity Tests (gcloud network-management connectivity-tests create) shows which rule blocks.

Fix → Create a Cloud Router + Cloud NAT for the subnet, and add the right network tag to the VM (or fix rule priority).

Prevent → Use service-account-based firewall targets and enable firewall rule logging on critical rules.

All Networking questions Roadmap: Networking for DevOps

More on Cloud networking: VPC, firewalls, NAT, VPN and proxies