What is a SUBNET MASK ?

A subnet mask defines the part of an IP address that is the network ID and the part of an IP address that is the host ID. A subnet mask is composed of four octets, similar to an IP address.

In simple IP networks, the subnet mask defines full octets as part of the network ID and host ID. A 255 represents an octet that is the part of the network ID, and 0 represents an octet that is part of the host ID. In complex IP networks, octets can be subdivided.

Why a subnet mask is required ?

When a computer delivers an IP packet, it uses the subnet mask to validate whether the destination is on the same network or on a remote network. If the destination is on the same network, the packet can be delivered by the computer. If the destination is on the different network, the computer must send the packet to a router for delivery.

To make you understand about subnet mask, I give you a simple example
Subnet Mask


In this above picture I have taken 3 users named emdadblog, blogspot, com.

For the first user Emdadblog I use 192.168.1.1 as a Host ID and 255.255.255.0 as a Subnet Mask.

For the Second user Blogspot I use 192.168.1.2 as a Host ID and 255.255.255.0 as a Subnet Mask.

For the Third user Com I use 192.168.2.1 as a Host ID and 255.255.255.0 as a Subnet Mask.

Now if I want to send a file through internet from Emdadblog to Blogspot, I can send the file easily. Because the subnet mask between Emdadblog and Blogspot are same. Although their Host ID is different but their Network ID are same

If I want to send to a file through internet from Emdadblog to Com, I can not send the file. Because Emdadblog user is using 192.168.1.0 Network ID and Com user is using 192.168.2.0 and their Network ID are not same. In this situation to send a file through internet from Emdadblog user to Com user, we need to use ROUTER.

Note : Router helps you to connect two different Network and it's works like as a connector.

Valid Subnet Masks
In a simple IP network, a subnet mask is composed of only 255s and 0s. Other values are not used. In addition, 255s appear at the beginning of the subnet mask and 0s appear at the end. In a valid subnet mask, 0s cannot be interspersed with 255s. Example of valid and invalid subnet masks are shown in the following table

Valid Subnet Mask Invalid Subnet Mask
255.0.0.0 0.0.255.255
255.255.00 255.0.255.0
255.255.255.0 0.255.255.0

5 comments:

  1. An IP address has two components, the network address and the host address. A subnet mask separates the IP address into the network and host addresses (). Subnetting further divides the host part of an IP address into a subnet and host address (. It is called a subnet mask because it is used to identify network address of an IP address by perfoming bitwise AND operation on the netmask.

    ReplyDelete
    Replies
    1. can i assign any of that valid subnetmask to a network?

      Delete
  2. The word subnetwork (usually shortened to subnet) has two related meanings. In the older and more general meaning, it meant one physical network of an internetwork. In the Internet Protocol (IP), a subnetwork is a division of a classful network. The rest of this article is about the second meaning.

    ReplyDelete
  3. Thanks for clarifying what a subnet mask is. Other sites complicate the explanations with no clear examples.

    ReplyDelete

Let us know, what you think about this blog