Routelearn.net
Course menu

Course 2: IP Subnetting and VLSMLesson 1.1 (1 of 1 in this course)6 of 91 in the CCNA series

Subnetting

Subnet masks, CIDR, network and broadcast addresses, usable host counts, and VLSM: the math behind every subnet calculator.

Intermediate · 8 min read · Before this: IP Addressing

Subnetting is the process of dividing an IP network into smaller networks, called subnets, by borrowing bits from the host portion of the address and using them as network bits. The subnet mask or CIDR prefix length shows where the network part ends and the host part begins.

In simple terms: Subnetting splits one big block of IP addresses into smaller blocks, one for each group of devices. The mask tells every device which addresses are in its own block.

Subnetting means taking one larger network and dividing it into smaller, self-contained networks called subnets. Say a company has a single block of address space, like 192.168.1.0/24. It can split that block up to give separate, isolated ranges to different departments, floors, or VLANs, instead of putting every device on one flat network.

Why subnet at all?

  • Smaller broadcast domains. Every device on the same subnet shares broadcast traffic (ARP requests, DHCP discovery, and so on). Fewer devices per subnet means less broadcast noise and better performance.
  • Isolation and security. Traffic between subnets has to pass through a router. This gives you a natural point to apply access control, like keeping a guest Wi-Fi subnet from reaching internal servers.
  • Efficient use of address space. Instead of wasting a large block of addresses on a department with only 10 devices, subnetting lets you size each network to roughly match what it actually needs.

💡 In simple terms: subnetting is like dividing one big open-plan office into separate rooms. Everyone can still reach everyone else through the hallway (the router), but noise and traffic inside one room no longer spill into every other room.

The subnet mask and prefix length

A subnet mask marks which bits of an IPv4 address are the network portion and which are the host portion. A 1 marks a network bit, a 0 marks a host bit. 255.255.255.0 in binary is 24 ones followed by 8 zeros. That's why it's also written as the CIDR prefix /24: the number after the slash simply counts the leading 1 bits.

PrefixSubnet maskHost bitsUsable hosts
/24255.255.255.08254
/25255.255.255.1287126
/26255.255.255.192662
/27255.255.255.224530
/28255.255.255.240414
/29255.255.255.24836
/30255.255.255.25222

That last column follows 2ⁿ − 2, where n is the number of host bits. You subtract 2 for the reserved network and broadcast addresses on every subnet. The CIDR Calculator converts between prefix and mask instantly. The Wildcard Mask Calculator shows the inverted form of a mask, used in access lists and OSPF configuration.

Splitting one network into equal subnets

The core move in subnetting is borrowing host bits to create more network bits. Take 192.168.1.0/24 and borrow 2 bits from the host portion to make it a /26. Those 2 borrowed bits give 2² = 4 equal-sized subnets, each with 2⁶ − 2 = 62 usable hosts:

SubnetNetwork addressUsable rangeBroadcast
1192.168.1.0/26.1 – .62192.168.1.63
2192.168.1.64/26.65 – .126192.168.1.127
3192.168.1.128/26.129 – .190192.168.1.191
4192.168.1.192/26.193 – .254192.168.1.255

Enter 192.168.1.0/26 into the Subnet Calculator. It will show you the full breakdown: network address, broadcast address, and usable host range, for any address and prefix you give it.

Try it: divide a network visually

Use the controls below to borrow more or fewer bits from 192.168.1.0/24 and watch it split into equal subnets in real time.

Borrow 2 host bits from 192.168.1.0/24 to create 4 subnets of /26 each.

2
192.168.1.0 – 63
192.168.1.64 – 127
192.168.1.128 – 191
192.168.1.192 – 255

Real-world scenario: subnetting an office by department

A small office needs three separate networks: HR, Finance, and IT. Each one is isolated from the others for security, and they all share one 192.168.1.0/24 block:

HR
192.168.1.0/26
Finance
192.168.1.64/26
IT
192.168.1.128/26
Router
Routes between all three
One /24 block split into three department subnets, all reachable through the same router.

Devices within HR can talk to each other directly, without a router. If Finance needs to reach a file server on the IT subnet, that traffic has to pass through the router. That's exactly where a network administrator would apply a rule to allow or block it.

VLSM: subnets of different sizes

Splitting into equal subnets is simple, but it wastes space when departments need very different numbers of hosts. VLSM (Variable Length Subnet Masking) solves this by giving each subnet only as many host bits as it actually needs. The standard approach: sort requirements largest-first. Then allocate each one starting from the next free address, sized to the smallest power of two that fits.

For example, start from 192.168.1.0/24 with three requirements: Sales needs 50 hosts, Engineering needs 25, and Guest Wi-Fi needs 10:

DepartmentHosts neededAllocated blockUsable hosts
Sales50192.168.1.0/2662
Engineering25192.168.1.64/2730
Guest Wi-Fi10192.168.1.96/2814

Each block is sized to its actual need, instead of every department getting an identical, mostly-empty /26. You don't need to do this by hand. The VLSM Calculator takes a base network and a list of named requirements, and produces exactly this kind of allocation table.

A quick mental-math shortcut

  • Number of subnets = 2 raised to the number of bits you borrow.
  • Block size is the gap between each subnet's network address. It equals 256 minus the last non-255 octet of the subnet mask. For a /26 mask (255.255.255.192), that's 256 − 192 = 64. That's exactly the spacing in the four-subnet table above (.0, .64, .128, .192).

FAQ

Why not just put every device on one giant network?
You could, but every device would share the same broadcast domain. That means ARP requests, DHCP discovery, and other broadcast traffic from any one device reaches every other device. On a large network, that creates real, measurable performance problems. It also removes the natural boundary a router provides for security. Subnetting fixes both problems.
Why do I subtract 2 from the usable host count?
Every subnet reserves its first address as the network address, which identifies the subnet itself. It also reserves its last address as the broadcast address, which reaches every device on the subnet. Neither address can be assigned to a device. That's why usable hosts is 2ⁿ − 2, not 2ⁿ.
When should I use VLSM instead of equal-size subnets?
Use it whenever your subnets need meaningfully different numbers of hosts. Equal subnetting is simpler to plan, but it wastes address space on smaller subnets. VLSM sizes each subnet to what it actually needs. This matters more as address space gets scarcer or the network grows.