Join our Newsletter — 33% off our NHI Course
Home› Guides› Subnetting and CIDR Cheat Sheet for Defenders: Masks,…
Template Network Security

Subnetting and CIDR Cheat Sheet for Defenders: Masks, Ranges and Quick Maths

PDF for newsletter subscribers · free to read online

← All guides
By NHI Mgmt Group, under the editorial direction of Lalit Choda Updated 27 November 2026 14 min read
On this page

Analysts lose time and make costly mistakes when they cannot tell at a glance how big a CIDR block is, whether an address is private, or whether a firewall rule covers more than intended. This cheat sheet puts the numbers defenders need in one place: every IPv4 prefix from /8 to /32 with its mask and size, the private and special-use ranges from the IANA registries, the common IPv6 prefixes, the reserved addresses in AWS, Azure and Google Cloud subnets, and quick mental maths for reading logs and writing rules. It is written for SOC analysts, detection engineers and cloud security engineers. All arithmetic was checked programmatically, and the special-use ranges were checked against the IANA registries on 26 November 2026.

At a glance

  • Size of a block: an IPv4 /n holds 2(32 minus n) addresses. Each step of one bit doubles or halves it: a /23 is two /24s, a /25 is half a /24.
  • Private ranges (RFC 1918): 10.0.0.0/8, 172.16.0.0/12 (172.16.0.0 to 172.31.255.255) and 192.168.0.0/16. 172.32.0.1 is public.
  • Not private, but not public either: 100.64.0.0/10 shared address space (carrier-grade NAT, RFC 6598), 169.254.0.0/16 link-local (RFC 3927), 127.0.0.0/8 loopback.
  • IPv6 shortcuts: fe80::/10 link-local, fc00::/7 unique local (in practice fd00::/8), ::1/128 loopback, 2001:db8::/32 and 3fff::/20 documentation, ff00::/8 multicast.
  • Cloud subnets lose addresses: AWS and Azure reserve five addresses per IPv4 subnet, Google Cloud reserves four in each primary range.

How to use this template

Print the size table or keep it beside your SIEM. Add your own estate in the fill-in table under "Using CIDR in firewall and detection rules" so that analysts can tell, without a lookup, which ranges are your offices, data centres, VPCs and VPN pools. Review that table whenever networks are added or retired. For the security design behind these ranges, see the Network Segmentation Guide and the IPv6 Security Guide; this page is the quick reference, not the design guide.

CIDR size table

CIDR (RFC 4632, BCP 122) replaced classful addressing with prefixes written as an address, a slash and the number of leading network bits, from /0 to /32. "Usable hosts" assumes a traditional subnet where the network and broadcast addresses are not assigned. A /31 is used for point-to-point links where both addresses are usable (RFC 3021), and a /32 is a single host route.

PrefixSubnet maskWildcard (inverse) maskAddressesUsable hostsRelative to a /24
/8255.0.0.00.255.255.25516,777,21616,777,21465,536 x /24
/9255.128.0.00.127.255.2558,388,6088,388,60632,768 x /24
/10255.192.0.00.63.255.2554,194,3044,194,30216,384 x /24
/11255.224.0.00.31.255.2552,097,1522,097,1508,192 x /24
/12255.240.0.00.15.255.2551,048,5761,048,5744,096 x /24
/13255.248.0.00.7.255.255524,288524,2862,048 x /24
/14255.252.0.00.3.255.255262,144262,1421,024 x /24
/15255.254.0.00.1.255.255131,072131,070512 x /24
/16255.255.0.00.0.255.25565,53665,534256 x /24
/17255.255.128.00.0.127.25532,76832,766128 x /24
/18255.255.192.00.0.63.25516,38416,38264 x /24
/19255.255.224.00.0.31.2558,1928,19032 x /24
/20255.255.240.00.0.15.2554,0964,09416 x /24
/21255.255.248.00.0.7.2552,0482,0468 x /24
/22255.255.252.00.0.3.2551,0241,0224 x /24
/23255.255.254.00.0.1.2555125102 x /24
/24255.255.255.00.0.0.2552562541 x /24
/25255.255.255.1280.0.0.1271281261/2 of a /24
/26255.255.255.1920.0.0.6364621/4 of a /24
/27255.255.255.2240.0.0.3132301/8 of a /24
/28255.255.255.2400.0.0.1516141/16 of a /24
/29255.255.255.2480.0.0.7861/32 of a /24
/30255.255.255.2520.0.0.3421/64 of a /24
/31255.255.255.2540.0.0.122 (point-to-point)1/128 of a /24
/32255.255.255.2550.0.0.011 (host route)1/256 of a /24

Wildcard masks are the bitwise inverse of the subnet mask. Cisco access control lists and some OSPF configurations use them, so a rule written with 0.0.0.255 means "any value in the last octet", the same scope as a /24.

Cloud reserved addresses

