Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

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

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

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
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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .