1
i'm looking for a smart and short way to calculate summary routes. (CIDR, route summarization)
I'm common with the subject matter of summarization, supernets, VLSM, CIDR etc.
but I don't always want to convert all the IP addresses into binary format to get the result.
Im looking for a smart way to save valuable time.
Main question at example 3
Example1:
Lets say we have these two IP addresses:
- 172.16.64.0/23
- 172.16.66.0/23
I can immediately see that the summary route will be 172.16.64.0/22.
I see that i'm using 2 subnets -> it's 1 bit -> I subtract 1 bit from the /23 = /22
In Binary format:
172.16.64.0 - - -> 10101100.00010000.01000000.00000000
172.16.66.0 - - -> 10101100.00010000.01000010.00000000
22 left-most matching bits = /22
When AND-ing these IP addresses the result is
172.16.64.0 - - -> 10101100.00010000.01000000.00000000
Voila it's working without converting :)
Example2:
- 192.168.4.192/29
- 192.168.4.200/29
- 192.168.4.208/29
- 192.168.4.216/29
A brief look on these IPs, i see 4 subnets, which are 2 bits.(subtract 2 from /29)
So my guess is 192.168.4.192/27
192.168.4.192 - - -> 10000000.10101000.00000100.11000000
192.168.4.200 - - -> 10000000.10101000.00000100.11001000
192.168.4.208 - - -> 10000000.10101000.00000100.11010000
192.168.4.216 - - -> 10000000.10101000.00000100.11011000
27 left-most matching bits = /27
When AND-ing these IP addresses the result is :
192.168.4.192 - - -> 10000000.10101000.00000100.11000000
Voila, we've got 192.168.4.192/27. So seems it's working.
Example3:
(BUT) What if we have odd numbers and differents subnetmasks (like in the example below)
How can I immediately get the route summary? (without converting to binary?)
- 192.168.6.000/27 (10000000.10101000.00000110.00000000)
- 192.168.6.064/27 (10000000.10101000.00000110.01000000)
- 192.168.6.128/26 (10000000.10101000.00000110.10000000)
- 192.168.6.160/26 (10000000.10101000.00000110.10100000)
- 192.168.6.192/28 (10000000.10101000.00000110.11000000)
- 192.168.6.208/28 (10000000.10101000.00000110.11010000)
- 192.168.6.224/30 (10000000.10101000.00000110.11100000)
- 192.168.6.228/30 (10000000.10101000.00000110.11100100)
- 192.168.6.232/30 (10000000.10101000.00000110.11101000)
once it is converted it is easy to see, that it's 24 left-most matching bits = /24
But is there a way to skip the converting an find out the summary route immediately, just from the IPs+masks?
Example4: This example is a little bit mean, because it dissents my idea of example 1:
- 192.168.1.0/24 - 11000000.10101000.00000001.00000000
- 192.168.2.0/24 - 11000000.10101000.00000010.00000000
The result is 192.168.0.0/22
However, I could not explain why especially this is not working anymore.
I hope this forum has some smart people who can help me find a working solution. :)
Thanks in advance