**Subnet Mask-**

Before you go through this article, make sure that you gone through the previous article on **Subnet Mask**.

We have discussed-

- Subnet mask is a 32 bit number consisting of a sequence of 1’s and 0’s.
- It is used to identify the subnet to which the given IP Address belongs.

In this article, we will discuss practice problems based on subnet mask.

**PRACTICE PROBLEMS BASED ON SUBNET MASK-**

**Problems-01 to 09:**

Consider the following subnet masks-

- 255.0.0.0
- 255.128.0.0
- 255.192.0.0
- 255.240.0.0
- 255.255.0.0
- 255.255.254.0
- 255.255.255.0
- 255.255.255.224
- 225.255.255.240

For each subnet mask, find-

- Number of hosts per subnet
- Number of subnets if subnet mask belongs to class A
- Number of subnets if subnet mask belongs to class B
- Number of subnets if subnet mask belongs to class C
- Number of subnets if total 10 bits are used for the global network ID

**Solutions-**

All the problems are solved below one by one-

**Solution-01:**

Given subnet mask is 255.0.0.0

So,

- Number of Net ID bits + Number of Subnet ID bits = 8
- Number of Host ID bits = 24

**Part-A:**

Since number of Host ID bits = 24, so-

Number of hosts per subnet = 2^{24} – 2 |

**Part-B****:**

If the given subnet mask belongs to class A, then number of Net ID bits = 8.

Substituting in the above equation, we get-

Number of Subnet ID bits = 8 – 8 = 0

Thus,

Number of subnets = 2^{0} = 1 |

Thus, there will be only one single network.

**Part-C****:**

- First two octets of the subnet mask are not completely filled with 1’s.
- So, given subnet mask can not belong to class B.

**Part-D****:**

- First three octets of the subnet mask are not completely filled with 1’s.
- So, given subnet mask can not belong to class C.

**Part-E****:**

- First 10 bits of the subnet mask are not completely filled with 1’s.
- So, given subnet mask can not use 10 bits for the Network ID.

**NOTE-**

- 255.0.0.0 is the default mask for class A.

**Solution-02:**

Given subnet mask is 255.128.0.0

So,

- Number of Net ID bits + Number of Subnet ID bits = 9
- Number of Host ID bits = 23

**Part-A:**

Since number of Host ID bits = 23, so-

Number of hosts per subnet = 2^{23} – 2 |

**Part-B****:**

If the given subnet mask belongs to class A, then number of Net ID bits = 8.

Substituting in the above equation, we get-

Number of Subnet ID bits = 9 – 8 = 1

Thus,

Number of subnets = 2^{1} = 2 |

**Part-C****:**

- First two octets of the subnet mask are not completely filled with 1’s.
- So, given subnet mask can not belong to class B.

**Part-D****:**

- First three octets of the subnet mask are not completely filled with 1’s.
- So, given subnet mask can not belong to class C.

**Part-E****:**

- First 10 bits of the subnet mask are not completely filled with 1’s.
- So, given subnet mask can not use 10 bits for the Network ID.

**Solution-03:**

Given subnet mask is 255.192.0.0

So,

- Number of Net ID bits + Number of Subnet ID bits = 10
- Number of Host ID bits = 22

**Part-A:**

Since number of Host ID bits = 22, so-

Number of hosts per subnet = 2^{22} – 2 |

**Part-B****:**

If the given subnet mask belongs to class A, then number of Net ID bits = 8.

Substituting in the above equation, we get-

Number of Subnet ID bits = 10 – 8 = 2

Thus,

Number of subnets = 2^{2} = 4 |

**Part-C****:**

- First two octets of the subnet mask are not completely filled with 1’s.
- So, given subnet mask can not belong to class B.

**Part-D****:**

- First three octets of the subnet mask are not completely filled with 1’s.
- So, given subnet mask can not belong to class C.

**Part-E****:**

Given 10 bits are used for the Net ID part.

Substituting in the above equation, we get-

Number of Subnet ID bits = 10 – 10 = 0

Thus,

Number of subnets = 2^{0} = 1 |

Thus, there will be only one single network.

**Solution-04:**

Given subnet mask is 255.240.0.0

So,

- Number of Net ID bits + Number of Subnet ID bits = 12
- Number of Host ID bits = 20

**Part-A:**

Since number of Host ID bits = 20, so-

Number of hosts per subnet = 2^{20} – 2 |

**Part-B****:**

If the given subnet mask belongs to class A, then number of Net ID bits = 8.

Substituting in the above equation, we get-

Number of Subnet ID bits = 12 – 8 = 4

Thus,

