Subnet Masking in Computer Networks

For Complete YouTube Video: Click Here

We will try to understand Subnet Masking in Computer Networks in this class.

We have clearly understood the concept of creating a subnet in our previous class.

Understanding the concepts discussed in our previous class is very important to know what we discuss in this class.

Subnet Masking in Computer Networks

The image below shows the subnet created by a university for four departments.

The subnet created in the above diagram is a private network.

This network is connected to the internet and got a message with the destination IP address 194.24.2.10.

The task of the internal router is to find a subnet to which the destination host is connected.

With common sense, by seeing the above diagram, we can say that the destination host got connected to Network 1 [CSE Department].

The subnet mask can identify the network ID to which the host is connected.

What is the subnet mask?

A subnet mask is a 32-bit number created by setting host bits to all 0s and setting network bits to all 1s.

We have used 24 bits for the network ID in the above network and 2 bits for the subnet ID.

Therefore, 26 bits are for the network id and 6 for the host ids.

As shown below, we can get the subnet mask from the definition by filling all 1’s in the network id part [26 bits] and all 0’s in the host id part [6 bits].

From the above diagram, the subnet mask is 255.255.255.192.

How to calculate the network id of the subnet from the destination IP and the subnet mask?

We can get the network ID of the subnet by ANDing the subnet mask and the destination IP.

The final result is as shown below.