cancel
Community Member

## Subnetting. How to calculate hosts and subnets if /P < N

Hi,

I have stuck with formula how to calculate hosts and subnets.

For instance, I use formulas:

Host = (2^(32-P))-2, where 32 are all bits for network, /P - is prefix

Subnets = 2^(/P-N), where /P is prefix and N - is network part of class A,B or C

if I have mask 255.255.255.128(/P=25) and IP 192.10.1.0, there will be 126 hosts and 2 subnets

hosts = (2^(32-25)-2)=126

and subnets= 2^(25-24)=2, N=24 as it is class C

So if I have address 192.10.1.0 and mask 255.240.0.0, /P=12 and N = 24

hosts = (2^(32-12))-2=1048574

subnets = 2^(12-24)  or for this variant I should use formula 2^P to calculate subnets ????

Everyone's tags (1)
Gold

## If you're using classful

If you're using classful networks, your last example is illegal because it creates a supernet. 192.168.10.0 is a class C network and can only be subnetted with masks greater than 24 bits. If you were doing this with a class B network like 172.16.10.0, then your formula would work: 2^(16-12)=16.

Classful networks aren't often seen these days, so running with a formula of 2^(P-N) still makes sense, but N should be the mask length of your assigned CIDR block rather than that of a fixed class-based mask.

115
Views
5