Bird
Raised Fist0
GCPcloud~10 mins

Default VPC and subnets in GCP - Step-by-Step Execution

Choose your learning style10 modes available

Start learning this pattern below

Jump into concepts and practice - no test required

or
Recommended
Test this pattern10 questions across easy, medium, and hard to know if this pattern is strong
Process Flow - Default VPC and subnets
Create Default VPC
Auto-create Subnets in each region
Assign default firewall rules
Ready for VM instances to use
User can modify or add resources
The cloud automatically creates a default network with subnets in each region and sets firewall rules so you can start using it immediately.
Execution Sample
GCP
gcloud compute networks describe default
# Shows default VPC and its subnets
This command shows the default VPC and the subnets created automatically in each region.
Process Table
StepActionResultDetails
1Create new GCP projectProject createdNo VPC yet
2Default VPC auto-createdVPC named 'default' existsNetwork with auto mode
3Subnets auto-createdOne subnet per regionEach subnet has a CIDR block
4Default firewall rules appliedRules allow SSH, RDP, ICMPBasic security rules set
5User launches VMVM attached to default subnetVM gets internal IP from subnet
6User modifies firewallRules updatedCan allow/block traffic
7User adds custom subnetNew subnet createdUser controls IP range
8EndDefault VPC ready for useUser can build on this network
💡 Default VPC and subnets are created automatically when a new project is made, ready for use.
Status Tracker
ResourceInitial StateAfter Step 2After Step 3After Step 7Final
VPC NetworkNonedefault VPC existsdefault VPC with subnetsdefault VPC with subnets + custom subnetdefault VPC with all subnets
SubnetsNoneNoneSubnets in all regionsSubnets + 1 custom subnetAll subnets active
Firewall RulesNoneDefault rules appliedDefault rules activeDefault rules + user changesFinal firewall rules set
Key Moments - 3 Insights
Why do I see subnets in all regions even if I didn't create them?
Because the default VPC is in auto mode, it automatically creates one subnet in each region as shown in execution_table step 3.
Can I delete the default VPC or its subnets?
Yes, but you must first delete or move resources using them. The default VPC is just a starting point, as seen in step 7 where user adds custom subnets.
What firewall rules come with the default VPC?
Default firewall rules allow basic traffic like SSH, RDP, and ICMP, applied automatically at step 4 in the execution_table.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution_table, at which step are subnets created automatically in all regions?
AStep 2
BStep 5
CStep 3
DStep 7
💡 Hint
Check the 'Action' and 'Result' columns for subnet creation in execution_table row 3.
According to variable_tracker, what is the state of firewall rules after step 4?
ADefault firewall rules applied
BNo firewall rules
CUser-defined firewall rules only
DFirewall rules deleted
💡 Hint
Look at the 'Firewall Rules' row and the 'After Step 2' and 'After Step 3' columns in variable_tracker.
If a user adds a custom subnet, which step in execution_table shows this change?
AStep 5
BStep 7
CStep 4
DStep 8
💡 Hint
Look for 'custom subnet' in the 'Action' column of execution_table.
Concept Snapshot
Default VPC is auto-created in new GCP projects.
It has one subnet per region by default.
Default firewall rules allow basic traffic.
Users can add or modify subnets and rules.
Ready to launch VM instances immediately.
Full Transcript
When you create a new Google Cloud project, a default virtual private cloud (VPC) network is automatically created. This default VPC is in auto mode, which means it automatically creates one subnet in each region with a predefined IP range. Along with the network and subnets, default firewall rules are applied to allow common traffic like SSH and ICMP. This setup lets you quickly launch virtual machines without manual network configuration. You can later add custom subnets or modify firewall rules as needed. The execution table shows each step from project creation to adding custom subnets, and the variable tracker shows how the network, subnets, and firewall rules change over time.

Practice

(1/5)
1. What is the Default VPC in Google Cloud Platform?
easy
A. A virtual machine template for quick deployment
B. A custom network you must create manually before use
C. A storage bucket for default files
D. A pre-made network with one subnet per region and default IP ranges

Solution

  1. Step 1: Understand the Default VPC concept

    The Default VPC is a network automatically created by GCP to help users start quickly without manual setup.
  2. Step 2: Identify its features

    It includes one subnet in each region with default IP address ranges, ready for use.
  3. Final Answer:

    A pre-made network with one subnet per region and default IP ranges -> Option D
  4. Quick Check:

    Default VPC = Pre-made network with subnets [OK]
