IP fundamentals

Wildcard mask vs subnet mask

A contiguous mask and its inverse wildcard describe fixed and variable bits differently.

Updated

Invert the bits

For a /24 mask 255.255.255.0, subtract each octet from 255 to obtain 0.0.0.255. A /27 mask of 255.255.255.224 becomes 0.0.0.31.

Why terminology matters

Many network rule syntaxes use wildcard bits to indicate which bits are ignored during a match. Some permit non-contiguous wildcards. That does not make every wildcard a valid CIDR mask.

Check the product syntax

A prefix, wildcard and ACL rule are not interchangeable commands. In a managed router, inspect the vendor documentation before changing access rules; a reversed mask can expose or block more traffic than intended.

Compare a rule with a subnet

A /26 network uses 255.255.255.192. Its inverse wildcard is 0.0.0.63, which ignores the last six address bits in a conventional wildcard matching rule. This does not grant connectivity by itself: rule order, protocol and direction still determine what a particular access policy permits.

Step-by-step example

Compare a CIDR-derived wildcard with a normal network mask.

  1. 01

    Choose a network

    Use 192.0.2.32/27. Its fixed bits are the network prefix; the last five bits vary inside the block.

    Network
    192.0.2.32/27
    Address count
    32
    Illustration · example, not a live result
  2. 02

    Invert the mask

    Subtract each subnet-mask octet from 255. The last octet is 255 − 224 = 31; the first three are zero.

    Mask
    255.255.255.224
    Wildcard
    0.0.0.31
    Illustration · example, not a live result
  3. 03

    Read the matching range

    The zero bits of this wildcard mean compare the corresponding address bits; ones mean ignore them in the illustrative wildcard match. The range is .32 through .63. Device-specific ACL wildcard syntax can permit non-contiguous patterns, unlike CIDR.

    First match
    192.0.2.32
    Last match
    192.0.2.63
    Outside
    192.0.2.64
    Illustration · example, not a live result

Check your understanding

A wildcard describes matching, not an interface's configured subnet mask.

Try this tool →

Try this

Calculate /27 in the converter; confirm the last octet changes from 224 to 31.

IPv4 netmask converter →

Technical references