What is a Subnet? IP Subnetting Explained

A subnet (subnetwork) is a logical subdivision of an IP network. Subnetting takes a block of IP addresses and divides it into smaller, more manageable pieces. It is fundamental to how networks are organized internally, how traffic is routed between networks, and how the global BGP routing table is structured.

The Address Structure

Every IP address has two conceptual parts: a network portion that identifies which network the address belongs to, and a host portion that identifies a specific device on that network. The prefix length — written in CIDR notation as the slash number — defines exactly where the boundary falls.

For the address 192.0.2.45/24:

Subnet Masks and CIDR

Before 1993, the internet used a classful addressing scheme: Class A (/8), Class B (/16), and Class C (/24) were the only options. A company needing 500 addresses had to get a Class B block with 65,536 addresses — wasting over 65,000. CIDR (Classless Inter-Domain Routing), defined in RFC 4632, replaced this with arbitrary prefix lengths, allowing precise allocation.

The subnet mask is the binary complement of the host mask. A /24 subnet mask in binary is 24 ones followed by 8 zeros: 11111111.11111111.11111111.00000000, written as 255.255.255.0. A /26 is 11111111.11111111.11111111.11000000 = 255.255.255.192.

Subnetting a /24 into /26 Subnets 192.0.2.0/24 — 256 addresses Network bits: 192.0.2 | Host bits: .0–.255 192.0.2.0/26 .0 – .63 (64 addrs) 192.0.2.64/26 .64 – .127 (64 addrs) 192.0.2.128/26 .128 – .191 (64 addrs) 192.0.2.192/26 .192 – .255 Each /26 has 64 total addresses: 62 usable (minus network and broadcast)

Common Subnet Sizes

CIDRAddressesUsable hostsCommon use
/3211 (host route)Single host, loopback, BGP next-hop
/3122 (RFC 3021)Point-to-point links (no broadcast needed)
/3042Classic point-to-point link
/281614Small server cluster
/266462Small office segment
/24256254Common LAN segment, smallest BGP-routed prefix
/221,0241,022Mid-size ISP allocation
/204,0964,094Large enterprise
/1665,53665,534Large ISP block
/816,777,21616,777,214Legacy "Class A" (rare)

Reserved and Special Subnets

Several IPv4 ranges are reserved for specific purposes and are never routed on the public internet:

Subnet Math

Given any CIDR block, the key calculations are:

Example: 10.0.5.128/25

Subnetting and BGP

In the global BGP routing table, each announced prefix is a subnet that an autonomous system is advertising to the world. The routing table contains roughly one million IPv4 prefixes. Most are /24 or shorter (less specific), because prefixes more specific than /24 are typically filtered by other networks and will not propagate globally.

Networks use subnetting for traffic engineering. An organization with a /20 might announce the whole /20 for reachability, while also announcing individual /24 subnets via different upstream providers to control which provider carries traffic for which portion of their address space. BGP communities provide a finer-grained way to influence this without announcing additional specifics.

IPv6 Subnetting

For IPv6, the standard subnet size is /64. SLAAC (Stateless Address Autoconfiguration) requires a /64 because it uses the 64-bit host portion to embed the interface identifier. A typical home or office receives a /48 from their ISP, which they can divide into up to 65,536 /64 subnets — one per room, per device type, or per VLAN — without ever running out.

See Subnets in Practice

Look up different IPs within the same organization to see how address space is divided into announced subnets:

See BGP routing data in real time

Open Looking Glass
← Previous What is Anycast? One IP, Many Servers
More Articles
What is DNS? The Internet's Phone Book
What is an IP Address?
IPv4 vs IPv6: What's the Difference?
What is a Network Prefix (CIDR)?
How Does Traceroute Work?
What is a CDN? Content Delivery Networks Explained