What Is a Subnet, and Why Is It Used?

What is a subnet, and why is it used

Ask any network engineer to draw an IP network on a whiteboard, and within seconds they’re drawing boxes labeled with things like 192.168.1.0/24 or 10.0.5.0/28. Those slash-numbers are subnets, and understanding them is the single most important prerequisite to understanding how modern networks — from a home router to a multi-region cloud VPC — are actually organized. This article explains what a subnet is, how subnetting math works, why it exists at all, and how it plays out differently across operating systems and real deployments.

The Basic Idea

A subnet (short for “subnetwork”) is a logically segmented portion of a larger IP network. Instead of treating every device on an organization’s network as part of one enormous flat address space, subnetting divides that space into smaller, more manageable, and more controllable pieces — much like a large office building is divided into individual floors and rooms rather than being one giant open room.

Every IPv4 address, when combined with a subnet mask, splits into two parts:

IP Address:     192.168.1.  25
                └─network──┘└host┘

Subnet Mask:    255.255.255.0
                (or /24 in CIDR notation)

The subnet mask determines how many bits of the IP address identify the network (and subnet) versus how many bits identify the specific host (device) within that network. A /24 mask means the first 24 bits are network bits, leaving 8 bits (256 addresses, minus a couple reserved ones) for hosts.

CIDR Notation

Modern networking almost universally uses CIDR (Classless Inter-Domain Routing) notation — the /24, /16, /28 shorthand — rather than the older class-based system (Class A, B, C) that assumed fixed, rigid boundaries. CIDR lets network designers pick any prefix length, allocating exactly as many addresses as needed rather than being locked into oversized or undersized fixed blocks.

CIDRSubnet MaskHost BitsUsable Hosts
/24255.255.255.08254
/25255.255.255.1287126
/26255.255.255.192662
/27255.255.255.224530
/28255.255.255.240414
/30255.255.255.25222

The “usable hosts” number is always 2^(host bits) minus 2, because every subnet reserves one address for the network address (all host bits zero, identifying the subnet itself) and one for the broadcast address (all host bits one, used to reach every device on that subnet at once).

A Worked Example

Take the network 192.168.1.0/24 and subdivide it into four smaller subnets using a /26 mask (borrowing 2 extra bits from the host portion):

192.168.1.0/24  split into four /26 subnets:

192.168.1.0/26    hosts: .1   – .62    broadcast: .63
192.168.1.64/26   hosts: .65  – .126   broadcast: .127
192.168.1.128/26  hosts: .129 – .190   broadcast: .191
192.168.1.192/26  hosts: .193 – .254   broadcast: .255

Each of those four blocks is now its own subnet, capable of holding 62 usable hosts, and — critically — each can be assigned to a different department, VLAN, floor, or security zone, with traffic between them controlled by a router or Layer 3 switch.

Why Subnetting Is Used

Subnetting isn’t just an academic exercise; it solves several very concrete, practical problems:

1. Address space efficiency. Without subnetting, an organization with 300 devices spread across five small offices would need either one enormous flat network (wasteful and hard to manage) or five separate large blocks (wasteful of allocated address space). Subnetting lets you carve out right-sized blocks — a /27 (30 hosts) for a small branch office instead of a full /24 (254 hosts) that’s mostly unused.

2. Reduced broadcast traffic. Every device on the same subnet shares a broadcast domain — certain types of traffic (ARP requests, DHCP discovery) are sent to every host on the subnet. On a flat, unsegmented network with thousands of devices, broadcast traffic alone can meaningfully degrade performance. Smaller subnets mean smaller broadcast domains and less unnecessary chatter reaching devices that don’t need it.

3. Security segmentation. Subnets are a natural boundary for firewall and access control policy. A common enterprise design places servers, employee workstations, guest Wi-Fi, and IoT devices on entirely separate subnets, so that a compromised guest-network laptop cannot directly reach internal servers — traffic between subnets has to pass through a router or firewall where policy can be enforced, unlike traffic within a single flat subnet, which flows freely.

4. Simplified routing and troubleshooting. Organizing devices into logical subnets (by location, department, or function) makes routing tables cleaner and makes network problems easier to isolate — “everything on the 10.20.30.0/24 subnet is having issues” is a much more actionable starting point than “some random subset of the company’s 5,000 devices.”

5. Performance and traffic engineering. Network administrators can apply Quality of Service (QoS) policies, bandwidth shaping, or dedicated links on a per-subnet basis, which is far more practical than doing so per individual device.

Subnetting in Practice: Common Real-World Scenarios

