Click here to Skip to main content
15,881,588 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi, I have following issue in calculating the number of available subnets (or hosts) in network.
For example the main subnet is /24 (255.255.255.0) which contains two /25 (255.255.255.128) or four /26 (255.255.255.192).

So if the one node is already being used there will be only one /25 or only 3 times /26. Then how should I calculate the number of available subnets. In other words how to get the number and type of remainders. I want to perform this algorithm in PHP.

please click the following link to image.

Kindly ask you to give me any hint.
Posted

1 solution

 
Share this answer
 
v2
Comments
Member 10947632 15-Jul-14 16:18pm    
@MehdiGholam thank you for you links. I checked them, the tutorials that you posted, describing how to calculate the total number of of hosts per subnet and how to split them into small groups.
I know how to calculate subnets, in my case I need to define the number of remaining nodes in a tree after a certain node has been deleted.
For example, the root is based on mask /24(255.255.255.0) which has a two nodes with mask /25(255.255.255.128) and that nodes have smaller nodes with a masks /26 (255.255.255.192) and so on.
When one of the nodes is reoved from a tree then how to calculate the number of remaining nodes?

Please check a following image.

http://screencast.com/t/qisbbKTt1xm[^]

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900