Subnet Mask | Practice Problems

Spread the love

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-

  1. 255.0.0.0
  2. 255.128.0.0
  3. 255.192.0.0
  4. 255.240.0.0
  5. 255.255.0.0
  6. 255.255.254.0
  7. 255.255.255.0
  8. 255.255.255.224
  9. 225.255.255.240

 

For each subnet mask, find-

  1. Number of hosts per subnet
  2. Number of subnets if subnet mask belongs to class A
  3. Number of subnets if subnet mask belongs to class B
  4. Number of subnets if subnet mask belongs to class C
  5. 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 = 224 – 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 = 20 = 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 = 223 – 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 = 21 = 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 = 222 – 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 = 22 = 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 = 20 = 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 = 220 – 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 = 24 = 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 = 22 = 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 = 216 – 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 = 28

 

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 = 20 = 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 = 26 = 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 = 29 – 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 = 215

 

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 = 27

 

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 = 213

 

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 = 28 – 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 = 216

 

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 = 28

 

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 = 20 = 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 = 214

 

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 = 25 – 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 = 219

 

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 = 211

 

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 = 23 = 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 = 217

 

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 = 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 = 28 – 8 = 20

Thus,

 

Number of subnets = 220

 

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 = 212

 

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 = 24

 

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 = 218

 

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.

  1. 2m , 2(HID-m) – 2
  2. 2m , 2(HID-m)
  3. 2m – 1, 2(HID-m) – 2
  4. 2m , (HID-m) – 2

 

Solution-

 

  • Subnet mask = 255.255.255.0
  • Number of bits borrowed from Host ID part = m
  • So, number of subnets possible = 2m
  • 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?

  1. 255.255.(28-m – 1) x 2m.0
  2. 255.255.(28-m) x 2m.0
  3. 255.255.(28-m-1) x 2m-1.0
  4. 255.255.(28-m) x 2m-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.(28-m – 1) x 2m.0
  • Third octet = (28-m – 1) x 2m

 

On substituting m = 4, we get-

Third octet

= 15 x 24

= (1111)2 x 24

= 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.(28-m) x 2m.0
  • Third octet = (28-m) x 2m

 

On substituting m = 4, we get-

Third octet

= 16 x 24

= (10000)2 x 24

= 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,

Watch this Video Lecture

 

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.

Summary
Subnet Mask | Practice Problems
Article Name
Subnet Mask | Practice Problems
Description
Practice Problems based on Subnet Mask. Subnet Mask is a 32 bit number that identifies the subnet to which an IP Address belongs. How to calculate Subnet Mask? Subnet Mask for IP Address is calculated by setting all the bits reserved for network ID and subnet ID to 1 and all the bits reserved for Host ID to 0.
Author
Publisher Name
Gate Vidyalay
Publisher Logo

Spread the love