You are on page 1of 2

gcloud compute networks create NAME --project=qwiklabs-gcp-03-f84da9f44c30

--subnet-mode=auto --mtu=1460 --bgp-routing-mode=regional

gcloud compute firewall-rules create allow-icmp --project=qwiklabs-gcp-03-


f84da9f44c30 --network=projects/qwiklabs-gcp-03-f84da9f44c30/global/networks/NAME
--description=Allows\ ICMP\ connections\ from\ any\ source\ to\ any\ instance\ on\
the\ network. --direction=INGRESS --priority=65534 --source-ranges=0.0.0.0/0
--action=ALLOW --rules=icmp

gcloud compute firewall-rules create allow-internal --project=qwiklabs-gcp-03-


f84da9f44c30 --network=projects/qwiklabs-gcp-03-f84da9f44c30/global/networks/NAME
--description=Allows\ connections\ from\ any\ source\ in\ the\ network\ IP\ range\
to\ any\ instance\ on\ the\ network\ using\ all\ protocols. --direction=INGRESS
--priority=65534 --source-ranges=10.128.0.0/9 --action=ALLOW --rules=all

gcloud compute firewall-rules create allow-rdp --project=qwiklabs-gcp-03-


f84da9f44c30 --network=projects/qwiklabs-gcp-03-f84da9f44c30/global/networks/NAME
--description=Allows\ RDP\ connections\ from\ any\ source\ to\ any\ instance\ on\
the\ network\ using\ port\ 3389. --direction=INGRESS --priority=65534 --source-
ranges=0.0.0.0/0 --action=ALLOW --rules=tcp:3389

gcloud compute firewall-rules create allow-ssh --project=qwiklabs-gcp-03-


f84da9f44c30 --network=projects/qwiklabs-gcp-03-f84da9f44c30/global/networks/NAME
--description=Allows\ TCP\ connections\ from\ any\ source\ to\ any\ instance\ on\
the\ network\ using\ port\ 22. --direction=INGRESS --priority=65534 --source-
ranges=0.0.0.0/0 --action=ALLOW --rules=tcp:22

us-central1 mynetwork
10.128.0.0/20 10.128.0.1
europe-west2 mynetwork
10.154.0.0/20 10.154.0.1

gcloud config set project qwiklabs-gcp-02-dc26a8a8b9da

gcloud compute networks create managementnet --project=qwiklabs-gcp-02-dc26a8a8b9da


--subnet-mode=custom --mtu=1460 --bgp-routing-mode=regional

gcloud compute networks subnets create managementsubnet-us --project=qwiklabs-gcp-


02-dc26a8a8b9da --range=10.130.0.0/20 --network=managementnet --region=us-central1

gcloud compute networks create privatenet --subnet-mode=custom --project=qwiklabs-


gcp-02-dc26a8a8b9da

gcloud compute networks subnets create privatesubnet-us --network=privatenet


--region=us-central1 --range=172.16.0.0/24 --project=qwiklabs-gcp-02-dc26a8a8b9da

gcloud compute networks subnets create privatesubnet-eu --network=privatenet


--region=europe-west3 --range=172.20.0.0/20 --project=qwiklabs-gcp-02-dc26a8a8b9da

gcloud compute networks list --project=qwiklabs-gcp-02-dc26a8a8b9da

gcloud compute networks subnets list --sort-by=NETWORK

gcloud compute --project=qwiklabs-gcp-02-dc26a8a8b9da firewall-rules create


managementnet-allow-icmp-ssh-rdp --direction=INGRESS --priority=1000
--network=managementnet --action=ALLOW --rules=tcp:22,tcp:3389,icmp --source-
ranges=0.0.0.0/0
gcloud compute firewall-rules create privatenet-allow-icmp-ssh-rdp
--direction=INGRESS --priority=1000 --network=privatenet --action=ALLOW
--rules=icmp,tcp:22,tcp:3389 --source-ranges=0.0.0.0/0

gcloud compute firewall-rules list --sort-by=NETWORK

----------------------------------------------------------vm
creation-------------------------------------------------

gcloud beta compute --project=qwiklabs-gcp-02-dc26a8a8b9da instances create


managementnet-us-vm --zone=us-central1-c --machine-type=n1-standard-1
--subnet=managementsubnet-us --network-tier=PREMIUM --maintenance-policy=MIGRATE
--service-account=696135645950-compute@developer.gserviceaccount.com
--scopes=https://www.googleapis.com/auth/devstorage.read_only,https://www.googleapi
s.com/auth/logging.write,https://www.googleapis.com/auth/monitoring.write,https://w
ww.googleapis.com/auth/servicecontrol,https://www.googleapis.com/auth/service.manag
ement.readonly,https://www.googleapis.com/auth/trace.append --image=debian-10-
buster-v20210721 --image-project=debian-cloud --boot-disk-size=10GB --boot-disk-
type=pd-balanced --boot-disk-device-name=managementnet-us-vm --no-shielded-secure-
boot --shielded-vtpm --shielded-integrity-monitoring --reservation-affinity=any

gcloud compute instances create privatenet-us-vm --zone=us-central1-c --machine-


type=n1-standard-1 --subnet=privatesubnet-us

gcloud compute instances list --sort-by=ZONE

gcloud beta compute --project=qwiklabs-gcp-02-dc26a8a8b9da instances create vm-


appliance --zone=us-central1-c --machine-type=n1-standard-4
--subnet=managementsubnet-us --network-tier=PREMIUM --maintenance-policy=MIGRATE
--service-account=696135645950-compute@developer.gserviceaccount.com
--scopes=https://www.googleapis.com/auth/devstorage.read_only,https://www.googleapi
s.com/auth/logging.write,https://www.googleapis.com/auth/monitoring.write,https://w
ww.googleapis.com/auth/servicecontrol,https://www.googleapis.com/auth/service.manag
ement.readonly,https://www.googleapis.com/auth/trace.append --image=debian-10-
buster-v20210721 --image-project=debian-cloud --boot-disk-size=10GB --boot-disk-
type=pd-balanced --boot-disk-device-name=vm-appliance --no-shielded-secure-boot
--shielded-vtpm --shielded-integrity-monitoring --reservation-affinity=any

sudo ifconfig
ip route

You might also like