# How can one come up with reasonable IP subnet allocations?

An ISP has following chunk of CIDR-based IP addresses available with it: 245.248.128.0/20
The ISP wants to give half of this chunk addresses to Organization A, and a quarter to Organization B, while retaining the remaining with itself. Which of the following is a valid allocation of addresses to A and B?

A) 245.248.136.0/21 and 245.248.128.0/22
B) 245.248.128.0/21 and 245.248.128.0/22
C) 245.248.132.0/21 and 245.248.132.0/21
D) 245.248.136.0/24 and 245.248.132.0/21

It is easy to make out that option 'C' and 'D' are wrong. Option 'B' is not possible due to address overlapping. The answer is 'A' for sure, but I'm unable to understand how. How is 245.248.136.0/21 and 245.248.128.0/22 calculated? I've been trying to solve this the whole day but found no solution to it, any help on how to solve this problem would be appreciated.

Also, how can I determine the range of addresses that can be allocated to organizations A and B?

• Let me just note that this is borderline for a cs.stackexchange question, as it is more about the specifics of CIDR than science in the abstract. In the future these questions may be more suited to stackoverflow or networkengineering.stackexchange – cody Jul 30 '14 at 0:05
• @cody I agree about being borderline for Computer Science SE. However, this has nothing to do with programming so it is absolutely off-topic for Stack Overflow. – David Richerby Jul 30 '14 at 0:06
• @cody, cs.stackexchange wasn't my first preference anyway, I posted this question at networkengineering.stackexchange, there the users voted it as off-topic, where am I supposed to go? – Siddharth Thevaril Jul 30 '14 at 5:03
• @Sidsec9 I hear you, but "there is no SE site for my question" is not a good reason to post it at one. That said, I know that the specifics of these things are taught at universities, and this is a question about a principle (even though it's probably a homework exercise almost-dump) so I see no reason to close it outright myself. ThHe community may decide differently. (Also note that reverting formatting-improving edits won't make you friends on any SE site.) – Raphael Jul 30 '14 at 6:56

Hints:

• Try working out the binary representation of 245.248.136.0 (it's 32 bits) and of 245.248.128.0.

• Re-read what the /21 and /22 notation means and how CIDR works.

• What is the range of IP addresses included in 245.248.128.0/22? in 245.248.136.0/21?

I think once you understand the concepts you'll find that this question is straightforward.