Subnetting

Subnetting is the practice of dividing a network into smaller subnetworks (subnets). It's a fundamental skill for network administrators.

Why Subnet?

Subnetting provides several benefits:

  • Efficient IP usage - Allocate only what you need
  • Security - Isolate sensitive systems
  • Performance - Reduce broadcast traffic
  • Organization - Logical network structure

Binary Basics

To subnet effectively, you need to understand binary. Each IP octet is 8 bits, with values from 0-255.

Binary Converter

Bit Values (powers of 2):
128
64
32
16
8
4
2
1
Click bits to toggle (1/0):
128
64
-
-
-
-
-
-
Binary
11000000
Decimal
Calculation:
128 + 64 = 192

Subnet Mask Deep Dive

The subnet mask determines which part of an IP is the network and which is for hosts.

Subnet Mask Visualizer

Decimal (Subnet Mask):
255.255.255.0
Binary (32 bits):
11111111.
11111111.
11111111.
00000000
Network Portion
24 bits
Identifies the network
Host Portion
8 bits
254 usable hosts
How it works: The 1s (blue) define the network portion - these bits stay the same for all hosts in the subnet. The 0s (orange) are for host addresses - each unique combination represents a different device.

Interactive Subnet Calculator

Try different IP addresses and CIDR prefixes to see how subnets work:

Subnet Calculator

/0/8/16/24/32
Network Address
192.168.1.0
Broadcast Address
192.168.1.255
First Usable Host
192.168.1.1
Last Usable Host
192.168.1.254
Subnet Mask
255.255.255.0
Total Addresses
256
Usable Hosts
254
Visual Representation:
192.168.1.0192.168.1.1...192.168.1.254192.168.1.255
Network (reserved)Usable hostsBroadcast (reserved)
Quick tip: The number of usable hosts = 2^(32-CIDR) - 2. We subtract 2 because the network address and broadcast address can't be assigned to hosts.

Visualizing Subnet Division

See how a network gets divided into smaller subnets:

Subnet Division Visualizer

Original Network
192.168.10.0/24
New CIDR
/26
Click a subnet to see details:
064128192255
Subnet 1
192.168.10.0/26
62 usable hosts
Subnet 2
192.168.10.64/26
62 usable hosts
Subnet 3
192.168.10.128/26
62 usable hosts
Subnet 4
192.168.10.192/26
62 usable hosts
How to calculate:
  • Borrowed bits: 26 - 24 = 2
  • Number of subnets: 2^2 = 4
  • Block size: 256 - 192 = 64
  • Hosts per subnet: 2^6 - 2 = 62

CIDR Reference

Use this table to quickly look up subnet information:

CIDR Quick Reference

CIDRSubnet MaskBlock SizeUsable Hosts
/32255.255.255.25511
/31255.255.255.25422
/30255.255.255.25242
/29255.255.255.24886
/28255.255.255.2401614
/27255.255.255.2243230
/26255.255.255.1926462
/25255.255.255.128128126
/24255.255.255.0256254
/23255.255.254.0512510
/22255.255.252.01,0241,022
/21255.255.248.02,0482,046
/20255.255.240.04,0964,094
/16255.255.0.065,53665,534
Block Size Formula
256 - last octet
Usable Hosts
2^(32-CIDR) - 2
Subnets from /24
2^(CIDR-24)

VLSM (Variable Length Subnet Masks)

VLSM allows using different subnet sizes within the same network for efficient address allocation.

Example: You have 192.168.1.0/24 and need:

  • 1 subnet for 100 hosts
  • 1 subnet for 50 hosts
  • 1 subnet for 25 hosts
  • 2 subnets for point-to-point links (2 hosts each)

Solution (allocate largest first):

  1. 100 hosts needs /25 (126 hosts) = 192.168.1.0/25
  2. 50 hosts needs /26 (62 hosts) = 192.168.1.128/26
  3. 25 hosts needs /27 (30 hosts) = 192.168.1.192/27
  4. 2 hosts needs /30 (2 hosts) = 192.168.1.224/30
  5. 2 hosts needs /30 (2 hosts) = 192.168.1.228/30

Pro tip: Always allocate the largest subnets first to avoid fragmentation!

Practice Tasks

Binary Conversion: Use the Binary Converter above in Practice mode. Convert at least 5 numbers correctly.

Subnet Calculation: Using the Subnet Calculator, find the network address, broadcast address, and usable host range for 172.16.50.100/22.

Subnet Design: You have 10.0.0.0/24 and need 8 equal subnets. What CIDR would you use? How many hosts per subnet?

VLSM Design: You have 172.16.0.0/16. Design subnets for: a department with 500 hosts, a department with 200 hosts, and 4 point-to-point links.

Summary

  • Subnetting divides networks into smaller segments
  • Understanding binary is essential for subnet calculations
  • The subnet mask separates network and host portions
  • Block size = 256 - subnet mask last octet
  • VLSM allows efficient use of address space with variable subnet sizes

Next up: Routing Protocols - how routers learn and share network paths.

Test Your Knowledge

Loading...