I was trying to demonstrate VPC peering in GCP. I followed the below steps;
Setup1 :
I logged into GCP admin user account and I have created VPC in custom mode and added a subnet in the us-central region under one project. Than I have set the firewall rule to allow ssh and tcp. Than I created a VM instance in the same us-central
region also selected this custom VPC and subnet in networking option. Than I tried to ssh into that VM and tried to ping from cloud shell. Both are working fine.
Setup2:
I logged into GCP user account which is added as a service account user by admin (previously used admin account). In that I created VPC in custom mode and added a subnet in the asia-east
region under another project. Than I created a VM instance in the same asia-east region also selected this custom VPC and subnet in networking. Then I have set the firewall rule to allow ssh and tcp. Then I tried to ssh into that VM and tried to ping from cloud shell. Both are working fine.
Both VPC's haveDynamic routing mode set as Regional.
Than I tried to ping us-central
machine from asia-east
machine and also asia-east
machine from us-central
machine.
My expectation was, it won't work as it uses two different VPC which has subnet in two different region. So i can implement VPC peering to make it possible. But unfortunately it is working. I just tried to demonstrate VPC peering concept.
Can anyone suggest me what i missed in it?
===============================================================
UPDATE
gcloud compute networks describe vpc1
autoCreateSubnetworks: false
creationTimestamp: '2021-09-03T04:08:24.491-07:00'
description: ''
id: '8530504402595724487'
kind: compute#network
mtu: 1460
name: my-vpc
routingConfig:
routingMode: REGIONAL
selfLink: https://www.googleapis.com/compute/v1/projects/project-name/global/networks/my-vpc
subnetworks:
- https://www.googleapis.com/compute/v1/projects/project-name/regions/us-central1/subnetworks/my-subnet
x_gcloud_bgp_routing_mode: REGIONAL
x_gcloud_subnet_mode: CUSTOM
gcloud compute networks describe vpc2
autoCreateSubnetworks: false
creationTimestamp: '2021-09-03T04:56:02.154-07:00'
description: ''
id: '8965341541776208829'
kind: compute#network
mtu: 1460
name: my-project2-vpc
routingConfig:
routingMode: REGIONAL
selfLink: https://www.googleapis.com/compute/v1/projects/project-name/global/networks/my-project2-vpc
subnetworks:
- https://www.googleapis.com/compute/v1/projects/project-name/regions/asia-east1/subnetworks/asia-subnet
x_gcloud_bgp_routing_mode: REGIONAL
x_gcloud_subnet_mode: CUSTOM