🌐 What is Subnetting?

Think of it like dividing a big house into apartments:

Subnetting means taking one big network and dividing it into smaller networks (subnets). Each subnet can have its own group of devices.

Real-World Example:

🏢 You have a company with 200 IP addresses

📊 You want to create 4 separate networks:

• Sales Department (50 people)

• IT Department (30 people)

• HR Department (40 people)

• Guest WiFi (80 people)

🔢 Why Do We Subnet?

There are several good reasons:

  • Better Organization: Keep different departments separate
  • Better Security: Control who can access what
  • Better Performance: Less traffic in each subnet
  • Easier Management: Simpler to troubleshoot problems

📐 How Subnetting Works

The Magic of Borrowing Bits:

Every IP address has 32 bits. Some bits identify the network, and some identify the device (host).

Example with /24 network:

24 bits for network

8 bits for hosts (256 addresses)


If we "borrow" 2 bits:

26 bits for network (24 + 2)

6 bits for hosts (64 addresses each)

• Creates 4 subnets (2² = 4)

🎯 Two Ways to Calculate

Method 1: Know How Many Subnets

Use this when: You know you need 4 departments, 8 branches, etc.

Example:

"I need 4 subnets for my 4 departments"

Formula: 2ⁿ ≥ 4 (where n = bits to borrow)

Answer: Borrow 2 bits (2² = 4 subnets)

Method 2: Know How Many Hosts

Use this when: You know each subnet needs 30 devices, 50 computers, etc.

Example:

"Each subnet needs 30 computers"

Formula: 2ⁿ - 2 ≥ 30 (where n = host bits)

Answer: Need 5 host bits (2⁵ - 2 = 30 usable hosts)

💡 Important Formulas

Number of Subnets:

Subnets = 2borrowed bits

Example: 2² = 4 subnets

Hosts Per Subnet:

Hosts = 2host bits - 2

Example: 2⁶ - 2 = 62 usable hosts

New CIDR:

New CIDR = Old CIDR + Borrowed Bits

Example: /24 + 2 = /26

Block Size:

Block Size = 256 - Last Octet of Subnet Mask

Example: 256 - 192 = 64

❓ Common Questions

Why do we subtract 2 from hosts?

Two addresses in each subnet are reserved:

  • Network Address: Identifies the subnet itself
  • Broadcast Address: Used to send to all devices

What if I need 5 subnets but 2² only gives 4?

Always round UP! Use 2³ = 8 subnets. You'll have 3 extra subnets you can use later or leave unused.

Can I subnet a subnet?

Yes! You can keep dividing subnets into smaller subnets. Just make sure you don't run out of addresses.