跳转到主要内容

networking

CIDR Cheat Sheet: /8 to /32 Subnet Masks and Host Counts

robinhood-projects4 分钟阅读

IPv4子网计算器

根据任意IPv4 CIDR地址块计算网络地址、广播地址、可用主机范围、子网掩码、反掩码及主机数量。

使用工具 →

CIDR范围展开工具

将任意CIDR地址块展开为该范围内所有IP地址的完整列表。

使用工具 →

反掩码计算器

由子网掩码计算反掩码,或由反掩码计算子网掩码。

使用工具 →

CIDR Cheat Sheet: Every Prefix From /8 to /32

Bookmark this page. The table below lists every common CIDR prefix from /8 to /32 with its subnet mask, wildcard mask, total addresses, and usable hosts. After the table you will find a quick way to read it and a few rules of thumb that save time in exams and on the job.

If you want the theory behind it, start with our subnetting from scratch guide and come back here as a reference.

The Full CIDR Table

Usable hosts = total addresses minus 2 (the network and broadcast addresses), except for /31 and /32.

CIDRSubnet maskWildcard maskTotal addressesUsable hosts
/8255.0.0.00.255.255.25516,777,21616,777,214
/9255.128.0.00.127.255.2558,388,6088,388,606
/10255.192.0.00.63.255.2554,194,3044,194,302
/11255.224.0.00.31.255.2552,097,1522,097,150
/12255.240.0.00.15.255.2551,048,5761,048,574
/13255.248.0.00.7.255.255524,288524,286
/14255.252.0.00.3.255.255262,144262,142
/15255.254.0.00.1.255.255131,072131,070
/16255.255.0.00.0.255.25565,53665,534
/17255.255.128.00.0.127.25532,76832,766
/18255.255.192.00.0.63.25516,38416,382
/19255.255.224.00.0.31.2558,1928,190
/20255.255.240.00.0.15.2554,0964,094
/21255.255.248.00.0.7.2552,0482,046
/22255.255.252.00.0.3.2551,0241,022
/23255.255.254.00.0.1.255512510
/24255.255.255.00.0.0.255256254
/25255.255.255.1280.0.0.127128126
/26255.255.255.1920.0.0.636462
/27255.255.255.2240.0.0.313230
/28255.255.255.2400.0.0.151614
/29255.255.255.2480.0.0.786
/30255.255.255.2520.0.0.342
/31255.255.255.2540.0.0.122 (point-to-point, RFC 3021)
/32255.255.255.2550.0.0.011 (single host)

How to Read the Table

The number after the slash is how many bits, counted from the left, belong to the network. The remaining bits, 32 - prefix, identify hosts inside it.

  • Total addresses = 2^(32 - prefix).
  • Usable hosts = total minus 2.
  • Every step up in prefix halves the block. Every step down doubles it.

Example: 192.168.10.0/26. Host bits = 6, so 64 addresses, 62 usable. The mask is 255.255.255.192. The block runs from 192.168.10.0 to 192.168.10.63, so the network address is .0 and the broadcast is .63.

Shortcuts Worth Memorising

  1. The magic number. In the interesting octet, the block size is 256 - mask value. For /26 the mask octet is 192, and 256 - 192 = 64. Subnets start at 0, 64, 128, 192.
  2. Mask octet values. They only ever take these values: 0, 128, 192, 224, 240, 248, 252, 254, 255.
  3. Prefix on an octet boundary. /8, /16, /24 line up with 255.0.0.0, 255.255.0.0, 255.255.255.0.
  4. Sizing a subnet. Pick the smallest prefix whose usable count covers your hosts. For 50 hosts, /26 (62 usable) fits and /27 (30) does not.

Private Ranges in CIDR Form

RangeCIDRAddresses
10.0.0.0 to 10.255.255.25510.0.0.0/816,777,216
172.16.0.0 to 172.31.255.255172.16.0.0/121,048,576
192.168.0.0 to 192.168.255.255192.168.0.0/1665,536

These are the RFC 1918 private ranges. For what they mean in practice, see our guide to public vs private IP addresses.

Common Mistakes

  • Forgetting to subtract 2. A /24 holds 254 hosts, not 256.
  • Mixing up subnet and wildcard masks. Cisco ACLs want 0.0.0.255, not 255.255.255.0.
  • Misaligned networks. 10.0.0.100/26 is a host inside 10.0.0.64/26, not a network address. A CIDR block must start on a multiple of its size.
  • Overlapping subnets when allocating by hand. Check ranges before assigning.

Skip the Maths When You Need To

For anything beyond a quick lookup, let a tool do it. The IPv4 subnet calculator shows network, broadcast, and host range for any address and prefix. The CIDR range expander lists the addresses in a block, and the wildcard mask calculator converts masks for ACLs. All are free and need no signup.

Open the IPv4 Subnet Calculator →