Tutorials Logic, IN +91 8092939553 info@tutorialslogic.com
FAQs Support
Navigation
Home About Us Contact Us Blogs FAQs
Tutorials
All Tutorials
Services
Academic Projects Resume Writing Interview Questions Website Development
Compiler Tutorials

Subnetting

Why Subnetting?

Subnetting is the process of dividing a large network into smaller, more manageable sub-networks (subnets). Benefits include:

  • Reduces network congestion (smaller broadcast domains)
  • Improves security (isolate network segments)
  • Efficient use of IP address space
  • Easier network management and troubleshooting

Subnet Mask and CIDR Notation

A subnet mask is a 32-bit number that separates the network portion from the host portion of an IP address. It uses 1s for the network bits and 0s for the host bits.

CIDR (Classless Inter-Domain Routing) notation expresses the subnet mask as a prefix length (number of 1 bits).

CIDRSubnet MaskNetwork BitsHost BitsUsable Hosts
/8255.0.0.082416,777,214
/16255.255.0.0161665,534
/24255.255.255.0248254
/25255.255.255.128257126
/26255.255.255.19226662
/27255.255.255.22427530
/28255.255.255.24028414
/29255.255.255.2482936
/30255.255.255.2523022

Formula: Usable hosts = 2n - 2, where n = number of host bits. We subtract 2 for the network address and broadcast address.

Subnetting Example: /24 Network

Given network: 192.168.1.0/24

  • Network Address: 192.168.1.0 (all host bits = 0)
  • Broadcast Address: 192.168.1.255 (all host bits = 1)
  • Usable Host Range: 192.168.1.1 – 192.168.1.254
  • Number of Usable Hosts: 28 - 2 = 254

Dividing /24 into Subnets

Divide 192.168.1.0/24 into 4 equal subnets (/26):

SubnetNetwork AddressBroadcastHost RangeHosts
1192.168.1.0/26192.168.1.63192.168.1.1 – .6262
2192.168.1.64/26192.168.1.127192.168.1.65 – .12662
3192.168.1.128/26192.168.1.191192.168.1.129 – .19062
4192.168.1.192/26192.168.1.255192.168.1.193 – .25462

VLSM (Variable Length Subnet Masking)

VLSM allows using different subnet masks for different subnets within the same network, enabling more efficient use of IP addresses. Instead of dividing a network into equal-sized subnets, you allocate exactly the right size for each subnet.

Example: You have 192.168.1.0/24 and need:

  • Subnet A: 100 hosts → use /25 (126 hosts) → 192.168.1.0/25
  • Subnet B: 50 hosts → use /26 (62 hosts) → 192.168.1.128/26
  • Subnet C: 25 hosts → use /27 (30 hosts) → 192.168.1.192/27
  • Subnet D: 10 hosts → use /28 (14 hosts) → 192.168.1.224/28

Ready to Level Up Your Skills?

Explore 500+ free tutorials across 20+ languages and frameworks.