Calculation of the number of hosts per subnet in Class B network
If a class B network on the Internet has a subnet mask of 255.255.248.0, what is the maximum number of h开发者_C百科osts per subnet? (A) 1022 (B) 1023 (C) 2046 (D) 2047
Can anybody pls tell me the logic of how this problem can be solved?
11111111 11111111 11111000 00000000
is binary representation of 255.255.248.0.
So the formula is the remaining zero is:
The power of 2
minus 2
=maximum number of host per subnet
Our case: 2^11-2=2046
I think a picture of the mask would help... given your example, the bits for the mask 255.255.248.0 would be:
11111111 11111111 11111000 00000000
Which would leave 11 bits for host addressing, hence 2 ^ 11, or 2048. That said, I was unaware until I read a little more on wikipedia that the usage of the zero subnet or all-ones subnet was discouraged initially. So the answer will depend on whether you are reserving those addresses or not.
Taking into account the knowledge of subnetting, the bits for the mask would be
11111111 11111111 11111000 00000000
and on the question of maximum number of hosts then one must subtract the network ID from the local Broadcast address.
Using the formula (2^11)-2
then we shall get 2046
to be the maximum number of hosts.
It's two raised to the power of the number of bits that are clear in the subnet mask. (Each bit in the subnet mask can be zero in a host or one in a host.)
精彩评论