Home networks A typical home router hands out addresses on a single /24 subnet like 192.168.1.0/24, giving up to 254 devices — massive overkill for a household, but simple and standardized, which is why consumer router defaults rarely bother subdividing further.

Enterprise networks A mid-sized company might structure its network as:

10.0.0.0/16   (overall allocated block)
├── 10.0.1.0/24   — Finance department
├── 10.0.2.0/24   — Engineering department
├── 10.0.3.0/24   — Guest Wi-Fi (isolated, internet-only)
├── 10.0.10.0/24  — Server VLAN
└── 10.0.20.0/24  — IoT / building management devices

Each of these typically maps to a VLAN (Virtual LAN) at the switching layer, with a router or Layer 3 switch handling inter-VLAN routing and a firewall enforcing which subnets can talk to which.

Cloud networking In AWS, Azure, or GCP, a Virtual Private Cloud (VPC) is typically allocated a large CIDR block (e.g., 10.0.0.0/16), then subdivided into subnets across availability zones — commonly separating public subnets (with a route to an internet gateway, hosting load balancers or bastion hosts) from private subnets (no direct internet route, hosting application servers and databases), a design pattern almost universally recommended for cloud security.

How Operating Systems Handle Subnet Configuration

  • Windows configures subnet masks per network adapter via Control Panel/Settings, ipconfig for viewing, and netsh interface ipv4 set address for scripting configuration. Windows Server’s DHCP role manages subnet-based address scopes for larger deployments. ipconfig /allnetsh interface ipv4 show config
  • Linux exposes subnet configuration through ip addr (modern iproute2 tooling) or the legacy ifconfig, and persists configuration via distro-specific mechanisms (netplan on Ubuntu, NetworkManager, or raw /etc/network/interfaces). ip addr showip addr add 192.168.1.10/24 dev eth0
  • macOS, being UNIX-derived, uses similar underlying tooling (ifconfig, and increasingly networksetup for higher-level configuration), with subnet settings visible under System Settings → Network.
  • Android and iOS largely abstract subnet configuration away from typical users, auto-configuring via DHCP, though both expose static IP/subnet mask fields in advanced Wi-Fi settings for cases requiring manual configuration.

Subnetting and Routing: How They Connect

Subnets matter enormously to routing because a device’s subnet mask determines how it decides whether a destination is “local” (same subnet, can be reached directly via a Layer 2 ARP lookup) or “remote” (different subnet, must be sent to a default gateway/router for forwarding). This decision — performed for every single outbound packet — is why an incorrect subnet mask is such a classic, frustrating networking bug: a device with the wrong mask might think a genuinely local peer is remote (unnecessarily routing traffic through a gateway) or think a genuinely remote host is local (and fail silently, since it’ll try and fail to ARP for a device that isn’t actually on the local segment).

Host: 192.168.1.10/24 wants to reach 192.168.1.50
→ Same subnet (192.168.1.0/24) → ARP for 192.168.1.50 directly, send frame locally

Host: 192.168.1.10/24 wants to reach 8.8.8.8
→ Different subnet → forward to default gateway (e.g., 192.168.1.1)
   which routes it onward toward the internet

VLSM: Variable Length Subnet Masking

Real-world networks rarely need uniformly sized subnets everywhere. A point-to-point link between two routers needs exactly 2 usable addresses; a large office floor might need 100. Variable Length Subnet Masking (VLSM) is the practice of applying different prefix lengths to different subnets carved from the same parent block, rather than forcing every subnet to the same fixed size. This is the practical technique that makes CIDR’s flexibility useful in real designs rather than purely theoretical.

Parent block: 10.10.0.0/22 (1024 addresses)

10.10.0.0/24    — Office LAN (254 hosts)
10.10.1.0/25    — Server VLAN (126 hosts)
10.10.1.128/28  — Management VLAN (14 hosts)
10.10.1.144/30  — Router-to-router link (2 hosts)
10.10.1.148/30  — Second router-to-router link (2 hosts)

Without VLSM, an administrator would have to allocate the largest subnet size needed to every segment, wasting enormous numbers of addresses on point-to-point links that only ever need two. VLSM lets each segment consume exactly the address space its actual host count requires, which matters even more in constrained private address ranges shared across a large organization.

Supernetting and Route Summarization

The inverse operation to subnetting is supernetting (also called route aggregation or summarization): combining multiple contiguous smaller networks into a single, larger routing table entry. If an organization owns four contiguous /24 blocks — 192.168.0.0/24 through 192.168.3.0/24 — they can be summarized as a single 192.168.0.0/22 route advertisement, letting upstream routers carry one compact entry instead of four separate ones.

