What is Subnetting? Download Subnetting App

 https://www.whatismyip.com/subnet-calculator/

What is Subnetting?

Subnetting is the process of dividing one large network into multiple smaller networks (subnets).

Think of it like dividing a large apartment building into separate flats. Each flat has its own occupants, but all belong to the same building.

Why Use Subnetting?

✅ Reduces network congestion

✅ Improves security

✅ Makes network management easier

✅ Conserves IP addresses


Example

Suppose you have the network:

192.168.1.0/24

The /24 means:

255.255.255.0255.255.255.0

  • Total IP addresses = 256
  • Usable IP addresses = 254

Range:

  • Network Address: 192.168.1.0
  • First Host: 192.168.1.1
  • Last Host: 192.168.1.254
  • Broadcast Address: 192.168.1.255

Requirement

Suppose you need 4 separate departments:

  1. HR
  2. Finance
  3. Sales
  4. IT

We need 4 subnets.

To create 4 subnets, borrow 2 bits from the host portion:

/24 → /26

Subnet mask becomes:

255.255.255.192255.255.255.192


Resulting Subnets

SubnetNetwork AddressHost RangeBroadcast
1192.168.1.0/26192.168.1.1 - 192.168.1.62192.168.1.63
2192.168.1.64/26192.168.1.65 - 192.168.1.126192.168.1.127
3192.168.1.128/26192.168.1.129 - 192.168.1.190192.168.1.191
4192.168.1.192/26192.168.1.193 - 192.168.1.254192.168.1.255

How We Calculated It

Subnet mask:

255.255.255.192

Interesting octet = 192

Block Size:

256 − 192 = 64

Therefore networks start at:

  • 0
  • 64
  • 128
  • 192

Quick Formula

Number of Subnets

2n2^n

where n = borrowed bits

Example:

Borrow 2 bits:

2² = 4 subnets


Hosts per Subnet

2h22^h-2

where h = host bits remaining

For /26:

  • Host bits = 6
  • Hosts = 2⁶ − 2 = 62

Real-World Example

A company has:

  • HR → 50 devices
  • Finance → 40 devices
  • Sales → 35 devices
  • IT → 25 devices

Using 192.168.1.0/24, subnetting into four /26 networks gives each department up to 62 usable IP addresses, keeping traffic organized and reducing broadcasts.

Interview Answer (Short)

Subnetting is the process of dividing a larger IP network into smaller logical networks by borrowing bits from the host portion of an IP address. For example, a 192.168.1.0/24 network can be divided into four /26 subnets, each supporting 62 usable hosts. This improves network performance, security, and IP address utilization.


Subnet Calculations Made Simple

Let's take a common example:

Network: 192.168.1.0/24


Step 1: Understand the /24

IP Address:

192.168.1.0

Subnet Mask:

255.255.255.0

Binary:

11111111.11111111.11111111.00000000

A /24 means:

  • 24 bits = Network bits
  • 8 bits = Host bits

So:

NNNNNNNN.NNNNNNNN.NNNNNNNN.HHHHHHHH

Step 2: Find Total Hosts

Formula:

2h22^h-2

where h = host bits

For /24:

Host bits = 8

Calculation:

2⁸ - 2
= 256 - 2
= 254

Why minus 2?

  • One IP = Network Address
  • One IP = Broadcast Address

Usable Hosts = 254


Step 3: Need 4 Subnets

We need:

  • HR
  • Finance
  • Sales
  • IT

Total = 4 subnets

Formula:

2n2^n

where n = borrowed bits

Find n:

2² = 4

Borrow 2 bits.


Step 4: New Prefix

Original:

/24

Borrow 2 bits:

24 + 2 = /26

New network:

192.168.1.0/26

Step 5: Find New Subnet Mask

Binary:

11111111.11111111.11111111.11000000

Decimal:

255.255.255.192

So:

255.255.255.192255.255.255.192


Step 6: Calculate Block Size

Look at the last interesting octet:

192

Formula:

256 - 192 = 64

Block Size = 64

This means each subnet starts every 64 addresses.


Step 7: Create Subnets

Start counting by 64:

0
64
128
192

Subnet 1

Network:

192.168.1.0

Next subnet starts at 64.

Therefore:

Broadcast = 63

Range:

192.168.1.1 - 192.168.1.62

Subnet 2

Network:

192.168.1.64

Next subnet:

128

Broadcast:

127

Hosts:

65 - 126

Subnet 3

Network:

192.168.1.128

Broadcast:

191

Hosts:

129 - 190

Subnet 4

Network:

192.168.1.192

Broadcast:

255

Hosts:

193 - 254

Easy Trick for Any Subnet

Suppose subnet mask is:

255.255.255.224

Block Size:

256 - 224
= 32

Subnets:

0
32
64
96
128
160
192
224

Network IDs are these numbers.

Broadcast is always:

Next Network - 1

Example:

Network = 192.168.1.32
Next Network = 192.168.1.64

Broadcast = 192.168.1.63

Common CIDR Values

CIDRSubnet MaskUsable Hosts
/24255.255.255.0254
/25255.255.255.128126
/26255.255.255.19262
/27255.255.255.22430
/28255.255.255.24014
/29255.255.255.2486
/30255.255.255.2522

Interview Example

Question: Find the subnet details for 192.168.10.0/27.

  1. Subnet Mask = 255.255.255.224
  2. Block Size = 256 − 224 = 32
  3. Networks:
    • 0
    • 32
    • 64
    • 96
    • 128
    • 160
    • 192
    • 224
  4. Usable Hosts:

252=302^5-2=30

Each subnet supports 30 hosts.

The key pattern to remember is:

Subnet Mask → Block Size → Network IDs → Broadcast → Host Range




192.168.123.0/27

The prefix /27 means 27 bits are used for the network and 5 bits are left for hosts.

Step 1: Write the subnet mask in binary

11111111.11111111.11111111.11100000

Step 2: Convert to decimal

11111111 = 255
11111111 = 255
11111111 = 255
11100000 = 224

✅ Subnet Mask

255.255.255.224

Quick Calculation

PrefixSubnet Mask
/24255.255.255.0
/25255.255.255.128
/26255.255.255.192
/27255.255.255.224
/28255.255.255.240
/29255.255.255.248
/30255.255.255.252

Bonus (Useful for CCNA)

For 192.168.123.0/27:

  • Network Address: 192.168.123.0
  • Subnet Mask: 255.255.255.224
  • Usable Host Range: 192.168.123.1 – 192.168.123.30
  • Broadcast Address: 192.168.123.31
  • Total Addresses: 32
  • Usable Hosts: 30

Comments

Popular posts from this blog

🖧 VLAN (Virtual Local Area Network)

🌐 NAT (Network Address Translation)

🛰️ OSPF (Open Shortest Path First)