DEV Community

Aisalkyn Aidarova
Aisalkyn Aidarova

Posted on

IP address and subletting

🧠 PART 1 β€” What is an IP Address?

An IP address is a unique identifier for a device in a network.

Example:

192.168.1.10
Enter fullscreen mode Exit fullscreen mode

Every IP has 2 parts:

[ NETWORK PART ] [ HOST PART ]
Enter fullscreen mode Exit fullscreen mode

πŸ” PART 2 β€” Network vs Host (MOST IMPORTANT)

Example:

IP: 192.168.1.10
Mask: 255.255.255.0 (/24)
Enter fullscreen mode Exit fullscreen mode

πŸ‘‰ This means:

Network: 192.168.1
Host: .10
Enter fullscreen mode Exit fullscreen mode

🧠 Rule

Subnet mask decides the split.


πŸ“Š PART 3 β€” Subnet Mask Explained (Power Concept)

Example:

255.255.255.0
Enter fullscreen mode Exit fullscreen mode

Binary:

11111111.11111111.11111111.00000000
Enter fullscreen mode Exit fullscreen mode

πŸ‘‰ Count 1s:

24 bits β†’ NETWORK
8 bits β†’ HOST
Enter fullscreen mode Exit fullscreen mode

πŸ”₯ POWER RULE (THIS IS YOUR β€œPOWER 8”)

πŸ‘‰ Number of hosts =

2^(host bits) - 2
Enter fullscreen mode Exit fullscreen mode

Example:

For /24:

Host bits = 8

2^8 = 256
256 - 2 = 254 usable IPs
Enter fullscreen mode Exit fullscreen mode

πŸ’‘ WHY -2?

Because:

  • 1 = Network address
  • 1 = Broadcast address

πŸ“Š QUICK TABLE (VERY IMPORTANT FOR TEACHING)

Subnet Host Bits Total IPs Usable
/24 8 256 254
/25 7 128 126
/26 6 64 62
/27 5 32 30
/28 4 16 14

🧠 PART 4 β€” What is Subnetting?

Subnetting = dividing one network into smaller networks.

Example:

192.168.1.0/24
Enter fullscreen mode Exit fullscreen mode

Split into 2:

192.168.1.0/25
192.168.1.128/25
Enter fullscreen mode Exit fullscreen mode

πŸ”₯ PART 5 β€” HOW SPLITTING WORKS

Example: /24 β†’ /25

Borrow 1 bit
Enter fullscreen mode Exit fullscreen mode

So:

2^1 = 2 subnets
Enter fullscreen mode Exit fullscreen mode

Result:

Subnet Range
192.168.1.0/25 1–126
192.168.1.128/25 129–254

πŸ§ͺ PART 6 β€” LAB (VERY IMPORTANT)

🎯 Goal:

Understand:

  • network vs host
  • subnetting
  • IP allocation

πŸ”§ LAB SETUP

Use ONE network:

192.168.1.0/24
Enter fullscreen mode Exit fullscreen mode

STEP 1 β€” Split into 2 subnets

Subnet mask β†’ /25
Enter fullscreen mode Exit fullscreen mode

Now you have:

Subnet 1:

Network: 192.168.1.0
Range: 192.168.1.1 – 192.168.1.126
Gateway: 192.168.1.126 or .1
Enter fullscreen mode Exit fullscreen mode

Subnet 2:

Network: 192.168.1.128
Range: 192.168.1.129 – 192.168.1.254
Gateway: 192.168.1.254 or .129
Enter fullscreen mode Exit fullscreen mode

STEP 2 β€” Build in Packet Tracer

Devices:

  • 1 Router
  • 2 Switches
  • 4 PCs (2 per subnet)

STEP 3 β€” Assign IPs

Subnet 1:

PC1 β†’ 192.168.1.10
PC2 β†’ 192.168.1.20
Gateway β†’ 192.168.1.1
Mask β†’ 255.255.255.128
Enter fullscreen mode Exit fullscreen mode

Subnet 2:

PC3 β†’ 192.168.1.130
PC4 β†’ 192.168.1.140
Gateway β†’ 192.168.1.129
Mask β†’ 255.255.255.128
Enter fullscreen mode Exit fullscreen mode

STEP 4 β€” Configure Router

enable
configure terminal

interface g0/0
ip address 192.168.1.1 255.255.255.128
no shutdown

interface g0/1
ip address 192.168.1.129 255.255.255.128
no shutdown
end
Enter fullscreen mode Exit fullscreen mode

STEP 5 β€” TEST

Same subnet:

ping 192.168.1.20
Enter fullscreen mode Exit fullscreen mode

βœ” works


Different subnet:

ping 192.168.1.130
Enter fullscreen mode Exit fullscreen mode

βœ” works via router


🧠 PART 7 β€” EXPLAIN LIKE A PRO

πŸ‘‰ You can say:

β€œAn IP address is divided into network and host portions based on the subnet mask. Subnetting allows us to split a large network into smaller networks. For example, a /24 network can be divided into two /25 subnets by borrowing one bit. Each subnet has its own range of usable IP addresses. This improves organization, scalability, and security.”


πŸ”₯ BONUS β€” VISUAL EXPLANATION (VERY POWERFUL)

Think:

/24 = one big apartment building
/25 = two floors
/26 = four floors
Enter fullscreen mode Exit fullscreen mode

Each split:

2^n networks
Enter fullscreen mode Exit fullscreen mode

Top comments (0)