PlatformReserved per IPv4 subnetWhich addressesIPv4 subnet sizesIPv6 subnet size
AWS VPC5First four (network, VPC router, Amazon DNS, future use) and the last (broadcast, not supported in a VPC)/16 to /28 (a /28 leaves 11 usable)/44 to /64 in steps of 4; first four and last address also reserved
Azure Virtual Network5First four (network, default gateway, two for Azure DNS mapping) and the last (broadcast)/29 smallest, /2 largest/64 exactly
Google Cloud VPC4 per primary rangeFirst two (network, default gateway) and last two (future use, broadcast); secondary ranges reserve none/29 smallest/64

Platforms are listed alphabetically. In an AWS subnet 10.0.0.0/24, a flow log entry from 10.0.0.2 is the Amazon DNS resolver, and 10.0.0.1 is the VPC router; in Azure, the .1 address is the default gateway. Knowing this stops analysts chasing infrastructure addresses as suspicious hosts. AWS documents that bring-your-own-IP ranges are an exception to the reservation rule.

Private and special-use ranges

The IANA IPv4 Special-Purpose Address Registry is the authoritative list. "Forwardable" means a router may forward packets between interfaces; "globally reachable" means the address should be reachable on the public internet. Every row below is not globally reachable.

BlockNameRFCRangeWhat it means in a log
0.0.0.0/8"This network"RFC 7910.0.0.0 to 0.255.255.255Should never appear as a real source on the wire; 0.0.0.0 in a listener means all interfaces
10.0.0.0/8Private-UseRFC 191810.0.0.0 to 10.255.255.255Internal; inbound from the internet with this source is spoofed
100.64.0.0/10Shared Address SpaceRFC 6598100.64.0.0 to 100.127.255.255Carrier-grade NAT or some overlay VPNs; many users may share one public address behind it
127.0.0.0/8LoopbackRFC 1122127.0.0.0 to 127.255.255.255Local to the host; a remote packet claiming it is spoofed
169.254.0.0/16Link LocalRFC 3927169.254.0.0 to 169.254.255.255Self-assigned when DHCP fails; 169.254.169.254 is the cloud instance metadata endpoint
172.16.0.0/12Private-UseRFC 1918172.16.0.0 to 172.31.255.255Internal; also the default range for many container bridge networks
192.0.0.0/24IETF Protocol AssignmentsRFC 6890192.0.0.0 to 192.0.0.255Protocol use only (a few anycast /32s inside it are globally reachable)
192.0.2.0/24, 198.51.100.0/24, 203.0.113.0/24Documentation (TEST-NET-1 to 3)RFC 5737Three /24sExamples only; real traffic with these addresses is misconfiguration or spoofing
192.168.0.0/16Private-UseRFC 1918192.168.0.0 to 192.168.255.255Internal, often home and small office networks seen over VPN
198.18.0.0/15BenchmarkingRFC 2544198.18.0.0 to 198.19.255.255Test labs; some proxies and security products also use it internally
240.0.0.0/4ReservedRFC 1112240.0.0.0 to 255.255.255.255Not in use; treat as bogon
255.255.255.255/32Limited BroadcastRFC 919, RFC 8190One addressLocal broadcast only

Multicast: 224.0.0.0/4 (224.0.0.0 to 239.255.255.255) is IPv4 multicast, recorded in the IANA multicast registry rather than the special-purpose registry. Unexpected multicast crossing a routed boundary is worth a look.

Bogon filtering: the special-use blocks above, plus multicast and any unallocated space, form the usual bogon list for edge filters. Drop inbound packets from the internet that claim a source in these ranges, and drop outbound packets with a source outside your own allocations. The Firewall Rule Review Checklist covers how to review those rules.

IPv6 prefixes

From the IANA IPv6 Special-Purpose Address Registry and the IPv6 addressing architecture (RFC 4291):

PrefixNameRFCDefender note
::/128UnspecifiedRFC 4291Source during address configuration only
::1/128LoopbackRFC 4291IPv6 equivalent of 127.0.0.1
::ffff:0:0/96IPv4-mappedRFC 4291IPv4 addresses inside IPv6 sockets; normalise before matching rules, or ::ffff:10.0.0.5 slips past an IPv4 match
64:ff9b::/96IPv4-IPv6 translation (NAT64)RFC 6052The last 32 bits carry the real IPv4 destination
2001::/32TeredoRFC 4380Tunnelling through NAT; usually unwanted in enterprises
2001:db8::/32 and 3fff::/20DocumentationRFC 3849, RFC 9637Examples only
2002::/166to4RFC 3056Legacy tunnelling; block unless needed
fc00::/7Unique local (ULA)RFC 4193Private IPv6, not globally routed; in practice addresses start fd
fe80::/10Link-local unicastRFC 4291Present on every IPv6 interface, even where IPv6 is "not used"
ff00::/8MulticastRFC 4291ff02::1 all nodes and ff02::2 all routers on the link

Allocation sizes: a standard IPv6 subnet is a /64, which holds 264 (about 1.8 x 1019) addresses. A /56 contains 256 /64s and a /48 contains 65,536 /64s. Because hosts change addresses within a /64 through privacy extensions, block or allowlist IPv6 at the /64 (or wider) rather than per address. The IPv6 Security Guide covers the threats.

