Understanding Subnet Mask
Subnet mask is an important component of networking. Subnet mask is kind of the component which activates the network. Without subnet mask the IP address cannot start communicating logically. In networking subnet mask defines the network and the size of the network. If we classify a network then we also classify that depending on subnet mask. Like
Class A: 255.0.0.0
Class B: 255.255.0.0
Class C: 255.255.255.0
Class A subnet mask is 8bit. Class B subnet mask is 16bit and class C subnet mask is 24bit.
If we don’t use subnet mask properly then it will be difficult to communicate between two hosts. What are the possible problems we may face if the subnet mask is incorrect!
- Source host may not be able to find the destination host.
- Remote hosts will not be able to find the host into a local network.
- The hosts within the local network may not be able to recognize the host.
- In case of ping we will find request time out.
Let’s discuss about how it works! It works using AND process. Suppose we assume source IP address is
So the subnet mask is 255.255.255.0
Destination IP is 192.168.2.2
Also the subnet mask is 255.255.255.0
If we convert them into binary then the IP address will be:
Subnet mask will be:
So if we use AND process the network is
Now desitination IP is 192.168.2.2, if we convert this into binary then we get:
Subnet mask is:
AND process result of this network is
So from the above result we can find that the last part of the results are same which means that the last part is the network part the rest is network part. Using this result we can find the network part and we can understand if the network is in local network or not. If the last part does not match then the traffic will go through the default gateway.
This is how the subnet mask works.