This matters enormously at internet scale: without aggressive summarization, the global internet routing table would be far larger than it already is, since every ISP’s individual customer allocations would otherwise need to be advertised as separate routes rather than being folded into a provider’s larger aggregate block. Within an enterprise, well-planned, contiguous subnet allocation (rather than scattered, arbitrary blocks) is what makes summarization possible in the first place — another reason deliberate, hierarchical address planning pays off long after the initial network design.

Subnetting and Network Address Translation (NAT)

Private subnets (RFC 1918 space) are not directly routable on the public internet, which is where NAT comes in — translating private internal addresses to a smaller number of public addresses (often just one) as traffic exits toward the internet. This relationship is why home and enterprise networks alike can freely use overlapping private subnet ranges (192.168.1.0/24 is reused by millions of independent home networks worldwide) without any global coordination — NAT keeps that internal addressing invisible to the outside world. It’s worth noting NAT and subnetting solve different problems: subnetting organizes and segments address space; NAT conserves scarce public IPv4 addresses and adds a translation boundary that incidentally provides a mild security benefit by hiding internal addressing structure from external hosts.

IPv6 Subnetting: A Brief Note

IPv6 subnetting follows the same core logic — network bits and host/interface bits, expressed as a prefix length — but with vastly larger address space. The convention is almost always to allocate a /64 per subnet regardless of expected host count, since IPv6’s addressing philosophy prioritizes simplicity and stateless address autoconfiguration (SLAAC) over the address-conservation concerns that drove IPv4 subnetting practice.

Best Practices

  • Plan address space top-down: allocate a large private block (e.g., 10.0.0.0/8 or 172.16.0.0/12) and subdivide deliberately, leaving room for growth rather than exhausting small allocations immediately.
  • Align subnet boundaries with security and administrative boundaries — departments, trust levels, and VLANs — not arbitrary device counts.
  • Document your subnet allocation plan (an IP Address Management/IPAM system for anything beyond small networks) to avoid overlapping or duplicate allocations, especially when merging networks (e.g., after a company acquisition or a VPN interconnection between two previously separate networks).
  • Reserve room for growth — a /24 that’s already at 240 of 254 addresses used is a maintenance headache waiting to happen; consider a supernet or renumbering plan before hitting the ceiling.
  • Use private address ranges (RFC 1918: 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16) for internal subnets, routed to the internet via NAT, rather than using public IP space internally.

Summary

A subnet is a logically divided segment of a larger IP network, defined by a subnet mask (or CIDR prefix) that splits an IP address into network and host portions. Subnetting exists to conserve address space, shrink broadcast domains, enforce security boundaries between segments, and simplify routing and troubleshooting. It’s foundational to how everything from a home router to a global enterprise network to a cloud VPC is structured, and understanding the arithmetic behind it — how many host bits yield how many usable addresses — is essential groundwork for nearly every other topic in networking and network security.

FAQs

What’s the difference between a subnet mask and CIDR notation? They express the same information in different formats — 255.255.255.0 and /24 both mean “the first 24 bits are the network portion” — CIDR notation is just more compact and is the format used in most modern configuration and documentation.

Why do usable host counts subtract 2 from the total? Because every subnet reserves the all-zeros host address as the network identifier and the all-ones host address as the broadcast address, leaving the rest for actual device assignment.

Can two devices on different subnets communicate directly without a router? No — by definition, communication across subnet boundaries requires a Layer 3 device (a router, or a Layer 3 switch performing routing) to forward traffic between them.

Is subnetting still necessary with IPv6’s huge address space? Yes — subnetting remains essential for the same organizational, security segmentation, and routing-efficiency reasons, even though address conservation is far less of a concern than under IPv4.

What’s a common mistake when planning subnets? Under-provisioning: choosing a subnet size that seems adequate today but leaves no room for growth, forcing a disruptive re-addressing project later.

References

  • RFC 4632 — Classless Inter-domain Routing (CIDR)
  • RFC 1918 — Address Allocation for Private Internets
  • IETF RFC 950 — Internet Standard Subnetting Procedure
  • Cisco Networking Academy — IP Addressing and Subnetting
Total
1
Shares

Leave a Reply

Previous Post
What is network management in the context of operating systems

What Is Network Management in the Context of Operating Systems?

Next Post
How do file permissions work in a Linux file system

How Do File Permissions Work in a Linux File System?

Related Posts