Subnetting Tricks Subnetting Made Easy with Examples

This tutorial explains Subnetting tricks in detail with 50+ Subnetting examples. Subnetting tricks explained in this tutorial not only make Subnetting easier but also allow you to answer any Subnetting related question in less than a minute. Learn Subnetting with examples in easy language.

Subnetting is one of the most complex and highly tested topics in any Cisco entry level exam and interview. In other situation, you may use any regular method of Subnetting. But in exam and interview, where time and accuracy matter, you should always use the easiest and the fastest methods of Subnetting such as explained in this tutorial.

This tutorial is the fourth part of the article “IP Subnetting in Computer Network Step by Step Explained with Examples”. Other parts of this article are following.

Network Address Broadcast Address and IP Address Explained

This tutorial is the first part of the article. It explains IP addressing and network addressing such as IP address, subnet mask, IP address types and IP classes in detail.

Basic Subnetting in Computer Networks Explained

This tutorial is the second part of the article. It explains what Subnetting is and why it is necessary in computer network along with the advantages of Subnetting.

Subnetting Tutorial - Subnetting Explained with Examples

This tutorial is the third part of the article. It explains the Subnetting concepts and terms such as network id, broadcast id, total hosts, valid hosts, power of 2, block size and CIDR in detail.

VLSM Subnetting Explained with Examples

This tutorial is the fifth part of the article. It explains what VLSM Subnetting is and how it is done step by step including differences between FLSM Subnetting and VLSM Subnetting.

VLSM Subnetting Examples and Calculation Explained

This tutorial is the sixth part of the article. It explains VLSM Subnetting examples for Cisco exams and interviews.

Supernetting Tutorial: - Supernetting Explained with Examples

This tutorial is the last part of the article. It explains Supernetting in detail with examples.

Key points of Subnetting

Before we start working with Subnetting examples, let’s have a quick recap of important Subnetting concepts and terms from previous parts of this tutorial.

An IP address is the combination of two addresses; network address and host address. Network address is always written first in sequence. While reading an IP address how much portion should be treated as network address and how much portion should be treated as host address is decided by an another address known as Subnet mask.

An IP address is always used with Subnet mask. Without subnet mask an IP address is an ambiguous address and vice versa.

Both IP address and Subnet mask consists 32 bits. These bits are divided in four octets. Octets are separated by periods and written in a sequence.

32 bits ip address

A Subnet mask can be written in two ways; in full form and in abbreviated form. In full form a decimal value of each octet is written along with IP address. In abbreviated form only the number of network bits are written along with IP address. Following table lists some examples of both types.

IP address with full subnet mask IP address with abbreviated subnet mask
10.0.0.0
255.0.0.0
10.0.0.0/8
172.168.1.0
255.255.0.0
172.168.1.0/16
192.168.1.0
255.255.255.0
192.198.1.0/24

In Subnetting questions, mostly second type is used.

There are five IP classes A, B, C, D and E. From these, only first three classes A, B and C are used in Subnetting. Subnetting cannot be done in class D and E.

In class A, B and C first 8, 16 and 24 bits are reserved for network address respectively. In all three classes last 2 bits are reserved for host addresses.

If we exclude reserved network bits and host bits from total IP bits, we will get Subnetting eligible host bits.

Subnetting can be done only in Subnetting eligible host bits.

subnetting eliglible bits

To know how many Subnetting bits are required to create how many networks, we use power of 2.

For example if we want to know many networks can be created from 3 Subnetting bits, we will use power 2 three times.

23 = 8

We can create 8 networks from 3 Subnetting host bits.

Power of 2
2XValue 2X Value 2X Value 2X Value
1 2 9 512 17 131072 25 33554432
2 4 10 1024 18 262144 26 67108864
3 8 11 2048 19 524288 27 134217728
4 16 12 4096 20 1048576 28 268435456
5 32 13 8192 21 2097152 29 536870912
6 64 14 16384 22 4194304 30 1073741824
7 128 15 32768 23 8388608 31 2147483648
8 256 16 65536 24 16777216 32 4294967296

