Classless Subnetting

 Understanding Subnet Mask 

             If you want your computer to connect to another computer on the same network or a computer that is in another network, you must have an IP address, a subnet mask and a default gateway. No exceptions! Alright, let’s cut to the chase. A subnet mask is a tool that tells the sending computer (which is sending data to another computer) whether the destination IP address is local (belongs to the same network) or long distance (belongs to another network). To understand better, let’s picture this scenario. Three friends, Nico, Seb, and Michael, sit at their computers. Michael and Seb are on the same LAN (Local Area Network) and Nico is on a completely different LAN. Let’s see how they communicate. 

 

                                     

                 The process of getting a data packet from a local computer is entirely different from the process of getting a data packet from a faraway network. If a computer wants to send a packet to a local computer, it sends a broadcast to get the other computer’s MAC address. If the computer wants to send a packet to the computer which is on a faraway network, the sending computer uses the default gateway to send the packet. In the scenario illustrated above, Michael’s PC wants to send some data to Seb’s PC, where they are both on the same network. Wait how does Michael’s PC know that the PC of Seb is on the same network as Michael’s? Strange. I’m going to tell the truth, you ready? It’s the subnet mask that identified Seb’s computer as a local computer. Every TCP/IP computer needs a Subnet Mask to tell the sending computer whether the destination IP address is local or long distance.  

            A subnet mask is a string of ones followed by some zeros, with exactly 32 bits in total. This subnet mask is typed into every TCP/IP host in advance. This is how a subnet mask looks like: 

             11111111111111111111111100000000     

          Let’s convert this to dotted decimal for us humans to understand. Add some periods (computers really don’t care about those periods):                                              11111111.11111111.11111111.00000000 

Converting each octet into decimal, now the subnet mask looks something like this 

        255.255.255.0 

When you put an IP address alongside a subnet mask, the portion of ones that align with the subnet mask binary is called the network ID, and the zeros part which aligns with the binary subnet mask is the host ID. Now let’s understand this with an example:  

Consider an IP address that goes like this 192.168.5.23 with a subnet mask 255.255.255.0. We have to convert the IP address and subnet mask to binary. So, the binary of IP address and subnet mask goes like this 

192.168.5.23- 11000000.10101000.00000101.00010111 

255.255.255.0- 11111111.11111111.11111111.00000000 

From the IP address 192.168.5.23, the underlined part is the network ID and the non-underlined part is the host ID. Binary of the network ID and the host ID goes like this 

Network ID- 11000000.10101000.00000101.x 

Host ID- x.x.x.00010111 

               Before sending out the data, the computer compares the destination IP address and its IP address using a subnet mask to match the 1s in both IP addresses. If there’s 1 in the IP address, the computer knows that the destination IP is local—the network IDs match. It is a long call if the ones on the subnet mask are different (even one bit of the destination IP).  

Now we have all the basic knowledge about subnet masks we need, let’s see how a subnet mask looks in binary. Both IP address and subnet mask contain 32-bit binary numbers. 11111111111111111111111100000000 = 255.255.255.0 

11111111111111110000000000000000= 255.255.0.0 

11111111000000000000000000000000= 255.0.0.0 

   Subnet masks are represented by using a ‘/’ by the people in networking. And we call it a “wack”. A subnet mask is a /24 (wack 24) if it contains 24 ones in it’s binary. I hope you get the idea. 

11111111111111111111111100000000= /24 (24 ones) 

11111111111111110000000000000000= /16 (16 ones) 

11111111000000000000000000000000= /8 (8 ones) 

       If an IP address is followed by the /, the number actually tells you the IP address and the subnet mask in one line. Let us understand this with a few examples: 
201.23.45.123/24, here 201.23.45.123 is the IP address with a 255.255.255.0 subnet mask. 

Similarly, 184.222.4.36/16 is an IP address of 184.222.4.36 with a wack 16 subnet mask i.e. 255.255.0.0.  

    IP address and subnet mask are entered by the network administrators when setting up their systems for the first time. 

 

I appreciate you for taking the time to read my blog. I’ll be writing more about the subnet mask soon, and I will post that in a few days. I hope my blog helped you understand subnet masks better. 

Share and follow this page for more content. Let me know about my blog in the comments below. Cheers <3

                                                 -Durga Kamal Prasanth Konda.  

     

 

 

 

 

Post a Comment

1 Comments