Hello Pavan
Sure, let’s take a look. Here is the list of subnets once again:
172.1.4.0/25
172.1.128.0/25
172.1.5.0/24
172.1.6.0/24
172.1.7.0/24
The first thing you’ll notice is the 172.1.128.0/25 subnet. The third octet is numerically “far away” compared to the others. You can see this more clearly if we look at the addresses in binary:
10101100.00000001.
00000100.00000000
10101100.00000001.
10000000.00000000
10101100.00000001.
00000101.00000000
10101100.00000001.
00000110.00000000
10101100.00000001.
00000111.00000000
Notice that all the non-bold bits are the same for all addresses. The first bit (from left to right) that differs between all of the values is the 17th bit, and that takes place in the 172.1.128.0 address.
So if we want to summarize all of these, we must use a /16 subnet, because only the first 16 bits are the same. So, the summarization in binary would be:
10101100.00000001.00000000.00000000
with a subnet mask of 11111111.11111111.00000000.00000000
In dotted decimal, that would be 172.1.0.0/16
However, this summarization would include many more subnets than just these five. Specifically, this summarization includes the range from 172.1.0.0 to 172.1.255.255. Such a large range may include subnets that exist elsewhere. It is for this reason that it is best practice to summarize into two different subnets, one including only the 172.1.128.0/25 network, and another including the rest. Here are the binary addresses once again, but without the 172.1.128.0/25 network:
10101100.00000001.000001
00.00000000
10101100.00000001.000001
01.00000000
10101100.00000001.000001
10.00000000
10101100.00000001.000001
11.00000000
This time you can see that the 22 leftmost bits are the same, and there are differences only from the 23rd bit. For this reason, we can summarize these like so:
10101100.00000001.00000100.00000000
with a subnet mask of 11111111.11111111.11111100.00000000
Or in decimal, 172.1.4.0/22 which is what Rene came up with in his post.
So ultimately, the summary of the original question would come down to two summarizations:
172.1.4.0/22 and 172.1.128.0/25. This would be the most efficient result.
I hope this has been helpful!
Laz