Wildcard Mask Cheat Sheet
Prefix → wildcard
| CIDR | Subnet mask | Wildcard |
|---|---|---|
| /16 | 255.255.0.0 | 0.0.255.255 |
| /17 | 255.255.128.0 | 0.0.127.255 |
| /18 | 255.255.192.0 | 0.0.63.255 |
| /19 | 255.255.224.0 | 0.0.31.255 |
| /20 | 255.255.240.0 | 0.0.15.255 |
| /21 | 255.255.248.0 | 0.0.7.255 |
| /22 | 255.255.252.0 | 0.0.3.255 |
| /23 | 255.255.254.0 | 0.0.1.255 |
| /24 | 255.255.255.0 | 0.0.0.255 |
| /25 | 255.255.255.128 | 0.0.0.127 |
| /26 | 255.255.255.192 | 0.0.0.63 |
| /27 | 255.255.255.224 | 0.0.0.31 |
| /28 | 255.255.255.240 | 0.0.0.15 |
| /29 | 255.255.255.248 | 0.0.0.7 |
| /30 | 255.255.255.252 | 0.0.0.3 |
| /31 | 255.255.255.254 | 0.0.0.1 |
| /32 | 255.255.255.255 | 0.0.0.0 |
255.255.248.0 → 0.0.7.255
(or: block size − 1)
Worked example
Permit 10.1.8.0/21 in an ACL:
1/21 → mask 255.255.248.0
2255 − 248 = 7 · 255 − 0 = 255
3wildcard 0.0.7.255
permit ip 10.1.8.0 0.0.7.255 any
matches 10.1.8.0 → 10.1.15.255
Shortcuts
host 10.0.0.5 = 10.0.0.5 0.0.0.0
any = 0.0.0.0 255.255.255.255
/30 link = x.x.x.x 0.0.0.3
OSPF
router ospf 1
network 10.0.12.0 0.0.0.255 area 0
wildcard here too, not the mask!
(non-contiguous: ACLs only)