In each network first address and last address are always reserved for network address and broadcast address respectively. Besides these two addresses, all remaining addresses are considered as valid host addresses.

Subnetting Questions

A Subnetting question can be asked in three ways.

  1. Find the number of networks and number of host addresses in each network
  2. Find the type of given address, network ID and broadcast ID
  3. Build the Subnet mask

Let’s understand the each type of Subnetting question in detail with examples.

Finding the number of networks and host addresses in each network

In this type of questions, we are asked to find the number of networks and host addresses in each network from a given address space. Let’s take some examples.

Following table lists 15 imaginary networks. Find the number of networks, total hosts and valid hosts in each network.

Example Subnetting Questions

10.0.0.0/10 130.0.0.0/18 192.168.1.0/26
20.12.0.0/13 140.50.60.0/20 200.0.0.0/27
78.59.12.0/16 172.168.1.0/24 210.200.0.0/28
112.15.0.0/24 180.10.20.0/28 215.0.0.0/29
122.14.25.0/28 185.0.0.0/30 220.220.10.0/30
Step 1

Determine the class of the given address space.

If the value of first octet is in range 0-127, 128-191, 192-223 then it belongs to class A, B and C respectively.

Subtract the given network bits from the reserved network bits. This will give us the number of host bits used as network bits in Subnetting.

Number of host bits used in Subnetting = Total bits used in network portion – reserved bits for network portion

Subtract the given network bits from 32 (total IP bits). This will give us the number of the host bits remaining in host portion.

Remaining host bits in host portion = 32 – Total bits used in network portion

Given Address space Total bits used
in network portion
(Value after slash)
IP Class Reserved network bits Number of host bits used in Subnetting Available bits in host portion
10.0.0.0/10 10 A 8 10 - 8 = 2 32 – 10 = 22
20.12.0.0/13 13 A 8 13 – 8 = 5 32 – 13 = 19
78.59.12.0/16 16 A 8 16 – 8 = 8 32 – 16 = 16
112.15.0.0/24 24 A 8 24 – 8 = 16 32 – 24 = 8
122.14.25.0/28 28 A 8 28 – 8 = 20 32 – 28 = 4
130.0.0.0/18 18 B 16 18 – 16 = 2 32 – 18 = 14
140.50.60.0/20 20 B 16 20 – 16 = 4 32 – 20 = 12
172.168.1.0/24 24 B 16 24 – 16 = 8 32 – 24 = 8
180.10.20.0/28 28 B 16 28 – 16 = 12 32 – 28 = 4
185.0.0.0/30 30 B 16 30 – 16 = 14 32 – 30 = 2
192.168.1.0/26 26 C 24 26 - 24 = 2 32 – 26 = 6
200.0.0.0/27 27 C 24 27 – 24 = 3 32 – 27 = 5
210.200.0.0/28 28 C 24 28 – 24 = 4 32 – 28 = 4
215.0.0.0/29 29 C 24 29 – 24 = 5 32 – 29 = 3
220.220.10.0/30 30 C 24 30 – 24 = 6 32 – 30 = 2

Once we know how many bits are used in Subnetting to create the additional networks, we can use following formulas to calculate number of networks, total hosts and valid hosts.

Number of networks (subnet) = 2N
Number of total host addresses in each network = 2H
Number of valid host addresses in each network = 2H – 2

Here N is the number of host bits used in Subnetting and H is the available host bits.