Subnetting quick maths

  1. Find the block size. In the octet where the mask is not 255 or 0, block size = 256 minus that mask octet. For /21 the mask is 255.255.248.0, so the block size in the third octet is 256 minus 248 = 8.
  2. Find the network address. Round the address in that octet down to a multiple of the block size. 10.20.37.200/21: 37 rounded down to a multiple of 8 is 32, so the network is 10.20.32.0.
  3. Find the last address. Network plus block size, minus one, in that octet, with 255 in the octets after it. 10.20.32.0/21 runs to 10.20.39.255 (2,048 addresses).
  4. Check membership. An address belongs to the subnet if it lies between the network and last address. 192.168.10.77/26: block size 64, network 192.168.10.64, last 192.168.10.127.
  5. Split a block. Each extra prefix bit halves the block. 10.0.0.0/24 split into /26s gives 10.0.0.0, 10.0.0.64, 10.0.0.128 and 10.0.0.192.
  6. Aggregate (summarise). Contiguous blocks aligned on a power of two combine: 10.0.0.0/24 to 10.0.3.0/24 summarise to 10.0.0.0/22. 10.0.1.0/24 to 10.0.4.0/24 do not form one /22, because the block does not start on a multiple of 4.
Mask octet128192224240248252254255
Network bits in octet12345678
Block size1286432168421

Powers of two to memorise: 28 = 256, 210 = 1,024, 212 = 4,096, 216 = 65,536, 220 = 1,048,576, 224 = 16,777,216. Use them to sanity check a rule: 0.0.0.0/1 is half the internet, not a typo to ignore.

Using CIDR in firewall and detection rules

  • Write the narrowest block: an allow rule for a single partner server is a /32, not the partner's /24. Overbroad sources are the most common finding in rule reviews.
  • Watch for accidental "any": 0.0.0.0/0 and ::/0 match everything. A rule with 0.0.0.0/0 on management ports (22, 3389, 5985 and 5986) exposes them to the internet.
  • Check both families: a security group or ACL that restricts IPv4 but leaves ::/0 open on the same port is still exposed when the host has a global IPv6 address.
  • Normalise before matching: convert IPv4-mapped IPv6 addresses to IPv4, and compare addresses as integers or with a CIDR-aware function (for example cidrmatch in Splunk, ipv4_is_in_range in Microsoft Sentinel KQL) rather than string prefixes. A string match on "10.1." also matches 10.10.x.x and 10.100.x.x.
  • Tag internal space: keep a lookup of your ranges so that dashboards show "internal", "VPN pool", "cloud VPC" and "partner" instead of raw addresses. The fill-in table below is the starting point.
  • Treat CGNAT and shared egress carefully: one address in 100.64.0.0/10 at a carrier, or a cloud NAT gateway, may represent many users or workloads. Do not block or attribute on that address alone; correlate with identity and session data.
  • Flow log context: see the AWS VPC Flow Logs Detection Guide for using these ranges in cloud network detection, and Cloud Egress Filtering for outbound controls.

Fill-in: your address plan

Range (CIDR)PurposeLocation or accountOwnerExpected inbound sourcesLast reviewed
[10.0.0.0/16][Head office user VLANs][Site][Team][VPN pool, internal only][Date]
[172.20.0.0/16][Production VPC][Cloud account][Team][Load balancer subnets][Date]
[100.64.0.0/22][Remote access VPN pool][Gateway][Team][Internet via VPN gateway][Date]
[2001:db8:100::/48][IPv6 allocation][Provider][Team][As above][Date]

Practitioner checklist

  • Keep this cheat sheet and your filled-in address plan where analysts work.
  • Maintain a CIDR lookup of internal, VPN, cloud and partner ranges in the SIEM and review it quarterly.
  • Use CIDR-aware matching functions in detections, never string prefixes.
  • Review every rule containing 0.0.0.0/0 or ::/0 and record why it is needed.
  • Filter bogon and special-use sources at the internet edge, for IPv4 and IPv6.
  • Check that IPv6 rules mirror IPv4 rules on every exposed port.
  • Exclude cloud reserved addresses (router, DNS, gateway) from anomaly alerts deliberately, not by accident.
  • Recheck special-use ranges against the IANA registries when you refresh the bogon list.

Standards and references

Related NHI Mgmt Group resources: Network Segmentation Guide · IPv6 Security Guide · Firewall Rule Review Checklist · Amazon VPC Security Guide · IP Address Privacy Guide

PDF for subscribers

Take this guide with you

Every section, table and checklist in one PDF, with links to the sources and related guides. Subscribe to our weekly NHI & AI Identity Journal and we’ll email you a download link.

Free weekly newsletter

Subscribe to the NHI & AI Identity Journal

The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.

Bonus 33% off our NHI Course when you subscribe.

PDF Downloads for Newsletter Subscribers

Get the guide

Enter your details and we’ll email you a download link.

The full guide is free to read online. The PDF is a thank you for subscribing.

Fill in all fields marked * and tick both boxes to continue.