Subnets explained simply

Topic: Networking basics

Summary

A subnet is a logical subdivision of an IP network defined by a prefix (CIDR). Learn how subnetting splits address space, why you use it for organization and routing, and how to derive the range and size from the prefix. Use this when planning or changing network layout.

Intent: How-to

Quick answer

  • A subnet is a block of IP addresses with a common prefix (e.g. 10.0.1.0/24); the prefix length defines how many addresses are in the block (2^(32-n) for IPv4).
  • Subnetting lets you split a larger network into smaller pieces for different locations, VLANs, or security zones; each subnet has its own network and broadcast address.
  • Routing and firewalls use subnets: traffic to another subnet goes via a gateway; you can allow or deny by subnet (e.g. 10.0.0.0/8) instead of single IPs.

Prerequisites

Steps

  1. Define subnet from prefix

    A subnet is the set of IPs that share the same prefix of n bits; e.g. 10.0.1.0/24 contains 256 addresses (10.0.1.0–255), with .0 network and .255 broadcast; 2^(32-n) total, minus 2 for network and broadcast gives usable hosts.

  2. See why subnets are used

    Organize by location or role (e.g. one /24 per floor or VLAN); simplify routing (one route per subnet); apply firewall or policy per subnet; limit broadcast domain.

  3. Relate to routing

    A host in 10.0.1.0/24 sends traffic to 10.0.2.0/24 via its default gateway; the gateway has a route for 10.0.2.0/24; without that route, the host cannot reach the other subnet.

  4. Apply in practice

    When you assign an IP to a host, you assign it to a subnet (e.g. 10.0.1.10/24); the host uses the same prefix to know who is on-link vs who needs the gateway.

Summary

A subnet is a contiguous block of IP addresses defined by a CIDR prefix. Subnetting organizes address space, simplifies routing, and lets you apply policy per segment. Use this when planning networks or configuring addresses and routes.

Prerequisites

Steps

Step 1: Define subnet from prefix

A subnet is all addresses that share the same n-bit prefix. For 10.0.1.0/24 there are 2^(32-24) = 256 addresses. The first (10.0.1.0) is the network address, the last (10.0.1.255) is the broadcast; typically 10.0.1.1–254 are used for hosts.

Step 2: See why subnets are used

Subnets segment the network by location, VLAN, or function. Each subnet has one network and one broadcast address; routing and firewall rules can be applied per subnet; and the broadcast domain is limited to that segment.

Step 3: Relate to routing

Hosts on the same subnet can reach each other directly (same link). To reach another subnet, the host sends traffic to its default gateway; the gateway must have a route (or default) toward that subnet.

Step 4: Apply in practice

When you set an address like 10.0.1.10/24, the host knows it is in 10.0.1.0/24 and can compute which addresses are on-link and which require the gateway.

Verification

  • You can state what a subnet is, how the prefix length determines size, and why subnets are used for routing and policy.

Troubleshooting

Host cannot reach another subnet — Check that the host has a default gateway (or a route to that subnet); check that the gateway has a route back or a default; check firewall between subnets.

Wrong subnet after config — Verify the address and prefix; a typo in the prefix length can put the host in a different or overlapping subnet.

Next steps

Continue to