• A prefix leaves n host bits, and 2ⁿ − 2 addresses are usable.

    The Formula on a /24

    Take the network 198.51.100.0/24.

    IPv4 /24 subnet mask with binary notation, network and host bits, and usable address calculation.

    Figure 1 – Calculating usable addresses with a /24 subnet mask.

    The prefix length is /24.
    So:

    • n = 32 − 24 = 8 host bits

    • 2⁸ − 2 = 254 usable hosts

    Answer the question below

    How many usable hosts are in a /24 network?

    One Bit Less, Half the Hosts

    Each time the prefix grows by one, you give one bit to the network and take it from the hosts.
    The addresses are divided by two, and the usable hosts are that number minus 2.

    Prefix

    Subnet mask

    Host bits

    Addresses

    Usable hosts

    /24

    255.255.255.0

    8

    256

    254

    /25

    255.255.255.128

    7

    128

    126

    /26

    255.255.255.192

    6

    64

    62

    /27

    255.255.255.224

    5

    32

    30

    /28

    255.255.255.240

    4

    16

    14

    /29

    255.255.255.248

    3

    8

    6

    Table 1 – Addresses and usable hosts from /24 to /29.

    Read the table from the hosts you need, not from the prefix.
    Thirty devices fit in a /27, thirty-one do not: the first prefix with enough usable hosts is the one you pick.

    Answer the question below

    How many usable hosts are in a /27 network?

    Answer the question below

    Which prefix is the smallest subnet that fits 100 hosts?

    Answer the question below

    Table 1 begins at /24, but the formula 2ⁿ − 2 keeps working for larger networks. How many usable hosts does a /22 network give? Answer with digits only.

    Answer the question below

    A VLAN must hold 255 hosts. Following the rule above (the first prefix with enough usable hosts), which prefix do you pick? Answer in the same format as Table 1, for example /26.