taap.digitalnetwork engineering toolkit

What is the wildcard mask for a /27?

Answer
0.0.0.31 wildcard for /27 (255.255.255.224)

A /27 has the subnet mask 255.255.255.224. Subtract it from 255.255.255.255 and you get the wildcard 0.0.0.31: the last 5 bits are "don't care", so it matches 32 consecutive addresses.

wildcard · adjust the values
Telecom pole with many wires against the sky
Telecom pole with many wires against the sky. Photo: T / Unsplash

The calculation

255.255.255.255 − 255.255.255.224 = 0.0.0.31

A /27 block is typically a 30-host segment such as a management or printer VLAN. With the network 10.0.0.0, the wildcard 0.0.0.31 matches 10.0.0.0 through 10.0.0.31.

Using it in Cisco IOS

! standard ACL
access-list 10 permit 10.0.0.0 0.0.0.31

! named extended ACL
ip access-list extended FROM-SITE
 permit ip 10.0.0.0 0.0.0.31 any

! OSPF
router ospf 1
 network 10.0.0.0 0.0.0.31 area 0

Junos, Arista EOS, MikroTik and Linux use the prefix form instead: 10.0.0.0/27.

Nearby prefixes

PrefixSubnet maskWildcardAddresses
/25255.255.255.1280.0.0.127128
/26255.255.255.1920.0.0.6364
/27255.255.255.2240.0.0.3132
/28255.255.255.2400.0.0.1516
/29255.255.255.2480.0.0.78

Step by step

  1. /27 mask: 255.255.255.224.
  2. In octet 4, the mask is 224 = 11100000 in binary.
  3. Flipping the bits: 11100000 → 00011111 = 31.
  4. Final wildcard: 0.0.0.31, leaving the 5 host bits free.

Blocks matched from 10.0.0.0

BlockFirst addressLast address
110.0.0.010.0.0.31
210.0.0.3210.0.0.63
310.0.0.6410.0.0.95

In practice

A permit 10.0.0.0 0.0.0.31 line covers 10.0.0.0 to 10.0.0.31. The next block starts at 10.0.0.32: if the range you need goes past that, use a larger wildcard or a second line. To cover twice as much, use the /26 wildcard (0.0.0.63); for half, the /28 wildcard (0.0.0.15).

To try other values, open the Wildcard mask calculator with these numbers already filled in.

More questions like this

Frequently asked questions

How many addresses does 0.0.0.31 match?

32. The wildcard has 5 one-bits, and 25 = 32.

Is 0.0.0.31 the same as 255.255.255.224?

No. 255.255.255.224 is the subnet mask; 0.0.0.31 is its bitwise inverse. Putting the subnet mask where IOS expects a wildcard matches the wrong addresses.