Given Address Host bits used
in Subnetting
Available host bits Networks (Subnets) Total hosts Valid hosts
10.0.0.0/102 22 4 (22) 4194304 (222) 4194302 (4194304 – 2)
20.12.0.0/135 19 32 (25) 524288 (219) 524286 (524288 - 2)
78.59.12.0/168 16 256 (28) 65536 (216) 65534 (65536 - 2)
112.15.0.0/2416 8 65536 (216) 256 (28) 254 (256 - 2)
122.14.25.0/2820 4 1048576 (220) 16 (24) 14 (16 - 2)
130.0.0.0/182 14 4 (22) 16384 (214) 16382 (16384 -2)
140.50.60.0/204 12 16 (24) 4096 (212) 4094 (4096 -2)
172.168.1.0/248 8 256 (28) 256 (28) 254 (256 -2)
180.10.20.0/2812 4 4096 (212) 16 (24) 14 (16 -2)
185.0.0.0/3014 2 16384 (214) 4 (22) 2 (4 -2)
192.168.1.0/262 6 4 (22) 64 (26) 62 (64 -2)
200.0.0.0/27 3 5 8 (23) 32 (25) 30 (32 -2)
210.200.0.0/28 4 4 16 (24) 16 (24) 14 (16 - 2)
215.0.0.0/29 5 3 32 (25) 8 (23) 6 (8 -2)
220.220.10.0/30 6 2 64 (26) 4 (22) 2 (4 -2)

Finding address type, network ID and broadcast ID

In this type of questions, we are asked to figure out the address type, network ID and broadcast ID from a given address. Let’s take some examples.

Find the address type, network ID and broadcast ID of following addresses.

Example Subnetting Questions

10.0.0.0/8 50.100.255.255/20 150.60.180.0/19 192.168.1.240/25
10.48.0.0/12 1.1.8.255/23 160.0.39.255/21 200.20.10.191/26
20.42.255.255/13 100.100.100.110/25 172.168.8.0/24 210.200.20.100/27
30.6.1.0/16 110.80.20.128/27 180.78.0.64/28 215.0.0.47/28
40.60.240.0/17 120.20.30.15/30 185.0.0.26/29 220.10.10.50/29
Step 1

Find the interesting octet and make two new addresses from the given address in rough area of worksheet as explained following: -

  • If octet comes before the interesting octet, write it as it is.
  • If octet comes after the interesting octet, in first address write 0 and in second address write 255.
  • In interesting octet write a placeholder character “X”.

Interesting octet is the octet in which given network bits separate from host bits. To find it, see the value after slash. If value is in range 1-8, 9-16, 17-24 and 25-32 then the interesting octet is first octet, second octet, third octet and fourth octet respectively.

finding interseting octet

Given Address Value after slash Interesting octet First address Second Address
10.0.0.0/8 /8 First (1-8) X.0.0.0 X.255.255.255
10.48.0.0/12 /12 Second (9-16) 10.X.0.0 10.X.255.255
20.42.255.255/13 /13 Second (9-16) 20.X.0.0 20.X.255.255
30.6.1.0/16 /16 Second (9-16) 30.X.0.0 30.X.255.255
40.60.240.0/17 /17 Third (17-24) 40.60.X.0 40.60.X.255
50.100.255.255/20 /20 Third (17 -24) 50.100.X.0 50.100.X.255
1.1.8.255/23 /23 Third (17-24) 1.1.X.0 1.1.X.255
100.100.100.110/25 /25 Fourth (26 -32) 100.100.100.X 100.100.100.X
110.80.20.128/27 /27 Fourth (25-32) 110.80.20.X 110.80.20.X
120.20.30.15/30 /30 Fourth (25-32) 120.20.30.X 120.20.30.X
150.60.180.0/19 /19 Third (17-24) 150.60.X.0 150.60.X.255
160.0.39.255/21 /21 Third (17-24) 160.0.X.0 160.0.X.255
172.168.8.0/24 /24 Third (17-24) 172.168.X.0 172.168.X.255
180.78.0.64/28 /28 Fourth (25-32) 180.78.0.X 180.78.0.X
185.0.0.26/29 /29 Fourth (25-32) 185.0.0.X 185.0.0.X
192.168.1.240/25 /25 Fourth (25-32) 192.168.1.X 192.168.1.X
200.20.10.191/26 /26 Fourth (25-32) 200.20.10.X 200.20.10.X
210.200.20.100/27 /27 Fourth (25-32) 210.200.20.X 210.200.20.X
215.0.0.47/28 /28 Fourth (25-32) 215.0.0.X 215.0.0.X
220.10.10.50/29 /29 Fourth (25-32) 220.10.10.X 220.10.10.X
Step 2

