Subnet Mask

    32-bit value in dotted-decimal notation that separates the network portion from the host portion of an IPv4 address.

    A subnet mask is a 32-bit value in dotted-decimal notation (for example 255.255.255.0) that separates the network portion from the host portion of an IPv4 address. The 1-bits in the mask mark the network and the 0-bits mark the host — 255.255.255.0 is therefore 24 ones followed by 8 zeros in binary form.

    In practice the subnet mask is used together with the IP address to decide whether a destination lies in the same subnet or must be forwarded via a gateway. A binary AND between the address and the mask yields the network address.

    A subnet mask carries exactly the same information as a prefix length in CIDR notation, just expressed in a different way. Examples: 255.255.255.0 = /24, 255.255.0.0 = /16, 255.255.255.252 = /30, 255.0.0.0 = /8.

    The difference between the concepts is format and scope: a subnet mask is an IPv4-specific dotted-decimal form, a prefix is just the number and also works for IPv6, and CIDR is the overarching network/prefix notation system. Modern configuration usually uses CIDR notation, while subnet masks still appear in legacy tools and operating-system dialogs.

    Points clés

    • 32-bit value in dotted-decimal form, IPv4 only
    • 1-bits = network portion, 0-bits = host portion
    • Bitwise AND with the address yields the network address
    • 255.255.255.0 = /24, 255.255.0.0 = /16, 255.255.255.252 = /30
    • Same information as a CIDR prefix, different format
    • Subnet mask = dotted-decimal; prefix = number; CIDR = network/prefix

    Termes associés

    Outils associés