Subnet Masking Methods: Classful, FLSM, VLSM, CIDR and Supernetting

A subnet mask separates the network part of an IP address from the host part.

Jul 23, 2025 - 17:07
Updated: 
102.5k

Networking in IT Infrastructure · Explainer

Subnet Masking Methods: Classful, FLSM, VLSM, CIDR and Supernetting

Quick answer: A subnet mask separates the network part of an IP address from the host part. The main methods are classful masking (fixed /8, /16 and /24 masks by address class, now obsolete), fixed-length subnet masking (FLSM, where every subnet is the same size), variable-length subnet masking (VLSM, where each subnet is sized to its needs), and CIDR (classless prefixes such as /22 used on the internet today), which also allows supernetting or route summarisation. Related tools include wildcard masks in Cisco ACLs and special prefixes such as /31 for point-to-point links.

Key takeaways

  • A mask of /24 means the first 24 bits identify the network, leaving 8 bits for hosts.
  • Usable hosts in an IPv4 subnet = 2^(host bits) minus 2, except /31 and /32.
  • VLSM saves addresses by sizing each subnet to its host count.
  • CIDR replaced classful addressing in 1993; RFC 4632 is the current reference.
  • Summarisation combines contiguous subnets into one route to shrink routing tables.

Table of Contents

How Does a Subnet Mask Work?

A device ANDs its IP address with the mask to find its network address, then compares that with a destination's network to decide whether to send directly or via the router.

PrefixMaskAddressesUsable hosts
/24255.255.255.0256254
/25255.255.255.128128126
/26255.255.255.1926462
/27255.255.255.2243230
/28255.255.255.2401614
/30255.255.255.25242

The first address is the network address and the last is the broadcast address, which is why two are subtracted. For basics, see what is subnetting.

What Is Classful Masking?

Early IPv4 assigned masks by the first bits of the address: Class A (1 to 126) used /8, Class B (128 to 191) /16 and Class C (192 to 223) /24. This wasted addresses: an organisation needing 500 hosts got a Class B with 65,534. RFC 950 introduced subnetting inside these classes. Classful addressing is obsolete but still appears in exams and old documentation.

What Is FLSM?

Fixed-length subnet masking divides a network into equal subnets. Splitting 192.168.10.0/24 into four gives four /26 subnets of 62 usable hosts each. It is simple but wasteful when subnets need very different sizes.

What Is VLSM, With an Example?

Variable-length subnet masking assigns different prefix lengths within one block (RFC 1878 tabulates the sizes). Allocate the largest subnets first. Requirements from 192.168.10.0/24: Sales 100 hosts, Engineering 50, Admin 20, and two router links of 2 hosts.

SubnetHosts neededPrefixNetworkUsable range
Sales100/25192.168.10.0.1 to .126
Engineering50/26192.168.10.128.129 to .190
Admin20/27192.168.10.192.193 to .222
Link 12/30192.168.10.224.225 to .226
Link 22/30192.168.10.228.229 to .230

The range 192.168.10.232 to .255 remains free for growth.

What Are CIDR and Supernetting?

Classless Inter-Domain Routing (RFC 4632) allows any prefix length and lets routers advertise one summary route for several contiguous networks. Four /24 networks, 10.1.0.0 to 10.1.3.0, can be summarised as 10.1.0.0/22. This "supernetting" keeps internet and enterprise routing tables smaller. Summaries must cover only addresses you actually route, or traffic may be black-holed.

What Are Wildcard Masks, /31 and /32?

  • Wildcard mask: the inverse of a subnet mask, used in Cisco ACLs and OSPF. 0.0.0.255 matches any value in the last octet. Example: access-list 10 permit 192.168.10.0 0.0.0.255.
  • /31: two addresses with no network or broadcast address, allowed on point-to-point links by RFC 3021.
  • /32: a single host, used for loopbacks and host routes.

How Do You Check Your Calculations?

Python's standard ipaddress module confirms subnet maths:

import ipaddress

net = ipaddress.ip_network("192.168.10.0/24")
for sub in net.subnets(new_prefix=26):          # FLSM: four /26
    print(sub, sub.netmask, sub.num_addresses - 2, "hosts")

# VLSM check: is an address inside the Engineering subnet?
eng = ipaddress.ip_network("192.168.10.128/26")
print(ipaddress.ip_address("192.168.10.150") in eng)     # True

# Summarise contiguous networks (supernetting)
nets = [ipaddress.ip_network(f"10.1.{i}.0/24") for i in range(4)]
print(list(ipaddress.collapse_addresses(nets)))         # [IPv4Network('10.1.0.0/22')]

On Linux, ipcalc 192.168.10.128/26 gives the same information.

How Does This Work in IPv6?

IPv6 uses prefix lengths only, with no masks in dotted form and no broadcast addresses. A /64 is the standard size for a LAN subnet; organisations typically receive a /48 or /56 and divide it into /64s. Private IPv4 ranges for practice are listed in RFC 1918. Related: types of computer networks. WebAsha's CCNA training includes subnetting drills.

References

Frequently Asked Questions

A value that marks which bits of an IP address are the network part and which are the host part.

FLSM makes every subnet the same size; VLSM sizes each subnet to its needs, saving addresses.

Classless Inter-Domain Routing, which allows any prefix length and route summarisation, defined in RFC 4632.

64 addresses, of which 62 are usable hosts.

Combining contiguous networks into one larger summary route, such as four /24s into a /22.

The inverse of a subnet mask, used in Cisco ACLs and OSPF to match address ranges.

RFC 3021 permits /31 because two-address links need no network or broadcast address.

It uses prefix lengths instead, with /64 standard for LAN subnets.

What's Your Reaction?

Like Like 0
Dislike Dislike 0
Love Love 0
Funny Funny 0
Wow Wow 0
Sad Sad 0
Angry Angry 0
Vaishnavi

Vaishnavi is a skilled tech professional at the Ethical Hacking Training Institute in Pune, responsible for managing and optimizing the technical infrastructure that supports advanced cybersecurity education. With deep expertise in network security, backend operations, and system performance, she ensures that practical labs, online modules, and assessments run smoothly and securely. Her behind-the-scenes contributions play a vital role in delivering a seamless and secure learning experience for aspiring ethical hackers.