Computer Networks Essentials / Network Layer

Subnetting

πŸ€” What is Subnetting? (Basic Idea)

Subnetting means dividing one large network into multiple smaller networks, called subnets.

πŸ“Œ In simple words:

Subnetting breaks a big network into smaller, manageable pieces.


🧠 Real-Life Analogy

🏒 Apartment Building Example

  • One big building = One network

  • Each floor = One subnet

  • Each flat = One host

πŸ‘‰ Easier to manage, secure, and organize.


🧠 Simple Definition

πŸ“Œ Subnetting is the process of dividing a single IP network into multiple smaller logical networks by borrowing bits from the host portion.


🎯 Why Do We Need Subnetting?

Subnetting is needed to:

  • πŸ’° Reduce IP address wastage

  • πŸš€ Improve network performance

  • πŸ” Increase security

  • πŸ“¦ Control broadcast traffic

  • 🧠 Make network management easier


🧭 Where Does Subnetting Work?

  • Performed at the Network Layer

  • Uses IP address + Subnet Mask


🧩 Key Concept: Subnet Mask

πŸ”Ή What is a Subnet Mask?

A Subnet Mask tells:

  • Which part of IP is Network

  • Which part is Host

πŸ“Œ Example:

IP Address :192.168.1.10
Subnet Mask:255.255.255.0

πŸ”’ Binary View (Very Important)

Subnet Mask: 255.255.255.0

Binary:

11111111.11111111.11111111.00000000

πŸ“Œ

  • 1 β†’ Network bit

  • 0 β†’ Host bit


🧠 Default Subnet Masks (Must Remember)

Class

Default Mask

A

255.0.0.0

B

255.255.0.0

C

255.255.255.0


πŸ”‘ Golden Rule of Subnetting

πŸ‘‰ Subnetting borrows bits from the HOST portion to create more NETWORKS.


πŸͺœ Subnetting Step-by-Step

We always answer subnetting questions using these steps:

βœ… Step 1: Identify the Class

Example IP: 192.168.1.0

  • First octet = 192

  • πŸ‘‰ Class C

βœ… Step 2: Note Default Subnet Mask

Class C default mask:

255.255.255.0  β†’  /24

βœ… Step 3: Determine Requirement

Question may ask:

  • Number of subnets

  • Number of hosts per subnet

πŸ“Œ Example:

Create 4 subnets

βœ… Step 4: Borrow Bits

Formula:

Numberofsubnets=2ⁿ

To create 4 subnets:

2Β² = 4

πŸ‘‰ Borrow 2 bits from host portion.

βœ… Step 5: New Subnet Mask

Original mask: /24

Borrow 2 bits β†’ New mask = /26

Subnet Mask:

255.255.255.192

Binary:

11111111.11111111.11111111.11000000

βœ… Step 6: Calculate Hosts per Subnet

Formula:

Hostspersubnet=2Κ° βˆ’2

Remaining host bits = 6

2⁢ βˆ’ 2 = 62 hosts

πŸ“¦ Subnet Address Calculation

IP: 192.168.1.0/26

Block size:

256 βˆ’ 192 = 64

πŸ“Š Subnet Table

Subnet No

Network

First Host

Last Host

Broadcast

1

192.168.1.0

.1

.62

.63

2

192.168.1.64

.65

.126

.127

3

192.168.1.128

.129

.190

.191

4

192.168.1.192

.193

.254

.255


🧠 Important Subnetting Formulas

Purpose

Formula

Subnets

2ⁿ

Hosts per subnet

2Κ° βˆ’ 2

Block size

256 βˆ’ subnet mask octet


  • Efficient IP utilization

  • Reduced broadcast traffic

  • Better performance

  • Enhanced security

  • Easy fault isolation

  • More planning required

  • Slightly complex for beginners

  • Configuration mistakes can cause issues


🧠 Subnetting vs Supernetting (Preview)

Subnetting

Supernetting

Divide network

Combine networks

Borrow host bits

Borrow network bits

More networks

Fewer networks

πŸ“Œ Supernetting is coming next πŸ˜‰

🧠 Subnetting with Diagram (Conceptual View)


🧠 Memory Trick (Very Useful)

/24 β†’ 256 hosts
/25 β†’ 128
/26 β†’ 64
/27 β†’ 32
/28 β†’ 16
/29 β†’ 8
/30 β†’ 4

⭐ One-Line Summary

πŸ”Ή Subnetting divides a large IP network into smaller, efficient, and manageable sub-networks by borrowing host bits.