Hello Shivam
Rene in his post, is using the following example.
172.16.10.0/24
172.16.20.0/24
172.16.30.0/24
172.16.40.0/24
172.16.50.0/24
So how do we summarize this? When the IP addresses are in binary form, we find all the bits, starting from left to right, that are the same in all addresses. As soon as we see a bit that is different, that’s where we stop. So let’s transform all five addresses into binary:
172.16.10.0 = 101011000001000000 00101000000000
172.16.20.0 = 101011000001000000 01010000000000
172.16.30.0 = 101011000001000000 01111000000000
172.16.40.0 = 101011000001000000 10100000000000
172.16.50.0 = 101011000001000000 11001000000000
Scanning from left to right, we find all the bits that are the same. I put a space in where the bits become different. So how many bits are the same? 18 bits. Now in order to find the summary address, we take the bits that are the same (18 bits) as they are, and then make all the rest of the bits equal to 0. So we get:
10101100000100000000000000000000
where the bold bits are those that stay the same. Converting back to decimal dot format we get a summary of the following, and don’t forget the 18 bit prefix!
172.16.0.0/18
Now here, Rene is suggesting an easier and faster way of determining the summary. Take a look at the list of networks again:
172.16.10.0/24
172.16.20.0/24
172.16.30.0/24
172.16.40.0/24
172.16.50.0/24
Now take a look at the list of of networks that Rene is listing, with a steadily decreasing prefix:
172.16.0.0 /24 = 1 network
172.16.0.0 /23 = 2 networks
172.16.0.0 /22 = 4 networks
172.16.0.0 /21 = 8 networks
172.16.0.0 /20 = 16 networks
172.16.0.0 /19 = 32 networks
172.16.0.0 /18 = 64 networks
As you make the prefix smaller, the number of /24 networks within that summary increases. For example, 172.16.0.0/23 can contain two /24 networks: 172.16.0.0/24 and 172.16.1.0/24. This is because 172.16.0.0/23 defines a range from 172.16.0.0 to 172.16.1.255, which contains those two networks.
Similarly, 172.16.0.0/21 refers to the range of IP addresses between 172.16.0.0 and 172.16.7.255, which contains eight /24 networks (172.16.0.0./24, 172.16.1.0./24, 172.16.2.0./24, 172.16.3.0./24 … 172.16.7.0./24).
So Rene keeps decreasing the size of the prefix, to increase the number of /24 networks that can fit. These are doubled each time. He keeps going until all of the networks in the list (172.16.10.0/24, 172.16.20.0/24, 172.16.30.0/24,172.16.40.0/24,172.16.50.0/24) are included.
For example, if he used 172.16.0.0/19, it would give us 32 /24 networks. Does that include all of the networks in our list? No, it doesn’t include 172.16.50.0/24. So he had to go one higher, which does include it.
I hope this has been helpful!
Laz