Based on interesting octet, subtract after slash value form the upper value of octet range.

  • Subtract it from 8 if interesting octet is the first octet.
  • Subtract it from 16 if interesting octet is the second octet.
  • Subtract it from 24 if interesting octet is the third octet.
  • Subtract it from 32 if interesting octet is the fourth octet.
Given Address Value after slash Interesting octet Upper value of range Subtraction
10.0.0.0/8 /8 First(1-8) 8 8 – 8 = 0
10.48.0.0/12 /12 Second (9-16) 16 16 – 12 = 4
20.42.255.255/13 /13 Second (9-16) 16 16 – 13 = 3
30.6.1.0/16 /16 Second (9-16) 16 16 – 16 = 0
40.60.240.0/17 /17 Third (17-24) 24 24 – 17 = 7
50.100.255.255/20 /20 Third (17 -24) 24 24 - 17 = 6
1.1.8.255/23 /23 Third (17-24) 24 24 – 23 = 1
100.100.100.110/25 /25 Fourth (26 -32) 32 32 – 26 = 6
110.80.20.128/27 /27 Fourth (25-32) 32 32 – 27= 5
120.20.30.15/30 /30 Fourth (25-32) 32 32 – 30 = 2
150.60.180.0/19 /19 Third (17-24) 24 24 – 19 = 5
160.0.39.255/21 /21 Third (17-24) 24 24 – 21 = 3
172.168.8.0/24 /24 Third (17-24) 24 24 – 24 = 0
180.78.0.64/28 /28 Fourth (25-32) 32 32 – 28 = 4
185.0.0.26/29 /29 Fourth (25-32) 32 32 – 29 = 3
192.168.1.240/25 /25 Fourth (25-32) 32 32 – 25 = 7
200.20.10.191/26 /26 Fourth (25-32) 32 32 – 26 = 6
210.200.20.100/27 /27 Fourth (25-32) 32 32 – 27 = 5
215.0.0.47/28 /28 Fourth (25-32) 32 32 – 28 = 4
220.10.10.50/29 /29 Fourth (25-32) 32 32 – 29 = 3
Step 3

Use the result of subtraction in following formula to calculate the block size

Block size = 2result of subtraction
Given Address Interesting octet Result of subtraction Block Size
10.0.0.0/8 First 0 (20) = 1
10.48.0.0/12 Second 4 (24) = 16
20.42.255.255/13 Second 3 (23) = 8
30.6.1.0/16 Second 0 (20) = 1
40.60.240.0/17 Third 7 (27) = 128
50.100.255.255/20 Third 6 (26) = 64
1.1.8.255/23 Third 1 (21) = 2
100.100.100.110/25 Fourth 6 (26) = 64
110.80.20.128/27 Fourth 5 (25) = 32
120.20.30.15/30 Fourth 2 (22) = 4
150.60.180.0/19 Third 5 (25) = 32
160.0.39.255/21 Third 3 (23) = 8
172.168.8.0/24 Third 0 (20) = 1
180.78.0.64/28 Fourth 4 (24 ) = 16
185.0.0.26/29 Fourth 3 (23) = 8
192.168.1.240/25 Fourth 7 (27) = 128
200.20.10.191/26 Fourth 6 (26) = 64
210.200.20.100/27 Fourth 5 (25) = 32
215.0.0.47/28 Fourth 4 (24) = 16
220.10.10.50/29 Fourth 3 (23) = 8
Step 4

Starting from 0, calculate the block size until the value given in interesting octet does not come in the range.

