Momodu Afegbua
4 min readFeb 8, 2020

In the first part of this network series, I wrote about the building blocks of virtual private cloud (VPC) networking. The different classes of network were briefly discussed and the concept of masking was discussed. For this part, I will be writing about subnets and the hurdles that I personally go through in setting up a custom network in GCP. If you haven’t read the first part, chances are you might find this to be confusing. Read it here…

So, Subnets? Subnetworks? What is Subnetting?

A typical network class has 3 standard host ID sizes: Class A (24bits), Class B (16bits) and Class C (8bits). But in practice, these standard sizes are not economical. For instance, a 24bits host ID is capable of supporting a maximum of 2²¹ (2,097,152) host IDs. With few of these IDs in use, the rest becomes wasted resources. With subnetting however, we get to go beyond the standard host ID sizes and determine our own desired sizes.

The basic meaning of a subnetwork is as the name suggests; a type of a smaller network gotten from the division of a network. They are created with the use of masking, just that this time around, the Host IDs are tweaked.

For instance, the standard network masking for the Class C network, is This will give 2²¹ network IDs and (2⁸–2) hosts. as used here is standard, but with subnetting, we could use

Let’s draw up a table;

From the table above, the three bits therein called SUB have been used to create a subnetwork from the host ID gotten from the masking. This means that the network is capable of having 8 (2³) subnetworks. This leaves us with 30 (2⁵ -2) host IDs. The resulting subnet table is as shown below;

Note: Hosts of all zeros and all 1s are reserved.

The subnet mask as described above has two ways of representation;

1. Either we say that the address has a subnet mask of 3-bits, or

2. We use classless inter-domain routing (CIDR) method and simply represent it as

How come the /27? Well, the 27 represents the number of bits set in the mask.

Moving on, remember when I said subnetting helps control IDs? Let’s try it out.

Assume we are working with a Class C network ( with its mask having 11110000 as its last 8 bits. The first 4 bits are SUB bits, the rest are host ID bits.

Number of subnets: 16(2⁴)

Number of hosts: 14 2⁴–2)

Number of subnet hosts for 16 x 14 = 224

For 11000000 with 2 bits for subnets and 5 bits for hosts

Number of subnets: 4(2²)

Number of hosts: 62(2⁶–2)

Number of subnet hosts for 4 x 62 = 248

How about 11111000 with 5 bits for subnets and 3 bits for hosts?

Number of subnets: 32(2⁵)

Number of hosts: 6(2³–2)

Number of subnet hosts for 32 x 6 = 192

Let’s conclude this part with an example:

A network address is masked with Determine the number of subnets and hosts. Also, what is the CIDR representation?


Note: It is a Class B network.

Number of subnets: 32 (2⁵)

Number of hosts: 2046 (2¹¹–2)

CIDR representation:

2046 hosts! That has got to be much right? How about we do a reverse calculation with the second example? In this example, we will be given two IP addresses and we will be asked to check if they belong to the same subnetwork.

Example 2:

Given two devices with different IP addresses: A( and B( Determine if they are on the same subnet.


From the CIDR representation, we can tell it is a Class B network and the netmask is 11111111.11111111.11110000.00000000. The decimal equivalent of 11110000 is 240.

Device A
Device B

They do belong to the same network don’t they?

We will continue in PART 3.

Have you read PART 1?



Momodu Afegbua

Cloud Architect | DevOps Evangelist | CKA, CKAD | I mostly write things in here so I can read them again when I get lost — eventually.