Creating subnets

Let's create two subnets under the chap7 VPC (network) by following these steps:

  1. In order to create a subnet, you have to choose the region. By typing gcloud compute regions list you will know which regions are available to you:
Displaying a GCP region list
  1. Let's choose us-central1 and us-east1 to create two subnets under the chap7 VPC with the following configuration:
Subnet name VPC CIDR range Region
chap7-us-central1 chap7 192.168.1.0/24 us-central1
chap7-us-east1 chap7 192.168.2.0/24 us-east1
$ gcloud compute networks subnets create chap7-us-central1 --network=chap7 --range=192.168.1.0/24 --region us-central1

$ gcloud compute networks subnets create chap7-us-east1 --network=chap7 --range=192.168.2.0/24 --region us-east1
  1. Check the following command to see whether subnets are configured properly or not:
$ gcloud compute networks subnets list --network=chap7
NAME REGION NETWORK RANGE
chap7-us-east1 us-east1 chap7 192.168.2.0/24
chap7-us-central1 us-central1 chap7 192.168.1.0/24
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.15.17.154