Pick a color scheme
ad placeholder image ad placeholder image

IPv4 Subnetting: Complete Guide to Network Division

Subnetting is the practice of dividing a network into smaller, more manageable sub-networks (subnets). Understanding subnetting is essential for network design, IP address management, and efficient use of address space. This comprehensive guide explains everything you need to know about IPv4 subnetting.

What is Subnetting?

Subnetting is the process of taking a large network and dividing it into multiple smaller networks. Each subnet functions as a separate network segment with its own network address, broadcast address, and range of usable host addresses.

Why Subnet?

Efficient IP address usage: - Allocate appropriate network sizes - Reduce wasted addresses - Better address management - Optimize address space

Improved network performance: - Smaller broadcast domains - Reduced network congestion - Better traffic management - Faster routing

Enhanced security: - Network segmentation - Isolate departments - Control traffic flow - Implement security policies

Better organization: - Logical network structure - Department separation - Geographic distribution - Easier management

Subnetting Basics

Network Components

Every subnet has:

Network Address: First address (all host bits 0)
Usable Host Range: Addresses between network and broadcast
Broadcast Address: Last address (all host bits 1)
Subnet Mask: Defines network/host boundary

Learn more about subnet masks, broadcast addresses, and CIDR notation.

Example: 192.168.1.0/24

Network: 192.168.1.0
First usable: 192.168.1.1
Last usable: 192.168.1.254
Broadcast: 192.168.1.255
Subnet mask: 255.255.255.0
Total addresses: 256
Usable hosts: 254

Subnet Mask

Purpose: Defines which bits are network vs host

Binary representation:

255.255.255.0 = 11111111.11111111.11111111.00000000
                └──────────────────────────┘ └──────┘
                    Network (24 bits)        Host (8)

CIDR notation: /24 (24 network bits)

Borrowing Bits

Subnetting = borrowing host bits for network:

Original network: 192.168.1.0/24

Network bits: 24
Host bits: 8
Networks: 1
Hosts per network: 254

After borrowing 2 bits: 192.168.1.0/26

Network bits: 26 (24 + 2 borrowed)
Host bits: 6 (8 - 2 borrowed)
Networks: 4 (2^2)
Hosts per network: 62 (2^6 - 2)

Subnetting Formulas

Key Calculations

Number of subnets:

Subnets = 2^(borrowed bits)

Hosts per subnet:

Hosts = 2^(host bits) - 2
(Subtract 2 for network and broadcast addresses)

Subnet size (block size):

Block size = 2^(host bits)

Network increment:

Increment = 256 - subnet mask octet

Example Calculations

Subnet 192.168.1.0/24 into /26:

Borrowed bits: 2 (26 - 24 = 2) Subnets: 2^2 = 4 subnets Host bits: 6 (32 - 26 = 6) Hosts per subnet: 2^6 - 2 = 62 hosts Block size: 2^6 = 64 addresses per subnet

Subnetting Methods

Method 1: Binary Method

Most accurate, shows exactly what's happening

Example: Subnet 192.168.1.0/24 into 4 subnets

Step 1: Determine new mask

Need 4 subnets: 2^2 = 4
Borrow 2 bits
New mask: /26 (24 + 2)

Step 2: Calculate in binary

Original: 192.168.1.00000000 /24
          └─────────┘└──────┘
           Network    Host

New:      192.168.1.00|000000 /26
          └─────────┘└┘└────┘
           Network   Sub Host

Subnet bits: 00, 01, 10, 11

Step 3: List subnets

Subnet 0: 192.168.1.00000000 = 192.168.1.0/26
Subnet 1: 192.168.1.01000000 = 192.168.1.64/26
Subnet 2: 192.168.1.10000000 = 192.168.1.128/26
Subnet 3: 192.168.1.11000000 = 192.168.1.192/26

Method 2: Chart Method

Quick reference using memorized values

Subnet chart:

/24 = 255.255.255.0   = 256 addresses, 254 hosts
/25 = 255.255.255.128 = 128 addresses, 126 hosts
/26 = 255.255.255.192 = 64 addresses, 62 hosts
/27 = 255.255.255.224 = 32 addresses, 30 hosts
/28 = 255.255.255.240 = 16 addresses, 14 hosts
/29 = 255.255.255.248 = 8 addresses, 6 hosts
/30 = 255.255.255.252 = 4 addresses, 2 hosts

Example: Need 30 hosts per subnet

Look up: /27 provides 30 hosts
Use: /27 subnet mask

Method 3: Magic Number Method

Fast calculation using subnet mask

Example: 192.168.1.0/26

Step 1: Find magic number

Subnet mask: 255.255.255.192
Magic number: 256 - 192 = 64
(This is the block size)

Step 2: Count by magic number

Start at 0, count by 64:
0, 64, 128, 192, (256)

Subnets:
192.168.1.0/26
192.168.1.64/26
192.168.1.128/26
192.168.1.192/26

Step 3: Determine ranges

