0

I have a problem in understanding the network address when calculating it from an IPv4 address and the subnet mask.

IP Address:       192.168.10.131  | 11000000.10101000.00001010.10000011    

Subnet Mask:      255.255.255.192 | 11111111.11111111.11111111.11000000  

Network Address:  192.168.10.128  | 11000000.10101000.00001010.10000000  

Theoretically, we know that all 1s in the subnet mask identify the network portion while 0s identify the host portion, but here I can guess that the network address is 192.168.10 portion ( all 1s) but WHY 131 is NOT included in the network portion as it also has 1s in it.

If the subnet mask was 255.255.255.0 | 11111111.11111111.11111111.00000000then it would be straightforward because there is no 1s in the last octet so it would have been classified as a host portion, but in the above subnet mask, it is confusing as it has 1 in the last octet as well. Please help. Thanks a lot!

0

1 Answer 1

2

WHY 131 is NOT included in the network portion as it also has 1s in it.

The first two bits of the fourth octet in the "IP Address" (highlighted with * below) are included in the network portion. This is because the first two bits of the fourth octet in the "Subnet Mask" (highlighted with ! below) dictates this.

                                                               **
IP Address:       192.168.10.131  | 11000000.10101000.00001010.10000011    

                                                               !!
Subnet Mask:      255.255.255.192 | 11111111.11111111.11111111.11000000  

In other words, the subnet mask determines how many bits are network bits. Because the subnet mask takes the two most significant bits from the fourth octet (128 + 64), we get a subnet mask with its fourth octet set to 192.

As the host address uses the two least significant bits (1 + 2), we get 3. When that 3 is added to the last octet of the network address (128 + 3), we get 131.

By the way, in case you're interested I've written quite a few blog posts on subnetting.

EDITING to respond to your comment - "You basically told me how to calculate subnet mask (128 + 64) = 192, but the question was why 131 is a host address?"

The host address is found simply by adding the host bits to the subnet bits when the two are in the same octet.

Let's take another look at the example you gave:

                                                                 HHHHHH
IP Address:       192.168.10.131  | 11000000.10101000.00001010.10000011    
                                                               SS
Subnet Mask:      255.255.255.192 | 11111111.11111111.11111111.11000000  
                                                               NN
Network Address:  192.168.10.128  | 11000000.10101000.00001010.10000000  
  • The 'S' bits represent bits which have been 'reserved' as Subnet mask bits.
  • The 'N' bits represent the Network address bits.
  • The 'H' bits represent the Host bits.

Notice how the "IP Address" section's first two bits are identical to the "Network Address'" first two bits. This is how we know that the Host address resides in that Network.

To find the host's IP address we add all of the Host bits together - 128 + 2 + 1 = 131.

As mentioned above, I have explained this in great detail on my blog. This post is most relevant to your question.

6
  • Don't be sorry for asking a question, and don't worry, your question isn't silly. As you pointed out, the binary in the fourth octet of the subnet mask is 1100 0000. The most significant bit (the bit furthest to the left) is 128. The second most significant bit (the second bit from the left) is 64. When you add these two together, you get 192.
    – OzNetNerd
    Commented Sep 26, 2016 at 5:43
  • So how can we say 131 is a host address when you also said it has 1s included?
    – Anonymous
    Commented Sep 26, 2016 at 5:46
  • You basically told me how to calculate subnet mask (128 + 64) = 192, but the question was why 131 is a host address? Much appreciated!
    – Anonymous
    Commented Sep 26, 2016 at 5:50
  • Please see my answer above. I have edited it to include more information.
    – OzNetNerd
    Commented Sep 26, 2016 at 6:02
  • This has almost cleared to me. All credits to you brother. I have bookmarked your wonderful website page. Thanks a lot for your precious time ;)
    – Anonymous
    Commented Sep 26, 2016 at 6:13

Not the answer you're looking for? Browse other questions tagged or ask your own question.