Hint: Default VPC is ready-made with subnets in all regions [OK]
Common Mistakes:
  • Thinking Default VPC is a VM or storage
  • Assuming you must create it manually
  • Confusing it with custom networks
2. Which gcloud command lists the subnets in the Default VPC?
easy
A. gcloud compute networks subnets list --network=default
B. gcloud compute networks list
C. gcloud compute instances list
D. gcloud storage buckets list

Solution

  1. Step 1: Identify the command to list subnets

    The command to list subnets requires 'compute networks subnets list' with a network filter.
  2. Step 2: Specify the Default VPC network

    Using '--network=default' filters subnets belonging to the Default VPC.
  3. Final Answer:

    gcloud compute networks subnets list --network=default -> Option A
  4. Quick Check:

    List subnets in default network = gcloud compute networks subnets list --network=default [OK]
Hint: Use 'subnets list' with --network=default to see Default VPC subnets [OK]
Common Mistakes:
  • Using 'networks list' which shows networks, not subnets
  • Listing instances or storage buckets instead
  • Omitting the network filter
3. Given the Default VPC has a subnet in us-central1 with IP range 10.128.0.0/20, what is the total number of usable IP addresses in this subnet?
medium
A. 4096 usable IP addresses
B. 4091 usable IP addresses
C. 4094 usable IP addresses
D. 4090 usable IP addresses

Solution

  1. Step 1: Calculate total IPs in a /20 subnet

    A /20 subnet has 2^(32-20) = 4096 total IP addresses.
  2. Step 2: Subtract reserved IPs in GCP subnet

    GCP reserves 5 IPs per subnet (network, gateway, broadcast, and two reserved), so usable IPs = 4096 - 5 = 4091.
  3. Final Answer:

    4091 usable IP addresses -> Option B
  4. Quick Check:

    /20 subnet usable IPs = 4091 [OK]
Hint: Subtract 5 reserved IPs from total in subnet range [OK]
Common Mistakes:
  • Using total IPs without subtracting reserved ones
  • Confusing subnet mask with number of IPs
  • Ignoring GCP reserved IP addresses
4. You try to create a new subnet in the Default VPC with IP range 10.128.0.0/20 but get an error. What is the most likely cause?
medium
A. The IP range overlaps with an existing Default VPC subnet
B. The Default VPC does not allow adding subnets
C. The subnet name is invalid
D. The region is not specified

Solution

  1. Step 1: Identify the type of Default VPC

    The Default VPC is an auto-mode VPC network where subnets are automatically created and managed by GCP.
  2. Step 2: Understand limitations

    You cannot manually create additional subnets in an auto-mode VPC like the Default VPC.
  3. Step 3: Reason about the error cause

    Trying to create a subnet with an IP range that overlaps an existing subnet in the Default VPC causes an error.
  4. Final Answer:

    The IP range overlaps with an existing Default VPC subnet -> Option A
  5. Quick Check:

    Subnet creation error due to overlapping IP range [OK]
Hint: Subnet creation fails if IP range overlaps existing subnet [OK]
Common Mistakes:
  • Thinking IP range overlap is not the cause
  • Assuming Default VPC allows manual subnets like custom VPCs
  • Forgetting to specify region or using invalid name (different errors)
5. You want to create a custom VPC with subnets in three regions without overlapping IP ranges. Which approach best follows GCP best practices?
hard
A. Create multiple Default VPCs, one per region
B. Use the Default VPC and add subnets with overlapping IP ranges
C. Create a custom VPC and assign non-overlapping CIDR blocks for each subnet in different regions
D. Create subnets with the same IP range in different regions inside the same VPC

Solution

  1. Step 1: Understand custom VPC subnet creation

    Custom VPCs allow you to define your own IP ranges and subnets per region.
  2. Step 2: Avoid IP range overlap

    Assigning unique CIDR blocks per subnet prevents routing conflicts and follows best practices.
  3. Step 3: Evaluate other options

    Default VPC cannot have overlapping subnets; multiple Default VPCs per project are not allowed; same IP ranges in one VPC cause conflicts.
  4. Final Answer:

    Create a custom VPC and assign non-overlapping CIDR blocks for each subnet in different regions -> Option C
  5. Quick Check:

    Custom VPC + unique CIDRs = Best practice [OK]
Hint: Use custom VPC with unique subnet IP ranges per region [OK]
Common Mistakes:
  • Trying to add overlapping subnets to Default VPC
  • Assuming multiple Default VPCs per project are possible
  • Using same IP ranges in multiple subnets inside one VPC