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
Add firewall rules to allow tcp:22 and icmp
/ 50
Create deny firewall rules
/ 50
A Virtual Private Cloud (VPC) network is a global resource which 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.
VPC provides networking functionality to Compute Engine virtual machine (VM) instances, Kubernetes Engine containers, and App Engine Flex. Each Google Cloud project by default has a default network configuration which provides each region with an auto subnet network.
In this lab you use gcloud to create two firewall rules, and test the networks' ability to allow traffic from the public internet.
Pre-configured resources:
Your output should look like this:
You can see the two pre-created custom networks for this lab.
describe to view network details, such as its peering connections and subnets:You can list all subnets in all networks in your project, or you can show only the subnets for a particular network or region.
Use the following command to list all subnets in all VPC networks in all regions:
You can view the details of an existing subnet, such as its primary IPv4 ranges, secondary IP ranges, IPv6 ranges, and region.
SUBNET_NAME with the name of the subnet of one of the two pre-created networks:Auto networks include default rules, custom networks do not include any firewall rules. Firewall rules are defined at the network level, and only apply to the network where they are created.
The name you choose for each firewall rule must be unique to the project. To allow access to VM instances, you must apply firewall rules.
labnet-allow-internal firewall rule:With this command you are doing the following:
firewall-rules is a subcategory of compute
create is the action you are takinglabnet-allow-internal is the name of the firewall rule--network=labnet puts the rule in the labnet network--action=ALLOW must be used with the --rules flag, and is either "ALLOW" or "DENY"--rules=icmp,tcp:22 specifies the icmp and tcp protocols and the ports that the rule applies to--source-ranges=0.0.0.0/0 specifies the ranges of source IP addresses in CIDR format.Click Check my progress to verify the objective.
Now you'll inspect the firewall rules to see its name, applicable network, and components, including whether the rule is enabled or disabled.
FIREWALL_RULE_NAME in the following command with the name of firewall rule you created in Task 4.This firewall rule denies all access from the internal protocol.
The output should look like this:
Click Check my progress to verify the objective.
NETWORK_NAME with the name of a pre-created custom network.You have two pre-created VM instances for this lab.
For this command, you're using the instance subgroup, with it's specialized command list.
You applied firewall rules to each network - so one network allows INGRESS traffic, and the other denies INGRESS traffic.
For this experiment, you should be able to communicate with the first network, but be unable to communicate with the second one.
This should work - lnet-vm's network has a firewall rule that allows traffic.
pnet-vm's external IP address.This should not work - nothing should be happening. pnet-vm's network has a firewall rule that denies traffic. Use Ctrl+C to end the process.
In this lab, you created two firewall rules using the Cloud terminal command line. Then you tested the ability of the VPC networks to receive traffic from the public internet.
Learn more about VPC networking:
...helps you make the most of Google Cloud technologies. Our classes include technical skills and best practices to help you get up to speed quickly and continue your learning journey. We offer fundamental to advanced level training, with on-demand, live, and virtual options to suit your busy schedule. Certifications help you validate and prove your skill and expertise in Google Cloud technologies.
Manual Last Updated January 9, 2025
Lab Last Tested November 12, 2024
Copyright 2025 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