
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 instances
/ 30
Create custom mode VPC networks with firewall rules
/ 40
Create VM instances
/ 30
As a Cloud Architect, you know that one of the pillars of your cloud infrastructure in Azure is your network. How to connect your different resources, how to achieve network segmentation, and how to ensure security are part of your main concerns when working with Google Cloud.
In Azure, you have several regions in which you can deploy as many Virtual Networks (VNets) as you need. These VNets are isolated resources dedicated to communicating your infrastructure and all the deployments that you have within that infrastructure.
In Azure, VNets are regional in their scope and can exist in only one region. Nonetheless, you are able to interconnect them with a Peering Service using the Microsoft backbone to ensure privacy and integrity.
If you are presented with a hybrid scenario, you could use a virtual network gateway to communicate with your local datacenter using Azure.
In Azure, all the virtual networks and the subnets span all availability zones across one region. This means that it’s not necessary to divide them by availability zones. According to best practices, you can create security groups, route tables, and Azure Firewall rules to improve your network security.
With all of this in mind, you will explore the networking services available in Google Cloud to successfully deploy a robust architecture.
Google Cloud Virtual Private Cloud (VPC) provides networking functionality to Compute Engine virtual machine (VM) instances, Kubernetes Engine containers, and the 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 convert the auto mode network to a custom mode network and create other custom mode networks as shown in the example network diagram below. You also test connectivity across networks.
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.
Sign in to Qwiklabs using an incognito window.
Note the lab's access time (for example, 1:15:00
), and make sure you can finish within that time.
There is no pause feature. You can restart if needed, but you have to start at the beginning.
When ready, click Start lab.
Note your lab credentials (Username and Password). You will use them to sign in to the Google Cloud Console.
Click Open Google Console.
Click Use another account and copy/paste credentials for this lab into the prompts.
If you use other credentials, you'll receive errors or incur charges.
Accept the terms and skip the recovery resource page.
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.
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.
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.
In the left pane, click Firewall.
Notice that there are 4 Ingress firewall rules for the default network:
These firewall rules allow ICMP, RDP, and SSH ingress traffic from anywhere (0.0.0.0/0) and all TCP, UDP, and ICMP traffic within the network (10.128.0.0/9). The Targets, Filters, Protocols/ports, and Action columns explain these rules.
Wait for the network to be deleted before continuing.
Notice that there are no routes.
Notice that there are no firewall rules.
Verify that you cannot create a VM instance without a VPC network.
Notice the error.
You have been tasked to create an auto mode network with two VM instances. Auto mode networks are easy to set up and use because they automatically create subnets in each region. However, you don't have complete control over the subnets created in your VPC network, including regions and IP address ranges used.
Feel free to explore in the Google VPC documentation for more considerations for choosing an auto mode network, but for now, assume that you are using the auto mode network for prototyping purposes.
Auto mode networks create subnets in each region automatically.
These are the same standard firewall rules that the default network had. The deny-all-ingress and allow-all-egress rules are also displayed, but you cannot select or disable them because they are implied. These two rules have a lower Priority (higher integers indicate lower priorities) so that the allow ICMP, custom, RDP, and SSH rules are considered first.
Click Create.
When the new network is ready, click mynetwork. Note the IP address range for the subnets in
Create a VM instance in the
On the Navigation menu (), click Compute Engine > VM instances.
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-us-vm |
Region | |
Zone | |
Series | E2 |
Machine type | e2-micro (2 vCPU, 1 GB memory) |
Boot disk | Debian GNU/Linux 11 (bullseye) |
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-eu-vm |
Region | |
Zone | |
Series | E2 |
Machine type | e2-micro (2 vCPU, 1 GB memory) |
Boot disk | Debian GNU/Linux 11 (bullseye) |
Click Create.
Note: The External IP addresses for both VM instances are ephemeral. If an instance is stopped, any ephemeral external IP addresses assigned to the instance are released back into the general Compute Engine pool and become available for use by other projects.
When a stopped instance is started again, a new ephemeral external IP address is assigned to the instance. Alternatively, you can reserve a static external IP address, which assigns the address to your project indefinitely until you explicitly release it.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).
Note the external and internal IP addresses for mynet-eu-vm.
You can ping mynet-eu-vm's internal IP because of the allow-custom firewall rule.
The auto mode network worked great so far, but you have been asked to convert it to a custom mode network so that new subnets aren't automatically created as new regions become available. This could result in overlap with IP addresses used by manually created subnets or static routes, or could interfere with your overall network planning.
Wait for the Mode of mynetwork to change to Custom.
You can click Refresh while you wait.
Click Check my progress to verify the objective.
You have been tasked to create two additional custom networks, managementnet and privatenet, along with firewall rules to allow SSH, ICMP, and RDP ingress traffic and VM instances as shown in this example diagram (with the exception of vm-appliance):
Note that the IP CIDR ranges of these networks do not overlap. This allows you to set up mechanisms such as VPC peering between the networks. If you specify IP CIDR ranges that are different from your on-premises network, you could even configure hybrid connectivity using VPN or Cloud Interconnect.
Create the managementnet network using the Cloud Console.
In the Cloud Console, on the Navigation menu (), click VPC network > VPC networks.
Click Create VPC Network.
For Name, type managementnet
For Subnet creation mode, click Custom.
Specify the following, and leave the remaining settings as their defaults:
Property | Value (type value or select option as specified) |
---|---|
Name | managementsubnet-us |
Region | |
IPv4 range | 10.240.0.0/20 |
Click Done.
Click Equivalent Command line.
These commands illustrate that networks and subnets can be created using the gcloud
command line. You will create the privatenet network using these commands with similar parameters.
Click Close.
Click Create.
Create the privatenet network using the gcloud
command line.
The output should look like this:
Create firewall rules to allow SSH, ICMP, and RDP ingress traffic to VM instances on the managementnet network.
In the Cloud Console, on the Navigation menu (), click VPC network > Firewall.
Click Create Firewall Rule.
Specify the following, and leave the remaining settings as their defaults:
Property | Value (type value or select option as specified) |
---|---|
Name | managementnet-allow-icmp-ssh-rdp |
Network | managementnet |
Targets | All instances in the network |
Source filter | IPv4 Ranges |
Source IPv4 ranges | 0.0.0.0/0 |
Protocols and ports | Specified protocols and ports |
Select tcp and specify ports 22 and 3389.
Select Other protocols and specify icmp protocol.
Click Equivalent Command line.
These commands illustrate that firewall rules can also be created using the gcloud
command line. You will create the privatenet's firewall rules using these commands with similar parameters.
Click Close.
Click Create.
Create the firewall rules for privatenet network using the gcloud
command line.
The output should look like this:
The output should look like this:
The firewall rules for mynetwork network have been created for you. You can define multiple protocols and ports in one firewall rule (privatenet and managementnet) or spread them across multiple rules (default and mynetwork).
Click Check my progress to verify the objective.
Next, create two VM instances:
Create the managementnet-us-vm instance using the Cloud Console.
In the Cloud Console, on the Navigation menu (), click Compute Engine > VM instances.
Click Create instance.
Specify the following, and leave the remaining settings as their defaults:
Property | Value (type value or select option as specified) |
---|---|
Name | managementnet-us-vm |
Region | |
Zone | |
Series | E2 |
Machine type | e2-micro (2 vCPU, 1 GB memory) |
Boot disk | Debian GNU/Linux 11 (bullseye) |
Click Advanced options.
Click Networking.
For Network interfaces, click the dropdown arrow to edit.
Specify the following, and leave the remaining settings as their defaults:
Property | Value (type value or select option as specified) |
---|---|
Network | managementnet |
Subnetwork | managementsubnet-us |
Click Done.
Click Equivalent Command Line.
This illustrates that VM instances can also be created using the gcloud
command line. You will create the privatenet-us-vm instance using these commands with similar parameters.
Click Close.
Click Create.
Create the privatenet-us-vm instance using the gcloud
command line.
Verify that the VM instances are listed in the Cloud Console.
For Columns, select Zone.
There are three instances in
Click Check my progress to verify the objective.
Explore the connectivity between the VM instances. Specifically, determine the effect of having VM instances in the same zone versus having instances in the same VPC network.
Ping the external IP addresses of the VM instances to determine whether you can reach the instances from the public internet.
This should work!
This should work!
This should work!
Ping the internal IP addresses of the VM instances to determine whether you can reach the instances from within a VPC network.
In this lab, you explored the default network and determined that you cannot create VM instances without a VPC network. Thus, you created a new auto mode VPC network with subnets, routes, firewall rules, and two VM instances and tested the connectivity for the VM instances. Because auto mode networks aren't recommended for production, you converted the auto mode network to a custom mode network.
Next, you created two more custom mode VPC networks with firewall rules and VM instances using the Cloud Console and the gcloud command line. Then you tested the connectivity across VPC networks, which worked when pinging external IP addresses but not when pinging internal IP addresses.
VPC networks are by default isolated private networking domains. Therefore, no internal IP address communication is allowed between networks, unless you set up mechanisms such as VPC peering or VPN.
Google Cloud offers two modes for creating VPCs: "auto" mode and "custom" mode. In auto mode, Google Cloud manages the IP addressing and routing, similar to how Azure creates VNets. However, in custom mode, users have more control over the VPC configuration, including the ability to define their own IP address ranges and subnets.
Here is a recap of the similarities and differences between these services:
Similarities:
Differences:
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