Doubt Regarding IP addressing

Started by Jack, August 09, 2022, 04:46:14 AM

Previous topic - Next topic

Jack

I was going through some previous years GATE questions on networking, I stumbled across a question where I am trying to figure out the correct option since I am not able to come to conclusion. The approach that I am using  to determine the options left me with option (A) and (B), however the correct option is (A).
The question is described below,

An Internet Service Provider(ISP) has the following chunk of CIDR-based IP addresses available with it: 245.248.128.0/20. The ISP wants to give half of this chunk of 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/22 and 245.248.132.0/21
(D) 245.248.136.0/22 and 245.248.132.0/21 

>>>> The approach that I followed is this:

[Solution] >>>>>>>>>>

We have the following data available:
          CIDR-based IP address = [245.248.128.0/20]
          Network Bits = 20   &&    Host Bits = 12
           
Lets perform our calculations-
             Total no of hosts = 2^remaining host bits = 2^12 = 4096-2 = 4094

1) Now according to question, ISP has to give exactly half of the total hosts addresses to Organization_A, so,
               [Half addresses = Total Hosts/2 = 4094/2 = 2047]
           
In-order to allocate 2047 addresses to Organization_A we must have 11 host bits available to us, in other words,
                 [2^11 = 2048  && Subnet Bits will be = /21]
                                                                                     
This means we want the 21st bit in 3rd octet to be available to us, lets do binary math,
                 245.248.128.0 = 245.248.10000000.0           [breaking down 3rd octet in binary]
           
So, 21st bit position in 3rd octet can be filled in 2 ways, either 0 or 1-
           
            Original Address Binary -  245.248.1000 0 000.0      /20
            Setting 21st Bit to 0   -     245.248.1000 0 000.0      /21
            Setting 21st Bit to 1   -     245.248.1000 1 000.0      /21
             
Thus, we can say that the ISP has 2 ways to allot addresses to Organization_A, one by setting the 21st bit to "0" and second by setting the 21st bit to "1", hence we have the following,
               [245.248.128.0/21] ----> when 21st bit is 0 [OFF]
                [245.248.136.0/21] ----> when 21st bit is 1 [ON]


2) Lets talk about the Organization_B. As per the question ISP has to assign a Quarter of  the total host addresses to Organization_B, so we have-

            Total Host addresses available = 4094
            Quarter no of host addresses = 4094/4 = 1023.5 = 1024 (round off)

Now to allocate 1024 addresses to Organization_B we must have 10 host bits available to us, in other words,
            [2^10 = 2048  && Subnet Bits will be = /22]

This means we want the 22nd bit in 3rd octet to be available to us, So, 21st bit position in 3rd octet can be filled in 2 ways, either 0 or 1, lets check the previous
binary math that we calculated,

            Original Address Binary -  245.248.1000 0 000.0      /20
            Setting 21st Bit to 0   -     245.248.1000 0 000.0      /21
            Setting 21st Bit to 1   -     245.248.1000 1 000.0      /21
           
Now we know that 21st bit can be either 0 or 1, so based on that for 22nd bit, we will have 4 possible subcases in which ISP can allot the addresses to Organization_B, lets see,
      
when 21st bit is 0, we have-
            Setting 22nd Bit to 0   -  245.248.1000 0 0 00.0      /22 
            Setting 22nd Bit to 1   -  245.248.1000 0 1 00.0      /22
           
when 21st bit is 1, we have-
            Setting 22nd Bit to 0   -  245.248.1000 1 0 00.0      /22 
            Setting 22nd Bit to 1   -  245.248.1000 1 1 00.0      /22

So we can say that the ISP has 4 ways to allot addresses to Organization_B, by setting 22nd bit to "0" and "1", hence we have the following,
               [245.248.128.0/22] ----> when 21st bit is 0 and 22nd bit is 0
                [245.248.132.0/22] ----> when 21st bit is 0 and 22nd bit is 1
                [245.248.136.0/22] ----> when 21st bit is 1 and 22nd bit is 0
                [245.248.140.0/22] ----> when 21st bit is 1 and 22nd bit is 1

NOTE: Now the question is which of the following ways does the ISP allot the addresses to Organization_A and Organization_B, as we have 2 ways for
          Organization_A & 4 ways for Organization_B.

>> As from the calculation above, options (C) and (D) are quickly eliminated, however I am confused with Options (A) and (B).

>> Why do you think option B is eliminated, please let me know what approach to follow as I am starting to feel a bit lost here ? Also let me know whether the approach that I followed was correct or not ?

deanwebb

Option B is out because the ranges overlap each other. That /22 is included in the first /21.

A /20 is 16 /24 ranges. so A fits the brief by handing out the ranges with 136-143 in the third octet to A, and that's 8 ranges or half 16. The /22 hands out the first 4, 128-131 to B and that leaves 132-135 for the ISP - 4 each, just as the problem statement asks for.
Take a baseball bat and trash all the routers, shout out "IT'S A NETWORK PROBLEM NOW, SUCKERS!" and then peel out of the parking lot in your Ferrari.
"The world could perish if people only worked on things that were easy to handle." -- Vladimir Savchenko
Вопросы есть? Вопросов нет! | BCEB: Belkin Certified Expert Baffler | "Plan B is Plan A with an element of panic." -- John Clarke
Accounting is architecture, remember that!
Air gaps are high-latency Internet connections.