Introduction

IP subnetting is a fundamental networking skill. It allows you to divide networks into smaller subnets for better organization, security, and efficiency. This guide explains subnetting with practical examples.

What is Subnetting?

Subnetting divides a network into smaller subnetworks (subnets). Each subnet has its own network address and broadcast address.

Why Subnet?

Benefits:

  • Security: Isolate network segments
  • Performance: Reduce broadcast traffic
  • Organization: Logical grouping
  • Efficiency: Better IP address utilization

IP Address Basics

IPv4 Address Structure

IPv4 addresses are 32-bit numbers, typically shown as four octets:

192.168.1.0
β”‚   β”‚   β”‚ β”‚
β”‚   β”‚   β”‚ └─ Host ID (last 8 bits)
β”‚   β”‚   └─── Host ID
β”‚   └─────── Network ID
└─────────── Network ID

Subnet Mask

Subnet mask determines which part is network and which is host:

IP Address:   192.168.1.100
Subnet Mask:  255.255.255.0
              ─────────────
Network:      192.168.1.0
Host:                   100

CIDR Notation

CIDR (Classless Inter-Domain Routing) uses slash notation:

192.168.1.0/24
              β”‚
              └─ Number of network bits

Common CIDR Blocks

CIDRSubnet MaskHostsUse Case
/32255.255.255.2551Single host
/30255.255.255.2522Point-to-point links
/24255.255.255.0254Small networks
/16255.255.0.065,534Medium networks
/8255.0.0.016M+Large networks

Subnetting Examples

Example 1: /24 Network

Given: 192.168.1.0/24

  • Network: 192.168.1.0
  • Subnet Mask: 255.255.255.0
  • Broadcast: 192.168.1.255
  • Usable Hosts: 192.168.1.1 - 192.168.1.254 (254 hosts)

Example 2: Subnetting /24 into /26

Given: 192.168.1.0/24 β†’ Create 4 subnets

Subnets:

  1. 192.168.1.0/26 (Hosts: 192.168.1.1 - 192.168.1.62)
  2. 192.168.1.64/26 (Hosts: 192.168.1.65 - 192.168.1.126)
  3. 192.168.1.128/26 (Hosts: 192.168.1.129 - 192.168.1.190)
  4. 192.168.1.192/26 (Hosts: 192.168.1.193 - 192.168.1.254)

Each subnet has 64 addresses (62 usable hosts).

Example 3: Variable Length Subnetting (VLSM)

Create subnets of different sizes:

Given: 192.168.1.0/24

Requirements:

  • Subnet A: 50 hosts β†’ /26 (64 addresses)
  • Subnet B: 25 hosts β†’ /27 (32 addresses)
  • Subnet C: 10 hosts β†’ /28 (16 addresses)

Solution:

  • Subnet A: 192.168.1.0/26
  • Subnet B: 192.168.1.64/27
  • Subnet C: 192.168.1.96/28

Calculating Subnets

Number of Hosts

Hosts = 2^(32 - CIDR) - 2

Examples:

  • /24: 2^8 - 2 = 254 hosts
  • /25: 2^7 - 2 = 126 hosts
  • /26: 2^6 - 2 = 62 hosts
  • /30: 2^2 - 2 = 2 hosts

Number of Subnets

Subnets = 2^(New CIDR - Original CIDR)

Example: Split /24 into /26:

  • Subnets = 2^(26 - 24) = 2^2 = 4 subnets

Private IP Ranges

RFC 1918 Private Addresses

RangeCIDRDescription
10.0.0.0 - 10.255.255.25510.0.0.0/8Class A private
172.16.0.0 - 172.31.255.255172.16.0.0/12Class B private
192.168.0.0 - 192.168.255.255192.168.0.0/16Class C private

Use for:

  • Internal networks
  • NAT environments
  • Virtual private clouds

Practical Examples

Home Network Setup

Router: 192.168.1.1/24
  β”œβ”€ Laptop: 192.168.1.100
  β”œβ”€ Phone: 192.168.1.101
  └─ TV: 192.168.1.102

Office Network

Main Network: 10.0.0.0/16
  β”œβ”€ Servers: 10.0.1.0/24
  β”œβ”€ Workstations: 10.0.2.0/24
  β”œβ”€ Guest WiFi: 10.0.3.0/24
  └─ IoT Devices: 10.0.4.0/24

Tools

Use our tools:

Conclusion

IP subnetting is essential for network design:

Key concepts:

  • CIDR notation
  • Subnet masks
  • Network and host portions
  • Broadcast addresses

Benefits:

  • Better organization
  • Improved security
  • Efficient IP usage
  • Scalability

Next Steps