Skip to content
Discussion options

You must be logged in to vote

Short version: the calculators reporting 0 are applying a rule that has an explicit exception, and netprobe implements the exception.

Where "subtract 2" comes from

In a normal IPv4 subnet, two addresses are not assignable to a host:

  • the network address (all host bits 0)
  • the broadcast address (all host bits 1)

So usable = 2^host_bits - 2. For a /24 that is 256 - 2 = 254, which is right.

Why it breaks at /31

A /31 has exactly two addresses. Apply the rule blindly and you get 2 - 2 = 0 - a subnet that cannot hold anything, which would make the prefix useless. That was in fact the situation until RFC 3021 (December 2000), which defines /31 for point-to-point links:

... the /31 addressing s…

Replies: 1 comment

Comment options

saeed205
Aug 19, 2026
Maintainer Author

You must be logged in to vote
0 replies
Answer selected by saeed205
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant