Answer the question
In order to leave comments, you need to log in
How to correctly calculate the number of subnets?
It always seemed to me that, for example, on the network: 192.168.0.0/25 (255.255.255.128) there are two subnets - 192.168.0.0 and 192.168.0.128, but I'm testing on one well-known site and it gives me completely different values - 512 subnets in the above example, well, or see another example in the picture:
Apparently I don’t understand something in networks, so I want to understand it, otherwise I’m completely confused now :(
Answer the question
In order to leave comments, you need to log in
This is because the question is poorly written.
In fact, you are being asked how many subnets with the specified mask can be on a network with a class to be determined from the address.
That is, 192.168.0.0 is class C, range 192.168.0.0-192.168.255.255.
Therefore, 16 bits can be changed, of which 7 are cut off by the /27 mask.
There are 9 bits left, which gives 2 9 = 512 subnets.
But, in general, the question is outdated, since categorization was abandoned in 1993 and classless CIDR addressing is used.
For example in the picture:
number of hosts (mask with /28 prefix) = 14: 32-28 = 4; 2^4 = 16-2(1 network address and 1 broadcast address) = 14 hosts per subnet.
Number of subnets: 16-4=12; 2^12 = 4096.
In case of 192.168.0.0/25: 32-25=7; 2^7=128 hosts, but actually 126 hosts per subnet. -1 for the network address and -1 for the broadcast address. Subnets: 16-7=9; 2^9=512 subnets.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question