In calculation the number 0 is used as the first number. For example if we are calculating block size 4 then it would be calculated as 0,1,2,3 instead of 1,2,3,4.

Once you got the range in block size which cover the given value in interesting octet, stop the calculation. For example value in interesting octet is 27 and block size is 8 then the range will be 24-31 (0-7, 8-15, 16-23, 24-31).

Given Address Interesting octet Interesting octet value Block Size Range in block size which cover the value of interesting octet
10.0.0.0/8 First 10 1 0-0, 1-1, 2-2, 3-3, 4-4, 5-5, 6-6, 7-7, 8-8, 9-9, 10-10
10.48.0.0/12 Second 48 16 0-15, 16-31, 32-47, 48-63
20.42.255.255/13 Second 42 8 0-7, 8-15, 16-23, 24-31, 32-39, 40-47
30.6.1.0/16 Second 6 1 0-0, 1-1, 2-2, 3-3, 4-4, 5-5, 6-6
40.60.240.0/17 Third 240 128 0-127, 128-255
50.100.255.255/20 Third 255 64 0-63, 64-127, 128- 191, 192-255
1.1.8.255/23 Third 8 2 0-1, 2-3, 4-5, 6-7, 8-9
100.100.100.110/25 Fourth 110 64 0-63, 64-127
110.80.20.128/27 Fourth 128 32 0-31, 32-63, 64-95, 96 -127, 128-159
120.20.30.15/30 Fourth 15 4 0-3, 4-7, 8-11, 12-15
150.60.180.0/19 Third 180 32 0-31, 32-63, 64-95, 96 -127, 128-159, 160 - 191
160.0.39.255/21 Third 39 8 0-7, 8-15, 16-23, 24-31, 32-39
172.168.8.0/24 Third 8 1 0-0, 1-1, 2-2, 3-3, 4-4, 5-5, 6-6, 7-7, 8-8
180.78.0.64/28 Fourth 64 16 0-15, 16-31, 32-47, 48-63, 64-79
185.0.0.26/29 Fourth 26 8 0-7, 8-15, 16-23, 24-31
192.168.1.240/25 Fourth 240 128 0-127, 128-255
200.20.10.191/26 Fourth 191 64 0-63, 64-127, 128- 191
210.200.20.100/27 Fourth 100 32 0-31, 32-63, 64-95, 96 -127
215.0.0.47/28 Fourth 47 16 0-15, 16-31, 32-47
220.10.10.50/29 Fourth 50 8 0-7, 8-15, 16-23, 24-31, 32-39, 40-47, 48- 55
Step 5

Update the temporary addresses written in first step as following: -

  • In first address, replace the placeholder character “X” with the starting value of the range.
  • In second address, replace the placeholder character “X” with the ending value of the range.

After this update first address and second address will become the network address and broadcast address of the given address respectively.

Once it’s done, you can easily determine the type of the given address.

  • If given address exactly matches with the network address then it’s a network address.
  • If given address exactly matches with the broadcast address then it’s a broadcast address.
  • If given address is neither a network address nor a broadcast address then it’s a valid host address.
