taap.digitalnetwork engineering toolkit

What is the wildcard mask for a /21?

Answer
0.0.7.255 wildcard for /21 (255.255.248.0)

A /21 has the subnet mask 255.255.248.0. Subtract it from 255.255.255.255 and you get the wildcard 0.0.7.255: the last 11 bits are "don't care", so it matches 2,048 consecutive addresses.

wildcard · adjust the values

The calculation

255.255.255.255 − 255.255.248.0 = 0.0.7.255

A /21 block is typically a group of eight /24s, a typical aggregate for a medium branch. With the network 10.0.0.0, the wildcard 0.0.7.255 matches 10.0.0.0 through 10.0.7.255.

Using it in Cisco IOS

! standard ACL
access-list 10 permit 10.0.0.0 0.0.7.255

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

! OSPF
router ospf 1
 network 10.0.0.0 0.0.7.255 area 0

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

Nearby prefixes

PrefixSubnet maskWildcardAddresses
/19255.255.224.00.0.31.2558,192
/20255.255.240.00.0.15.2554,096
/21255.255.248.00.0.7.2552,048
/22255.255.252.00.0.3.2551,024
/23255.255.254.00.0.1.255512

More questions like this

Frequently asked questions

How many addresses does 0.0.7.255 match?

2,048. The wildcard has 11 one-bits, and 211 = 2,048.

Is 0.0.7.255 the same as 255.255.248.0?

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