The IP address ranges for the three subnets created in this tutorial can be determined based on the subnet mask and the network address. In order to calculate the IP address ranges, we need to understand the concept of subnetting and how it is applied in the context of Google Cloud Platform (GCP) – Cloud VPC.
Subnetting is the process of dividing a network into smaller subnetworks or subnets. Each subnet has its own unique range of IP addresses. This allows for better organization and management of IP addresses within a network.
In GCP – Cloud VPC, subnets are created within a VPC network. A VPC network is a global resource that spans multiple regions and can contain one or more subnets. Each subnet is associated with a specific region within the VPC network.
To determine the IP address ranges for the subnets, we need to consider the following factors:
1. VPC network IP range: When creating a VPC network, you specify an IP range for the entire network. This IP range determines the overall address space available for the VPC network. For example, if you specify the IP range as 10.0.0.0/16, it means that the VPC network can have up to 65,536 IP addresses.
2. Subnet mask: The subnet mask is used to determine the network portion and the host portion of an IP address. It is represented in the form of a dotted decimal notation, such as 255.255.255.0. The subnet mask is applied to the IP range of the VPC network to divide it into smaller subnets.
3. Subnet prefix length: In GCP – Cloud VPC, the subnet mask is represented by a prefix length. The prefix length indicates the number of bits in the subnet mask. For example, a prefix length of 24 corresponds to a subnet mask of 255.255.255.0.
To calculate the IP address range for a subnet, we can use the following formula:
Network address = VPC network IP range AND Subnet mask
For example, let's assume that we have a VPC network with an IP range of 10.0.0.0/16 and we want to create three subnets within this network. We can divide the IP range into three subnets with the following prefix lengths:
Subnet 1: /24
Subnet 2: /25
Subnet 3: /26
Using the formula mentioned above, we can calculate the IP address ranges for each subnet:
Subnet 1:
Network address = 10.0.0.0 AND 255.255.255.0 = 10.0.0.0
IP address range: 10.0.0.1 – 10.0.0.254
Subnet 2:
Network address = 10.0.1.0 AND 255.255.255.128 = 10.0.1.0
IP address range: 10.0.1.1 – 10.0.1.126
Subnet 3:
Network address = 10.0.1.128 AND 255.255.255.192 = 10.0.1.128
IP address range: 10.0.1.129 – 10.0.1.190
In this example, Subnet 1 has a prefix length of 24, which means it can have up to 256 IP addresses. Subnet 2 has a prefix length of 25, allowing for up to 128 IP addresses. Subnet 3 has a prefix length of 26, providing a maximum of 64 IP addresses.
It's important to note that the first IP address in each subnet is reserved for the network address, and the last IP address is reserved for the broadcast address. The remaining IP addresses within the range can be assigned to instances or resources within the subnet.
The IP address ranges for the three subnets created in this tutorial, based on the given example, are as follows:
Subnet 1: 10.0.0.1 – 10.0.0.254
Subnet 2: 10.0.1.1 – 10.0.1.126
Subnet 3: 10.0.1.129 – 10.0.1.190
These ranges are calculated based on the VPC network IP range and the subnet mask or prefix length assigned to each subnet.
Other recent questions and answers regarding Cloud VPC:
- How to calculate the IP address range for a subnet?
- What is the purpose of specifying a region when creating a subnet?
- How do you create a subnet within a custom network?
- What is the difference between a custom network and an automatic VPC network?
- What are the steps to create a custom network and an automatic VPC network using Google Cloud Platform?

