Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I found this problem in a textbook, and I do not understand the solution:

Find the subnet which the IP: 192.168.1.25 belongs to.
Here is what they did:

  1. 255.255.255.224 for 192.168.1.25 and do a binary AND operation.
  2. Then take the subnet mask because of postfix /27 CIDR postfix in the IP.

But why? In the problem definition, the number /27 was not given. How did they come up with that?

share|improve this question
2  
Must be a misprint then. The CIDR postfix indicates the mask bits, e.g. 192.168.1.25/27 means 27 mask bits; this corresponds to the subnet mask 255.255.255.224. –  John Willemse May 3 '13 at 14:55
add comment

migrated from stackoverflow.com May 4 '13 at 8:20

This question came from our site for professional and enthusiast programmers.

1 Answer

up vote 3 down vote accepted

They know that the the /27 CIDR is 27 as they used the subnet mask of 255.255.255.224. The CIDR is the number of available IP's since 255.255.255.255-255.255.255.224 is 31. This is a number range 0-31 or a range of 32 possible values. This corresponds to 2^5. So therefore 2^32 - 2^5 = 2^27 with 27 being your CIDR.

share|improve this answer
    
To look at it another way an IPV4 address is made up of 4 bytes = 8 x 4 bits = 32 bits. A /27 means the left most 27 bits are 1 (or if you prefer 32-27=5 0 bits on the right), so in binary it would look like 11111111.11111111.1110000 which converts in decimal to 255.255.255.224 –  davidgo May 4 '13 at 8:31
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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