
Before you begin
- Labs create a Google Cloud project and resources for a fixed time
- Labs have a time limit and no pause feature. If you end the lab, you'll have to restart from the beginning.
- On the top left of your screen, click Start lab to begin
Create a VPC network and VM instance
/ 100
Google Cloud Virtual Private Cloud (VPC) provides networking functionality to Compute Engine virtual machine (VM) instances, Kubernetes Engine containers, and App Engine flexible environment. In other words, without a VPC network you cannot create VM instances, containers, or App Engine applications. Therefore, each Google Cloud project has a default network to get you started.
You can think of a VPC network as similar to a physical network, except that it is virtualized within Google Cloud. A VPC network is a global resource that consists of a list of regional virtual subnetworks (subnets) in data centers, all connected by a global wide area network (WAN). VPC networks are logically isolated from each other in Google Cloud.
In this lab, you create an auto mode VPC network with firewall rules and two VM instances. Then, you explore the connectivity for the VM instances.
In this lab, you learn how to perform the following tasks:
For each lab, you get a new Google Cloud project and set of resources for a fixed time at no cost.
Click the Start Lab button. If you need to pay for the lab, a pop-up opens for you to select your payment method. On the left is the Lab Details panel with the following:
Click Open Google Cloud console (or right-click and select Open Link in Incognito Window if you are running the Chrome browser).
The lab spins up resources, and then opens another tab that shows the Sign in page.
Tip: Arrange the tabs in separate windows, side-by-side.
If necessary, copy the Username below and paste it into the Sign in dialog.
You can also find the Username in the Lab Details panel.
Click Next.
Copy the Password below and paste it into the Welcome dialog.
You can also find the Password in the Lab Details panel.
Click Next.
Click through the subsequent pages:
After a few moments, the Google Cloud console opens in this tab.
Each Google Cloud project has a default network with subnets, routes, and firewall rules.
The default network has a subnet in each Google Cloud region.
In the Cloud Console, on the Navigation menu (), click VPC network > VPC networks.
Click default.
Click Subnets.
Notice the default network with its subnets.
Each subnet is associated with a Google Cloud region and a private RFC 1918 CIDR block for its internal IP addresses range and a gateway.
Routes tell VM instances and the VPC network how to send traffic from an instance to a destination, either inside the network or outside Google Cloud. Each VPC network comes with some default routes to route traffic among its subnets and send traffic from eligible instances to the internet.
In the left pane, click Routes.
In Effective Routes click Network, and then select default.
Click Region and select the Lab Region assigned to you by Qwiklabs.
Click View.
Notice that there is a route for each subnet.
These routes are managed for you, but you can create custom static routes to direct some packets to specific destinations. For example, you can create a route that sends all outbound traffic to an instance configured as a NAT gateway.
Each VPC network implements a distributed virtual firewall that you can configure. Firewall rules allow you to control which packets are allowed to travel to which destinations. Every VPC network has two implied firewall rules that block all incoming connections and allow all outgoing connections.
Verify that you cannot create a VM instance without a VPC network.
Create a VPC network so that you can create VM instances.
Replicate the default network by creating an auto mode network.
Create a VM instance in the
On the Navigation menu (), click Compute Engine > VM instances.
Click Create Instance.
Specify the following:
Property | Value (type value or select option as specified) |
---|---|
Name | mynet-us-vm |
Region | |
Zone |
For Series, select E2.
For Machine type, select e2-micro (2 vCPU, 1 GB memory).
Click Create.
Create a VM instance in the
Click Create Instance.
Specify the following, and leave the remaining settings as their defaults:
Property | Value (type value or select option as specified) |
---|---|
Name | mynet-r2-vm |
Region | |
Zone |
For Series, select E2.
For Machine type, select e2-micro (2 vCPU, 1 GB memory).
Click Create.
Click Check my progress to verify the objective.
Explore the connectivity for the VM instances. Specifically, try to SSH to your VM instances using tcp:22, and ping both the internal and external IP addresses of your VM instances using ICMP. Then explore the effects of the firewall rules on connectivity by removing the firewall rules individually.
The firewall rules that you created with mynetwork allow ingress SSH and ICMP traffic from within mynetwork (internal IP) and outside that network (external IP).
On the Navigation menu (), click Compute Engine > VM instances.
Note the external and internal IP addresses for mynet-r2-vm.
For mynet-us-vm, click SSH to launch a terminal and connect.
If an Authorize popup appears, click on Authorize
You can ping mynet-r2-vm's internal IP because of the allow-custom firewall rule.
Remove the allow-icmp firewall rule and try to ping the internal and external IP address of mynet-r2-vm.
On the Navigation menu (), click VPC network > Firewall.
Select the mynetwork-allow-icmp rule.
Click Delete.
Click Delete to confirm the deletion.
Wait for the firewall rule to be deleted.
Return to the mynet-us-vm SSH terminal.
To test connectivity to mynet-r2-vm's internal IP, run the following command, replacing mynet-r2-vm's internal IP:
You can ping mynet-r2-vm's internal IP because of the allow-custom firewall rule.
Remove the allow-custom firewall rule and try to ping the internal IP address of mynet-r2-vm.
Remove the allow-ssh firewall rule and try to SSH to mynet-us-vm.
In this lab, you explored the default network along with its subnets, routes, and firewall rules. You deleted the default network and determined that you cannot create any VM instances without a VPC network.
Thus, you created a new auto mode VPC network with subnets, routes, firewall rules, and two VM instances. Then you tested the connectivity for the VM instances and explored the effects of the firewall rules on connectivity.
When you have completed your lab, click End Lab. Google Cloud Skills Boost removes the resources you’ve used and cleans the account for you.
You will be given an opportunity to rate the lab experience. Select the applicable number of stars, type a comment, and then click Submit.
The number of stars indicates the following:
You can close the dialog box if you don't want to provide feedback.
For feedback, suggestions, or corrections, please use the Support tab.
Copyright 2022 Google LLC All rights reserved. Google and the Google logo are trademarks of Google LLC. All other company and product names may be trademarks of the respective companies with which they are associated.
This content is not currently available
We will notify you via email when it becomes available
Great!
We will contact you via email if it becomes available
One lab at a time
Confirm to end all existing labs and start this one