Number of subnets = 2^{4} = 16 |

**Part-C****:**

- First two octets of the subnet mask are not completely filled with 1’s.
- So, given subnet mask can not belong to class B.

**Part-D****:**

- First three octets of the subnet mask are not completely filled with 1’s.
- So, given subnet mask can not belong to class C.

**Part-E****:**

Given 10 bits are used for the Net ID part.

Substituting in the above equation, we get-

Number of Subnet ID bits = 12 – 10 = 2

Thus,

Number of subnets = 2^{2} = 4 |

**Solution-05:**

Given subnet mask is 255.255.0.0

So,

- Number of Net ID bits + Number of Subnet ID bits = 16
- Number of Host ID bits = 16

**Part-A:**

Since number of Host ID bits = 16, so-

Number of hosts per subnet = 2^{16} – 2 |

**Part-B****:**

If the given subnet mask belongs to class A, then number of Net ID bits = 8.

Substituting in the above equation, we get-

Number of Subnet ID bits = 16 – 8 = 8

Thus,

Number of subnets = 2^{8} |

**Part-C****:**

If the given subnet mask belongs to class B, then number of Net ID bits = 16.

Substituting in the above equation, we get-

Number of Subnet ID bits = 16 – 16 = 0

Thus,

Number of subnets = 2^{0} = 1 |

**Part-D****:**

- First three octets of the subnet mask are not completely filled with 1’s.
- So, given subnet mask can not belong to class C.

**Part-E****:**

Given 10 bits are used for the Net ID part.

Substituting in the above equation, we get-

Number of Subnet ID bits = 16 – 10 = 6

Thus,

Number of subnets = 2^{6} = 64 |

**NOTE-**

- 255.255.0.0 is the default mask for class B.

**Solution-06:**

Given subnet mask is 255.255.254.0

So,

- Number of Net ID bits + Number of Subnet ID bits = 23
- Number of Host ID bits = 9

**Part-A:**

Since number of Host ID bits = 9, so-

Number of hosts per subnet = 2^{9} – 2 |

**Part-B****:**

If the given subnet mask belongs to class A, then number of Net ID bits = 8.

Substituting in the above equation, we get-

Number of Subnet ID bits = 23 – 8 = 15

Thus,

Number of subnets = 2^{15} |

**Part-C****:**

If the given subnet mask belongs to class B, then number of Net ID bits = 16.

Substituting in the above equation, we get-

Number of Subnet ID bits = 23 – 16 = 7

Thus,

Number of subnets = 2^{7} |

**Part-D****:**

- First three octets of the subnet mask are not completely filled with 1’s.
- So, given subnet mask can not belong to class C.

**Part-E****:**

Given 10 bits are used for the Net ID part.

Substituting in the above equation, we get-

Number of Subnet ID bits = 23 – 10 = 13

Thus,

Number of subnets = 2^{13} |

**Solution-07:**

Given subnet mask is 255.255.255.0

So,

- Number of Net ID bits + Number of Subnet ID bits = 24
- Number of Host ID bits = 8

**Part-A:**

Since number of Host ID bits = 8, so-

Number of hosts per subnet = 2^{8} – 2 |

**Part-B****:**

If the given subnet mask belongs to class A, then number of Net ID bits = 8.

Substituting in the above equation, we get-

Number of Subnet ID bits = 24 – 8 = 16

Thus,

Number of subnets = 2^{16} |

**Part-C****:**

If the given subnet mask belongs to class B, then number of Net ID bits = 16.

Substituting in the above equation, we get-

Number of Subnet ID bits = 24 – 16 = 8

Thus,

Number of subnets = 2^{8} |

**Part-D****:**

If the given subnet mask belongs to class C, then number of Net ID bits = 24.

Substituting in the above equation, we get-

Number of Subnet ID bits = 24 – 24 = 0

Thus,

Number of subnets = 2^{0} = 1 |

**Part-E****:**

Given 10 bits are used for the Net ID part.

Substituting in the above equation, we get-

Number of Subnet ID bits = 24 – 10 = 14

Thus,

Number of subnets = 2^{14} |

**NOTE-**

- 255.255.255.0 is the default mask for class C.

**Solution-08:**

Given subnet mask is 255.255.255.224

So,

- Number of Net ID bits + Number of Subnet ID bits = 27
- Number of Host ID bits = 5

**Part-A:**

Since number of Host ID bits = 5, so-

Number of hosts per subnet = 2^{5} – 2 |

**Part-B****:**

If the given subnet mask belongs to class A, then number of Net ID bits = 8.

Substituting in the above equation, we get-

