Press "Enter" to skip to content

Step by Step Guide to Understanding IP Subnetting

In my previous article, I showed you a smarter way to solve subnetting questions but that was quite an intermediate approach as I expected some prior understanding. The article also indicated provisioned subnet mask information which made it simple for the network engineer to carry out subnetting. In this article on the Step by Step Guide to Understanding IP Subnetting, I attempt to start from the basics all the way to solving any subnetting questions with an approach that is reliably accurate at all times. You may not always have the subnet address or mask to identify what the ip address is. This tutorial will take you through the best way in calculating subnetting requirements.




Step by Step Guide to Understanding IP Subnetting – Private IP Address Classes Table
It is extremely important to remember this table as it is a required knowledge for every subnetting task you may encounter. It is like knowing the Periodic Table in Chemistry.

Class Example # of Networks # of Hosts on each network Default Mask
A:1-127 24. 0 .0 .0 127 16,777,214 255.0.0.0
B:128-191 150.18. 0 .0 16,384 65,534 255.255.0.0
C:192-223 198.23.210. 0 2,097,152 254 255.255.255.0
D:224-239 224.0.0.10 Multicast
E:240-255 Reserved

Referencing the above table, can you perform a detective work in identifying which class the following ip addresses belong?

Step by Step Guide to Understanding IP Subnetting -What Class does each IP below belong to?

  1. 10.1.0.200
  2. 190.16.21.10
  3. 192.16.2.210
  4. 128.215.3.199
  5. 126.7.10.40

How was that exercise? Let us move on to understanding subnetting with this step by step guide.

Learn this table | Finger Table 1.1

Finger 1 2 3 4 5 6 7 8 Number of Subnets
Block Size 128 64 32 16 8 4 2 1 Subnet Incremental Coverage
Mask Value 128 192 224 240 248 252 254 255 Subnet Prefix
Prefix /25 /26 /27 /28 /29 /30 /31 /32 /XY

Step by Step Guide to Understanding IP Subnetting – The Process for Subnetting

  1. Firstly classify the address | This is exactly what we did in the exercise above
  2. Write down the Class it belongs to | Is it Class A, B, or C ?
  3. Write down the default Subnet Mask.

As a network engineer, as part of design or expansions you may from time to time be required to provision a number of subnets based on an Subnet ID. You are usually given a subnet address and asked to provision a number of subnets.

Let’s take an example…

Subnetting Question 1: We have an address 172.18.0.0 and we need 60 subnets.

Step 1 – Locate the Private IP Class
The first thing is to check what private ip address class the given address belongs to. The above address belongs to the Class B IP Address Group – Class B(128-191) as 172 falls within that range of addresses.

Step by Step Guide to Understanding IP Subnetting

Step 2 – Write down the default subnet mask
Default Mask : 255.255.0.0

Step by Step Guide to Understanding IP Subnetting | how to calculate subnet mask from ip address
Step 3 – Write down the full address with the prefix
Our address is 172.18.0.0/16.

Step 4 – Calculate and provision the number of subnets required.
In this example you have been asked to provision 60 subnets. From the finger table 1.1 we know that 2 raised to the power of 6 gives us 64 subnets which is more than enough for our needs.

how to calculate subnet mask from finger table

  1. Finger Number = 6
  2. Block Size = 4
  3. Mask Value = 252

Now that we have calculated the number of subnets required, we move to the next step. Calculate the new subnet mask.

Step 5 – Calculate What Subnet Mask to Use
256 minus the block size is what gives you the subnet mask.
256 – 4 = 252 which is equal to the prefix /22

how to calculate subnet mask from the block size

Step 6 | Write down the new address based on the calculation so far
The new address is 172.18.0.0/22.

how to calculate subnet mask from the borrowed binary bits

Subnetting Question 2: What is the last valid host on the subnetwork 172.18.41.128 255.255.255.128

The approach for this is pretty straight forward. We know that the last octect in the subnet mask is 128.

Step 1: Calculate the Block Size
256 – 128 will determine which block size this belongs to. 256 – 128 = 128. From our finger table 1.1, the block size is 128 with mask value of 128(10000000).

Step 2: Calculate the Prefix
The known 3 octets forms a prefix of (255.255.255.X) = /24 + 1 = /25. Where did we get + 1 from? This is the finger position from our subnet table.

Step 3: Identify Subnet Block of IP Address
Since the block size is 128, this means that the increments for this subnet will be 128. So starting from 0, our address 172.18.41.128 would be on the second subnet block 172.18.41.128.

Starting from 0, the first subnet address will be 172.18.41.0 with Valid Start Host as 172.18.41.1 and Valid End Host as 172.18.41.126 with 172.18.41.127 being the broadcast address.

Remember that the block size indicates that the subnet address 172.18.41.0 is part of the block size count.

