IP Address & Network

CIDR

About 5 min read

What Is CIDR

CIDR (Classless Inter-Domain Routing, pronounced "cider") is a notation for flexibly specifying the boundary between the network and host portions of an IP address. It is written as 192.168.1.0/24, where the number after the slash (prefix length) indicates how many leading bits represent the network.

Before CIDR, IP addresses were managed in rigid classes: Class A (8-bit network), Class B (16-bit), and Class C (24-bit). Class B provided 65,534 addresses - too many for mid-sized organizations - while Class C's 254 addresses were too few.

Introduced in 1993, CIDR abolished fixed classes and allowed network boundaries at any bit position. RFC 1519 describes its aims as conserving address space and stemming the explosive growth of routing tables.

Understanding Prefix Lengths

/8 (255.0.0.0)
8-bit network, 24-bit host. About 16.7 million addresses. Equivalent to old Class A. 10.0.0.0/8 is one of the ranges RFC 1918 reserves for private use.
/16 (255.255.0.0)
16-bit network, 16-bit host. 65,534 addresses. Equivalent to old Class B. RFC 1918 reserves 172.16.0.0/12 (172.16.0.0 to 172.31.255.255) for private use, and 172.16.0.0/16 is one slice of that block.
/24 (255.255.255.0)
24-bit network, 8-bit host. 254 addresses. Equivalent to old Class C. Also used for home and small office networks.
/32
Specifies a single IP address. Used in firewall rules to allow or deny exactly one host.

Larger prefix lengths mean smaller networks (fewer addresses). /0 represents all IP addresses (the entire internet) and is used for default routes.

To quickly check the range or host count of a CIDR block, try our CIDR / Subnet Calculator. It instantly computes the network address, broadcast address, and mask conversions right in your browser.

If you want to check whether the IP address you are currently using falls within a particular CIDR block, try the IP Address Range Check. It shows bit by bit whether the network portion matches, so you can see in practice what the prefix length means.

Relationship with Subnet Masks

A subnet mask expresses the same information as CIDR in a different format. /24 equals 255.255.255.0; /16 equals 255.255.0.0. The mask sets network bits to 1 and host bits to 0.

For 192.168.1.100/24, the AND operation with 255.255.255.0 yields the network address 192.168.1.0. Usable hosts range from 192.168.1.1 to 192.168.1.254 (with .0 reserved as the network address and .255 as the broadcast address).

CIDR notation is more concise and easier to calculate. However, OS network settings sometimes still use subnet mask format, so understanding both is practical.

AWS Security Group Examples

AWS security groups and network ACLs use CIDR notation to specify source and destination addresses.

  • 0.0.0.0/0: All IPv4 addresses. Used to open HTTP/HTTPS ports on web servers, but dangerous for SSH ports as it allows login attempts from anywhere.
  • ::/0: All IPv6 addresses. The IPv6 equivalent of 0.0.0.0/0.
  • 203.0.113.50/32: A single IP address. Used to restrict SSH access to your office IP only.
  • 10.0.0.0/16: An entire VPC private subnet range. Used for internal communication rules.

When designing an AWS VPC, you choose a VPC CIDR block (e.g., 10.0.0.0/16) and subdivide it into subnets (e.g., 10.0.1.0/24 for public, 10.0.2.0/24 for private). The block has to be between /16 and /28, and the primary CIDR you pick at creation cannot be disassociated afterwards (you can associate additional blocks). VPC peering also fails when the two CIDRs overlap, so pick a range that does not collide with your other VPCs or your on-premises network.

Common Misconceptions

/24 is the same as Class C
/24 simply means the first 24 bits are the network portion, independent of the old class system. CIDR abolished classes entirely. For example, 10.0.1.0/24 is a /24 within the old Class A range.
CIDR is only for IPv4
CIDR is used with IPv6 as well. In IPv6, RFC 4291 generally requires 64-bit interface IDs for unicast addresses, so subnets use /64. For the size of site assignments, RFC 6177 replaced the earlier /48-by-default recommendation of RFC 3177 and leaves the choice to the operational community. The notation is identical: 2001:db8::/32.
Share

Related Terms

Related Articles

Related list