Given Address Interesting octet Interesting
octet value
Block range Network address Broadcast address Type
10.0.0.0/8 First 10 10-1010.0.0.0 10.255.255.255 Network
10.48.0.0/12 Second 48 48-6310.48.0.0 10.63.255.255 Network
20.42.255.255/13 Second 42 40-47 20.40.0.0 20.47.255.255 Valid host
30.6.1.0/16 Second 6 6-6 30.6.0.0 30.6.255.255 Valid host
40.60.240.0/17 Third 240 128-255 40.60.128.0 40.60.255.255 Valid Host
50.100.255.255/20 Third 255 192-255 50.100.192.050.100.255.255 Broadcast
1.1.8.255/23 Third 8 8-9 1.1.8.0 1.1.9.255 Valid host
100.100.100.110/25 Fourth 110 64-127 100.100.100.64 100.100.100.127 Valid Host
110.80.20.128/27 Fourth 128 128-159110.80.20.128 110.80.20.159 Network
120.20.30.15/30 Fourth 15 12-15 120.20.30.12 120.20.30.15 Broadcast
150.60.180.0/19 Third 180 160 - 191 150.60.160.0 150.60.191.255 Valid host
160.0.39.255/21 Third 39 32-39 160.0.32.0160.0.39.255 Broadcast
172.168.8.0/24 Third 8 8-8 172.168.8.0172.168.8.255 Network
180.78.0.64/28 Fourth 64 64-79180.78.0.64 180.78.0.79 Network
185.0.0.26/29 Fourth 26 24-31 185.0.0.24 185.0.0.31 Valid host
192.168.1.240/25 Fourth 240 128-255 192.168.1.128 192.168.1.255 Valid host
200.20.10.191/26 Fourth 191 128- 191 200.20.10.128 200.20.10.191 Broadcast
210.200.20.100/27 Fourth 100 96 -127 210.200.20.96 210.200.20.127 Valid host
215.0.0.47/28 Fourth 47 32-47 215.0.0.32215.0.0.47 Broadcast
220.10.10.50/29 Fourth 50 48- 55 220.10.10.48 220.10.10.55 valid host

Building the Subnet mask value

In this type of questions, we are asked to build the full subnet mask from an abbreviated subnet mask. Let’s take some examples.

Find the full subnet mask of following networks.

20.10.30.0/8, 111.187.45.34/14, 162.160.46.24/20, 202.100.20.50/30

Step 1

Find the interesting octet as explained above.

Given network Value after slash Interesting octet
20.10.30.0/8 8 First
111.187.45.34/14 14 Second
162.160.46.24/20 20 Third
202.100.20.50/27 27 Fourth
Step2

In rough area of worksheet, write a temporary subnet mask as following: -

  • If octet comes before the interesting octet, write 255.
  • In interesting octet, write “X”.
  • If octet comes after the interesting octet, write 0.
Given network Value after slash Interesting octet Temporary mask
20.10.30.0/8 8 First X.0.0.0
111.187.45.34/14 14 Second 255.X.0.0
162.160.46.24/20 20 Third 255.255.X.0
202.100.20.50/27 27 Fourth 255.255.255.X
Step 3

Just like we did above, based on interesting octet, subtract the given value from the upper value of interesting octet range.

Given network Value after slash Interesting octet Interesting octet range Subtraction
20.10.30.0/8 8 First 1 – 8 8 – 8 = 0
111.187.45.34/14 14 Second 9 – 16 16 – 14 = 2
162.160.46.24/20 20 Third 17 – 24 24 -20 = 4
202.100.20.50/27 27 Fourth 25 – 32 32 – 27 = 5
Step 4

Use the result of subtraction in following formula to get the octet value

Octet value = 256 - 2 Remainder

Given network Value after slash Subtraction result Calculation Step 1 Calculation step 2
20.10.30.0/8 8 0 20 = 1 256 – 1 = 255
111.187.45.34/14 14 2 22 = 4 256 – 4 = 252
162.160.46.24/20 20 4 24 = 16 256 – 16 = 240
202.100.20.50/27 27 5 25 = 32 256 – 32 = 224
Step 5

Replace the “X” with octet value in interesting octet to build the full subnet mask

Given network Value after slash Temporary mask Octet value Subnet mask
20.10.30.0/8 8 X.0.0.0 255 255.0.0.0
111.187.45.34/14 14 255.X.0.0 252 255.252.0.0
162.160.46.24/20 20 255.255.X.0 240 255.255.240.0
202.100.20.50/27 27 255.255.255.X 224 255.255.255.224

That’s all for this for this tutorial. If you need any assistance regarding this tutorial or have any feedback or comment about this tutorial, please mail me. If you like this tutorial, please don’t forget to share it through your favorite social network.

ComputerNetworkingNotes CCNA Study Guide Subnetting Tricks Subnetting Made Easy with Examples