Subnet 1: 192.168.1.0 - 192.168.1.63
Subnet 2: 192.168.1.64 - 192.168.1.127
Subnet 3: 192.168.1.128 - 192.168.1.191
Subnet 4: 192.168.1.192 - 192.168.1.255

Practical Subnetting Examples

Example 1: Small Office

Requirement: 4 departments, 50 hosts each

Solution:

Step 1: Determine hosts needed

50 hosts per subnet
Need: 2^n - 2 ≥ 50
2^6 - 2 = 62 hosts ✓
Host bits: 6

Step 2: Calculate subnet mask

32 - 6 = 26 network bits
Subnet mask: /26 (255.255.255.192)

Step 3: Verify subnets

Borrowed bits: 2 (from /24 to /26)
Subnets: 2^2 = 4 ✓

Step 4: Allocate subnets

Sales: 192.168.1.0/26 (192.168.1.1 - 192.168.1.62)
Engineering: 192.168.1.64/26 (192.168.1.65 - 192.168.1.126)
HR: 192.168.1.128/26 (192.168.1.129 - 192.168.1.190)
IT: 192.168.1.192/26 (192.168.1.193 - 192.168.1.254)

Example 2: Point-to-Point Links

Requirement: 10 router-to-router connections

Solution:

Step 1: Hosts needed

Point-to-point: 2 hosts
2^2 - 2 = 2 hosts ✓
Host bits: 2

Step 2: Subnet mask

32 - 2 = 30 network bits
Subnet mask: /30 (255.255.255.252)

Step 3: Subnets available

From /24: Borrow 6 bits
Subnets: 2^6 = 64 subnets ✓ (need 10)

Step 4: Allocate

Link 1: 192.168.1.0/30 (192.168.1.1 - 192.168.1.2)
Link 2: 192.168.1.4/30 (192.168.1.5 - 192.168.1.6)
Link 3: 192.168.1.8/30 (192.168.1.9 - 192.168.1.10)
...
Link 10: 192.168.1.36/30 (192.168.1.37 - 192.168.1.38)

Example 3: Variable Requirements

Requirement: - Department A: 100 hosts - Department B: 50 hosts - Department C: 25 hosts - Department D: 10 hosts

Solution: VLSM (Variable Length Subnet Masking)

Start with largest:

Department A (100 hosts):

Need: 2^7 - 2 = 126 hosts
Subnet: 192.168.1.0/25
Range: 192.168.1.1 - 192.168.1.126

Department B (50 hosts):

Need: 2^6 - 2 = 62 hosts
Subnet: 192.168.1.128/26
Range: 192.168.1.129 - 192.168.1.190

Department C (25 hosts):

Need: 2^5 - 2 = 30 hosts
Subnet: 192.168.1.192/27
Range: 192.168.1.193 - 192.168.1.222

Department D (10 hosts):

Need: 2^4 - 2 = 14 hosts
Subnet: 192.168.1.224/28
Range: 192.168.1.225 - 192.168.1.238

VLSM (Variable Length Subnet Masking)

What is VLSM?

Using different subnet masks within the same network to create subnets of varying sizes.

Without VLSM (wasteful):

All subnets same size
Must use largest requirement
Wastes addresses

With VLSM (efficient):

Each subnet sized appropriately
No wasted addresses
Flexible allocation
Better utilization

VLSM Process

Step 1: List requirements (largest first)

1. 500 hosts
2. 200 hosts
3. 50 hosts
4. 10 hosts

Step 2: Allocate largest first

500 hosts: Need /23 (510 hosts)
Allocate: 10.0.0.0/23

Step 3: Next available space

200 hosts: Need /24 (254 hosts)
Allocate: 10.0.2.0/24

Step 4: Continue for all

50 hosts: Need /26 (62 hosts)
Allocate: 10.0.3.0/26

10 hosts: Need /28 (14 hosts)
Allocate: 10.0.3.64/28

VLSM Best Practices

1. Start with largest subnets - Allocate big blocks first - Prevents fragmentation - Easier to manage

2. Leave room for growth - Don't use all space - Reserve for expansion - Plan ahead

3. Document everything - Record allocations - Note purposes - Track usage

4. Use contiguous blocks - Easier to summarize - Better routing - Cleaner design

Supernetting (Route Aggregation)

What is Supernetting?

Combining multiple networks into a single larger network.

Opposite of subnetting:

Subnetting: Divide large network into smaller
Supernetting: Combine small networks into larger

Example

Individual networks:

192.168.0.0/24
192.168.1.0/24
192.168.2.0/24
192.168.3.0/24

Supernet:

192.168.0.0/22
(Covers all four /24 networks)

Benefits

Routing efficiency: - Fewer routing table entries - Faster lookups - Reduced memory usage - Simplified configuration

Requirements: - Networks must be contiguous - Must be powers of 2 - Must align on boundaries

Subnet Design Best Practices

Planning

1. Assess requirements

- How many subnets needed?
- Hosts per subnet?
- Future growth?
- Special requirements?

2. Choose addressing scheme

- Private vs public
- Address block size
- Subnet strategy
- Naming convention

