Table of Contents (🔎 Click to expand/collapse)
In this lab you create several VPC networks and VM instances and test connectivity across networks. Specifically, you create two custom mode networks (managementnet and privatenet) with firewall rules and VM instances as shown in this network diagram:
The mynetwork network with its firewall rules and two VM instances (mynet-eu-vm
and mynet-us-vm
) have already been created for you in this Qwiklabs project.
- Click Navigation Menu > VPC network > VPC networks.
- Click CREATE VPC NETWORK.
- Fill up the fields and click CREATE
# create the network
$ gcloud compute networks create <NETWORK_NAME> --subnet-mode=custom
# create the subnets
$ gcloud compute networks subnets create <SUBNETS_NAME> \
--region="<REGION>" \
--network="<NETWORK_NAME>" \
--range="<IP_RANGE>"
# list the available VPC networks
$ gcloud compute networks list
# list the available VPC subnets
$ gcloud compute networks subnets list --sort-by=NETWORK
- Click Navigation Menu > VPC network > Firewall.
- Click CREATE FIREWALL RULE.
- Fill up the fields and click CREATE
# create the firewall rule
$ gcloud compute firewall-rules create <FIREWALL_RULE_NAME> \
--network="<NETWORK_NAME>" \
--direction="<DIRECTION>" \
--priority="<PRIORITY>" \
--action="<ACTION>" \
--rules="<RULES>" \
--source-ranges="<RANGE>"
# list all the firewall rules
$ gcloud compute firewall-rules list --sort-by=NETWORK
- Click Navigation Menu > Compute Engine > VM instances.
- Click CREATE INSTANCE.
- Fill up the fields and click CREATE
# create VM instances
$ gcloud compute instances create <INSTANCE_NAME> \
--zone="<ZONE>" \
--machine-type="<MACHINE_TYPE>" \
--subnet="<SUBNETS_NAME>"
# list all the VM instances
$ gcloud compute instances list --sort-by=ZONE