formulas for host and subnets:
Number of Subnets = 2^x
where x= number of bits robbed (network bits) from the octect that is being subnetted
Hosts = (2^y)-2
where y=number of remaining bits (host bits) in the octect that is being subnetted.
Your subnetting the 3rd octect and the normal class boundry is at 24. So you robbed 2 bits (26 - 24) for subnets so x=2. That leaves 6 bits for hosts (8 bits per octect, 2 bits robbed, 8-6 = ) so y =6.
Subnets = 2^2 = 4
Hosts per subnets = (2^6)-2 = 62
The other method is to visualize the octect. Each octect is 8 bits but each bit represents a decimal value, just like the way you calculate the decimal equivalant of a /28 to .240.
Bits: 8 7 6 5 4 3 2 1
Value: 128 64 32 16 8 4 2 1
The subnets formula is the same but if you know you have 5 bits for hosts then just look at the value under byte 5 (16 from above) then just subtract 2 and you get the hosts per subnet. 14. (You subtract two because you have to account for the network address, all zeros, and the broadcast address, all ones, for every subnet.
Please rate if helpful
Just to follow up a little, you don't actually need to base your calculations on the classful boundaries.. Say you have a /21. That is one subnets with 11 bits for hosts (2^11 = 2048 - 2 = 2046 usable hosts.) Now if you subnet that into /28 blocks 28-21 = 7 so you can create (2^7 =) 128 subnets, (32 bits total - 28 used, leaves 4 bits for hosts)(2^4= 16 -2= 14)with 14 hosts each. Also note that 16 * 128 = 2048.
Thank you for your reply. My apology for not clearing my question. What I want to know is how to compute route summarization the fastest and easiest way rather than turning its binary equivalent values. I dont have problems actually with regards to how many hosts/subnets in a given block/s of ip. I'm just asking is there a the same approach for knowing the route summary? Thanks.
Here's a method to find inclusive summary routes, in decimal, but I'd still recommend binary.
Smallest component subnet: 220.127.116.11/24
Largest component subnet: 18.104.22.168/24
Total number of component subnets = 4
1)First find such A that 2^A >= total number of component subnets. In this 2^2=4, A =2
2)Use the longest prefix length present in any component subnets, its 24
3)Subtract the longest prefix length from A, to find the prefix length Z, Z = 24-A = 22
4)Think of the smallest component subnet as an IP address and try to find its subnet with prefix length Z, calculated in step 3. Here its 22.214.171.124 with /22, which gives 126.96.36.199/22
5)Think of the largest component subnet as an IP address and try to find its subnet with prefix length Z. Here its is 188.8.131.52, with /22, which gives 184.108.40.206/22. Since the resulting subnet is same as the previous step, this is your best summarized route.
6)If steps 4 and 5 do not give the same subnet, repeat steps 4 and 5 with prefix length minus 1 ( Z-1).