0 is a valid count in computing.

Since 172.18.41.128 is not within the valid host range of the first subnet block, it is clearly going to be on the second subnet block of Subnet ID 172.18.41.128. The first valid host in this subnet starts from 172.18.41.129 and the last valid host is 172.18.41.254 with 172.18.41.255 as the broadcast address.

172.18.41.0 | 0 — 127 (Subnet 1) – Block Size 128.
172.18.41.128 | 128 — 254 (Subnet 2) – Block Size 128.

Let’s take another example.

Subnetting Question 3:How many subnets and hosts per subnet can you get from the network 172.18.0.0/26?

Let us solve this interesting question together by following these steps;

Step 1: Identify the Block Size for /26

From the finger table 1.1, /26 is Finger 2 which sits on block size 64 which has the Mask Value of 192(11000000).

2 bits are used to identify the subnet and so to find the total subnets available, we simply raise 2 to the power of 2 (2^2) and you will find the result is 4 subnets.

Step 2: Calculate the number of Hosts per subnet

Since the 2 bits (11 which identifies the network(subnets)) has been used, we calculate the number of valid hosts from the remainder 0’s. We have (000000) which is equal to 6 bits. Hosts are calculated as 2 raised to the power of host bits – 2. 2^6 = 2 x 2 x 2 x 2 x 2 x 2 = 64.
Valid Hosts = 64-2 = 62 Hosts.

Shortcut Way to calculate the number of hosts per subnet
Since the subnet is identified by the block size, the number of valid hosts will always be the Block Size – 2.
The block size for /26 prefix is 64. 64 – 2 = 62 Hosts.

With the above explanations, can we take another example together?

Subnetting Question 4: What is the last valid host on the subnetwork 192.168.241.200/29.
From the prefix of /29, the block size is 8 and the mask value is 248. /29 = 255.255.255.11111000.
The number of subnets is 2^5 = 32 Maximum Subnets
The number of hosts per subnet = 2^3 – 2 = 8 – 2 = 6 Hosts per Subnet
Now let us go ahead and find the last valid host on the subnetwork 192.168.241.200/29

We determined the block size to be 8 and so the incremental will be blocks of 8. Let’s tackle the blocks;

1st Subnet – 192.168.241.0 – 192.168.241.7
2nd Subnet – 192.168.241.8 – 192.168.241.15
3rd Subnet – 192.168.241.16 – 192.168.241.23
4th Subnet – 192.168.241.24 – 192.168.241.31

Subnet Address – 192.168.241.200
Host Range192.168.241.201 – 192.168.241.206
Broadcast Address192.168.241.207

Last Subnet – 192.168.241.248 – 192.168.241.255

The last valid host on the subnetwork 192.168.241.200/29 is 192.168.241.206.

Subnetting Question 5
You are designing a subnet mask for the 172.30.0.0 network. You want 1300 subnets with up to 28 hosts on each subnet. What subnet mask should you use?

This is a very good subnetting question you are likely to encounter in an interview and also in your networking exams.
From the question, we have not been given any subnet mask and so the first step is to locate which private ip address class it sits on.

Calculating CIDR based on the Private IP Address Classes Table
From the Private IP Address Classes Table, 172.30.0.0 belongs to the Class B CIDR which has the default subnet mask of 255.255.0.0 and the prefix of /16.

We want 1300 subnets. What block size satisfies this requirement? The number of subnets is determined by 2 raised to the power of the number of bits. From the 3rd octet we need to start stealing some bits to get our subnet. After stealing 8 bits we realise that 2^8= 256 which is below the required target. So we head over to the 4th octet and we steal some more… 2^10 = 1024 which is still short and so let us try 2^11. Aha, 2^11 = 2048 which is more than sufficient and satisfies the requirements laid out.

Calculate the New Subnet Mask
Since we borrowed 11 bits, we are going to have 255.255.11111111.11100000.

The new subnet mask is: /27 (11111111.11111111.11111111.11100000) = 255.255.255.224

The 0 bits are what our hosts will use and so let us calculate the number of hosts on each subnet.
2^5 = 32 – 2 = 30 hosts per network. The requirement was for us to have 28 hosts per subnet and so this subnet mask satisfies the requirement sufficiently.

It is always a good practice to calculate the number of subnets before dealing with the hosts.

Question Number 6: What is the first valid host on the subnetwork that the node 172.20.58.157 255.255.240.0 belongs to?

Solve the above question by following this framework;

  1. Locate the Block Size
  2. Identify Subnet Mask Value
  3. Calculate the number of subnets
  4. Calculate the number of hosts per subnet
  5. Locate the Node’s IP address in the appropriate block and the first valid host on the subnetwork

Answer = 172.20.48.1

Follow Cisco’s guide to subnetting in the following link.