Reputation: 15
Subnets are regional resource, while network are global resource. I am doing a Google LAB and I am facing up this doubt.
There is this kind of network:
networkA
with subnet-a
and subnet-b
both in region us-central1
How is it possible?
Upvotes: 1
Views: 3391
Reputation: 4461
I can see no issue with such configuration.
Please have a look at the documentation Networks and subnets:
Each VPC network consists of one or more useful IP range partitions called subnets. Each subnet is associated with a region.
and
A network must have at least one subnet before you can use it. Auto mode VPC networks create subnets in each region automatically. Custom mode VPC networks start with no subnets, giving you full control over subnet creation. You can create more than one subnet per region.
So, accordingly to the documentation, it's possible to have a network test-network
with two subnets subnet-a
and subnet-b
both in same region us-central1
, for example:
$ gcloud compute networks create test-network --subnet-mode=custom --mtu=1460 --bgp-routing-mode=regional
$ gcloud compute networks subnets create subnet-a --range=10.0.1.0/24 --network=test-network --region=us-central1
$ gcloud compute networks subnets create subnet-b --range=10.0.2.0/24 --network=test-network --region=us-central1
$ gcloud compute networks list
NAME SUBNET_MODE BGP_ROUTING_MODE IPV4_RANGE GATEWAY_IPV4
test-network CUSTOM REGIONAL
$ gcloud compute networks subnets list
NAME REGION NETWORK RANGE
subnet-a us-central1 test-network 10.0.1.0/24
subnet-b us-central1 test-network 10.0.2.0/24
In addition have a look at the documentation section Communication within the network:
Except for the default network, you must explicitly create higher priority ingress firewall rules to allow instances to communicate with one another. The default network includes several firewall rules in addition to the implied ones, including the default-allow-internal rule, which permits instance-to-instance communication within the network. The default network also comes with ingress rules allowing protocols such as RDP and SSH.
Please update your question if you have other doubts.
Upvotes: 1