Number of Subnet ID bits = 27 – 8 = 19

Thus,

Number of subnets = 2^{19} |

**Part-C****:**

If the given subnet mask belongs to class B, then number of Net ID bits = 16.

Substituting in the above equation, we get-

Number of Subnet ID bits = 27 – 16 = 11

Thus,

Number of subnets = 2^{11} |

**Part-D****:**

If the given subnet mask belongs to class C, then number of Net ID bits = 24.

Substituting in the above equation, we get-

Number of Subnet ID bits = 27 – 24 = 3

Thus,

Number of subnets = 2^{3} = 8 |

**Part-E****:**

Given 10 bits are used for the Net ID part.

Substituting in the above equation, we get-

Number of Subnet ID bits = 27 – 10 = 17

Thus,

Number of subnets = 2^{17} |

**Solution-09:**

Given subnet mask is 255.255.255.240

So,

- Number of Net ID bits + Number of Subnet ID bits = 28
- Number of Host ID bits = 4

**Part-A:**

Since number of Host ID bits = 4, so-

Number of hosts per subnet = 2^{4} – 2 |

**Part-B****:**

If the given subnet mask belongs to class A, then number of Net ID bits = 8.

Substituting in the above equation, we get-

Number of Subnet ID bits = 28 – 8 = 20

Thus,

Number of subnets = 2^{20} |

**Part-C****:**

If the given subnet mask belongs to class B, then number of Net ID bits = 16.

Substituting in the above equation, we get-

Number of Subnet ID bits = 28 – 16 = 12

Thus,

Number of subnets = 2^{12} |

**Part-D****:**

If the given subnet mask belongs to class C, then number of Net ID bits = 24.

Substituting in the above equation, we get-

Number of Subnet ID bits = 28 – 24 = 4

Thus,

Number of subnets = 2^{4} |

**Part-E****:**

Given 10 bits are used for the Net ID part.

Substituting in the above equation, we get-

Number of Subnet ID bits = 28 – 10 = 18

Thus,

Number of subnets = 2^{18} |

**Problem-10:**

Consider default subnet mask for a network is 255.255.255.0. How many number of subnets and hosts per subnet are possible if ‘m’ bits are borrowed from HID.

- 2
^{m}, 2^{(HID-m)}– 2 - 2
^{m}, 2^{(HID-m)} - 2
^{m}– 1, 2^{(HID-m)}– 2 - 2
^{m}, (HID-m) – 2

**Solution-**

- Subnet mask = 255.255.255.0
- Number of bits borrowed from Host ID part = m
- So, number of subnets possible = 2
^{m} - Number of bits available for Hosts = HID – m
- So, number of hosts that can be configured = 2
^{(HID – m)}– 2

Thus, Option (A) is correct.

**Problem-11:**

If default subnet mask for a network is 255.255.255.0 and if ‘m’ bits are borrowed from the NID, then what could be its supernet mask?

- 255.255.(2
^{8-m}– 1) x 2^{m}.0 - 255.255.(2
^{8-m}) x 2^{m}.0 - 255.255.(2
^{8-m-1}) x 2^{m-1}.0 - 255.255.(2
^{8-m}) x 2^{m-1}.0

**Solution-**

Given-

- Subnet mask = 255.255.255.0
- m bits are chosen from the NID part.

Clearly, given subnet mask belongs to class C.

If m = 4, then the subnet mask = 255.255.11110000.0

Now, let us check all the options one by one.

**Option-A:**

Given-

- Supernet mask = 255.255.(2
^{8-m}– 1) x 2^{m}.0 - Third octet = (2
^{8-m}– 1) x 2^{m}

On substituting m = 4, we get-

Third octet

= 15 x 2^{4}

= (1111)_{2} x 2^{4}

= 11110000 (Performing Left shift by 4 places)

Yes, this is what the third octet should be.

Thus, Option (A) is correct.

**Option-B:**

Given-

- Supernet mask = 255.255.(2
^{8-m}) x 2^{m}.0 - Third octet = (2
^{8-m}) x 2^{m}

On substituting m = 4, we get-

Third octet

= 16 x 2^{4}

= (10000)_{2} x 2^{4}

= 100000000 (Performing Left shift by 4 places)

This can not be true because these are 9 bits and octet can be only 8 bits.

Thus, Option (B) is incorrect.

Similarly, other options are also incorrect.

Finally, Option (A) is the only correct option.

To watch video solutions and practice more problems,

**Next Article-** **Routing Table | Arrangement of Subnets**

Get more notes and other study material of **Computer Networks**.

Watch video lectures by visiting our YouTube channel **LearnVidFun.**