3. Document design

- Subnet allocations
- IP ranges
- VLANs
- Purposes

Implementation

1. Start with clear boundaries

Use standard sizes when possible
/24, /25, /26, /27, /28, /30
Easier to remember and manage

2. Reserve space

Management networks
Future expansion
Special purposes
Don't allocate 100%

3. Use VLSM efficiently

Right-size each subnet
Minimize waste
Plan for growth
Document thoroughly

Common Subnet Sizes

Memorize these:

/30 = 4 addresses, 2 hosts (point-to-point)
/29 = 8 addresses, 6 hosts (very small)
/28 = 16 addresses, 14 hosts (small)
/27 = 32 addresses, 30 hosts (small)
/26 = 64 addresses, 62 hosts (medium-small)
/25 = 128 addresses, 126 hosts (medium)
/24 = 256 addresses, 254 hosts (standard)
/23 = 512 addresses, 510 hosts (large)
/22 = 1024 addresses, 1022 hosts (very large)

Troubleshooting Subnetting

Common Mistakes

Mistake 1: Wrong subnet mask

Problem: Devices can't communicate
Cause: Incorrect mask configured
Solution: Verify mask matches design

Mistake 2: Overlapping subnets

Problem: IP conflicts, routing issues
Cause: Subnets not properly aligned
Solution: Use VLSM calculator, verify boundaries

Mistake 3: Forgetting network/broadcast

Problem: Assigned unusable addresses
Cause: Used network or broadcast address
Solution: Remember first and last are reserved

Mistake 4: Miscalculating hosts

Problem: Not enough addresses
Cause: Forgot to subtract 2
Solution: Always use 2^n - 2 formula

Verification

Check subnet design:

# Use ipcalc
ipcalc 192.168.1.0/26

# Output shows:
# Network, broadcast, host range
# Verify matches design

Test connectivity:

# Ping devices in subnet
ping 192.168.1.1

# Verify routing
traceroute 192.168.2.1

Subnetting Tools

Online Calculators

Popular tools: - subnet-calculator.com - ipcalc.org - jodies.de/ipcalc - cidr.xyz

Features: - Calculate subnets - Visualize networks - Verify designs - Generate documentation

Command Line

ipcalc (Linux):

ipcalc 192.168.1.0/24 -s 50 50 25 10

# Suggests optimal subnetting

sipcalc:

sipcalc 192.168.1.0/26

# Detailed subnet information

Spreadsheets

Create subnet calculator:

Use formulas for:
- Network address
- Broadcast address
- Host range
- Subnet count

Practice Problems

Problem 1

Given: 172.16.0.0/16 Task: Create 8 equal subnets

Solution:

Need 8 subnets: 2^3 = 8
Borrow 3 bits: /16 + 3 = /19
Subnet mask: 255.255.224.0
Block size: 2^13 = 8192 addresses
Hosts per subnet: 8190

Subnets:
172.16.0.0/19
172.16.32.0/19
172.16.64.0/19
172.16.96.0/19
172.16.128.0/19
172.16.160.0/19
172.16.192.0/19
172.16.224.0/19

Problem 2

Given: 10.0.0.0/8 Task: Subnet for 100 hosts

Solution:

Need 100 hosts: 2^7 - 2 = 126 ✓
Host bits: 7
Network bits: 32 - 7 = 25
Subnet: /25
Mask: 255.255.255.128

Example subnet:
10.0.0.0/25
Range: 10.0.0.1 - 10.0.0.126
Broadcast: 10.0.0.127

Problem 3

Given: 192.168.1.0/24 Task: VLSM for 60, 30, 12, 6 hosts

Solution:

60 hosts: /26 (62 hosts)
Subnet: 192.168.1.0/26

30 hosts: /27 (30 hosts)
Subnet: 192.168.1.64/27

12 hosts: /28 (14 hosts)
Subnet: 192.168.1.96/28

6 hosts: /29 (6 hosts)
Subnet: 192.168.1.112/29

Conclusion

Subnetting is a fundamental skill for network engineers and administrators. It enables efficient use of IP address space, improves network performance through segmentation, and provides better security through isolation. Mastering subnetting requires understanding binary math, memorizing common subnet sizes, and practicing calculations.

Key takeaways: - Subnetting divides networks into smaller subnets - Borrow host bits to create more networks - Formula: Hosts = 2^(host bits) - 2 - VLSM allows different-sized subnets - Always reserve network and broadcast addresses - Plan for future growth - Document all allocations - Use tools to verify designs - Practice makes perfect

Whether you're designing a new network, optimizing an existing one, or preparing for certification exams, understanding subnetting is essential for effective network management and IP address utilization.


Related Articles

Subnetting Fundamentals

IPv4 Addressing

Network Design

  • Default Gateway - Router configuration
  • DHCP - Automatic IP assignment in subnets
  • Routing - Inter-subnet routing
  • NAT - Network Address Translation

Explore More

ad placeholder image ad placeholder image
Three funny piglies - an illustration ippigly.com