100% Free Forever
AI-Powered Learning
Industry Expert Content
Certificates & Badges
Learn At Your Own Pace

What is Subnetting?

Understand subnetting — dividing networks with CIDR and subnet masks, calculating hosts, and why it improves security and performance.

mediumQ6 of 224 in Computer Networks Est. time: 6 minsLast updated:
Open Code Lab

Expected Interview Answer

Subnetting is the practice of dividing a larger IP network into smaller, logically separated sub-networks (subnets) by borrowing bits from the host portion of an address for the network portion, defined by a subnet mask or CIDR prefix.

A network like 192.168.1.0/24 has 256 addresses; subnetting it into /26 blocks creates four smaller subnets of 64 addresses each, isolating traffic and reducing the size of each broadcast domain. The subnet mask (e.g., 255.255.255.192) tells a device which bits identify the network and which identify the host, so it can decide whether a destination is local or must go through a router. Subnetting improves security by segmenting departments or environments, improves performance by shrinking broadcast domains, and makes efficient use of a limited address block instead of wasting a huge flat network on a small number of hosts. CIDR notation (the /26 suffix) is the modern shorthand for expressing the mask.

  • Isolates broadcast domains for better performance
  • Segments traffic for security (e.g., per department or VLAN)
  • Uses address space efficiently instead of one flat network
  • Simplifies routing by grouping hosts hierarchically

AI Mentor Explanation

Subnetting is like splitting one huge stadium enclosure into separate numbered stands — instead of every fan sharing one giant open area, each stand has its own gate and its own capacity, so an announcement meant for the north stand does not need to blare across the whole ground. A steward at the entrance checks the stand number on a ticket the same way a device checks the network bits of an IP address to see if a packet is local. Splitting one big enclosure into smaller stands is exactly what subnetting does to one big address block.

Step-by-Step Explanation

  1. Step 1

    Start with a block

    Begin with a network like 192.168.1.0/24 with 256 total addresses.

  2. Step 2

    Borrow bits

    Extend the mask (e.g., /24 to /26) to create smaller, separate address ranges.

  3. Step 3

    Assign subnets

    Each /26 subnet (64 addresses) is given to a department, VLAN, or environment.

  4. Step 4

    Route between them

    A router or layer-3 switch forwards traffic between subnets that cannot reach each other directly.

What Interviewer Expects

  • Correct definition: dividing a network using the subnet mask/CIDR prefix
  • Ability to calculate subnet sizes from a prefix length
  • Understanding of broadcast domain and security benefits
  • Knowing routers are needed to communicate between subnets

Common Mistakes

  • Confusing subnetting with simply assigning more IP addresses
  • Miscalculating usable hosts (forgetting network and broadcast addresses)
  • Not knowing CIDR notation maps directly to a subnet mask
  • Assuming devices in different subnets can always talk without a router

Best Answer (HR Friendly)

Subnetting means splitting one big network into smaller, more organized pieces — like dividing one huge office building into separate floors for different teams. It keeps traffic contained, improves performance, and makes it easier to secure and manage each group of devices separately.

Code Example

Calculating and inspecting subnets
# Show subnet details for a CIDR block (requires ipcalc)
ipcalc 192.168.1.0/26
# Address:   192.168.1.0
# Netmask:   255.255.255.192 = 26
# HostMin:   192.168.1.1
# HostMax:   192.168.1.62
# Broadcast: 192.168.1.63

# Check this machine's assigned subnet
ip -4 addr show | grep inet

Follow-up Questions

  • How do you calculate the number of usable hosts in a subnet?
  • What is the difference between a subnet mask and CIDR notation?
  • What is VLSM (Variable Length Subnet Masking)?
  • How does a router decide whether to forward or drop traffic between subnets?

MCQ Practice

1. How many usable host addresses does a /26 subnet have?

A /26 has 64 total addresses; subtracting network and broadcast leaves 62 usable hosts.

2. What does CIDR notation like /24 represent?

/24 means the first 24 bits of the address are the network portion (mask 255.255.255.0).

3. What is the main benefit of subnetting?

Subnetting reduces broadcast domain size and segments traffic for security and performance.

Flash Cards

What is subnetting?Dividing a larger network into smaller sub-networks using the subnet mask/CIDR prefix.

/24 in dotted decimal?255.255.255.0 — 256 total addresses, 254 usable hosts.

Why subnet?Smaller broadcast domains, better security segmentation, efficient address use.

How do subnets communicate?Through a router or layer-3 switch that forwards traffic between them.

1 / 4

Continue Learning