Practical Networking .net
post

Classful vs CIDR vs FLSM vs VLSM

These four terms all refer to somewhat overlapping concepts. As a result, some confusion has surfaced about what each of these terms actually mean, and how they differ from each other. That is what this article is going to pick apart.

These four terms can be broken up into two sets of two terms:

  • Classful and CIDR — these have to do with the size of networks as they are assigned from IANA.
  • FLSM and VLSM — these have to do with how you allocate your IP space within your networks.

Classful vs CIDR

classful cidr flsm vlsm - IANA and the RIRsIANA, or the Internet Assigned Numbers Authority, is responsible for allocating the entire IP address space to any entity that needs a presence on the Internet (0.0.0.0 – 255.255.255.255).

IANA has delegated this responsibility to five Regional Internet Registries (RIRs): ARIN, RIPE, LACNIC, AFRINIC, APNIC, which in turn allocate address space to the various corporations in their regions.

There are two strategies the RIRs use to allocate IP address space: the legacy strategy called Classful addressing, and the current strategy of Classless addressing (known as Classless Inter-Domain Routing, or CIDR).

Classful

Classful addressing is how the early Internet was formed. IP assignments were given on the Octet boundaries:

classful cidr flsm vlsm - Classful IP addresses table

The idea behind Classful address assignments was, if you were a company that …

  • … needed 200 IP addresses, a /24 IP address block from the Class C range would be assigned.
  • … needed 50,000 IP addresses, a /16 IP address block from the Class B range would be assigned.
  • … needed over 65,000~ IP addresses, a /8 IP address block from the Class A range would be assigned.

However, this led to a lot of wasted IP addresses. If, for instance, you only needed 300 IP addresses, a Class C would not suffice, so you would end up with a Class B and nearly 60,000 IP addresses would be wasted.

You could argue, why not simply assign two /24 blocks from the Class C range (providing 512 IP addresses)? Good point, and this frequently was done. But what if you needed 25,000 IP addresses? That would require 98 different /24 blocks from the Class C range. Instead, a single Class B was assigned — which still meant about 40,000 IP addresses were wasted.

Classful addressing evolved into what we know of as Classless Inter-Domain Routing, or CIDR.

CIDR

With Classless Inter-Domain Routing (CIDR), IP assignments are not limited to the three classes. The whole unicast range (any IP address with a first octet of 0223) can be allocated in any size block. In effect, the whole concept of IP address classes is done away with entirely.

Instead of requiring the IP assignment from the RIRs to be either a 255.0.0.0 or 255.255.0.0 or 255.255.255.0 block, they could be any size — and for simplicity, slash notation was adopted.

  • If you need 300 IP addresses … You get a /23.
  • If you need 500 IP addresses … You also get a /23.
  • If you need 1000 IP addresses … You get a /22.
  • If you need 25,000 IP addresses … You get a /17.
  • If you need 70,000 IP addresses … You get a /15.
  • If you need 250,000 IP addresses … You get a /14 (instead of the ~16 million IP addresses from the /8 block that would have been assigned in the Classful world).

This creates a system in which IP address ranges are assigned with a much, much smaller rate of wasted IP addresses.

CIDR address assignment was ratified in RFC 1518, back in September of 1993. Making it the ubiquitous standard for the last 26 years (if you’re reading this in 2019).

The concept of Classful address assignment is useful to know from a historical perspective. But in reality, nowhere in the world is Classful addressing still employed.

The rare exception, however, is certain archaic protocols or devices which operate “classfully”. This means they assume a mask based upon the IP address, according to the IP address’s class. For example, if a classful protocol or device is given the IP address 199.22.33.4 — the first octet is 199, which means this is a Class C address, and the Subnet Mask is assumed to be 255.255.255.0.

FLSM and VLSM

That brings us to Fixed Length Subnet Masks (FLSM) and Variable Length Subnet Masks (VLSM). FLSM and VLSM refer to how IP address space is assigned within each organization. By comparison, the terms we described above (Classful and CIDR) refer to how IP address space is allocated from IANA/RIRs.

We will demonstrate how FLSM and VLSM work using this topology, and the listed number of IP addresses required for each subnet:

classful cidr flsm vlsm - network topology

FLSM

Fixed Length Subnet Mask (FLSM) refers to a strategy where every one of your networks within your infrastructure is the same size.

Whether you received a classful assignment or a classless assignment from your RIR, you can deploy the IP addresses in a Fixed Length manner. For example:

You are assigned by your RIR this /24:  9.9.9.0 /24 . Since the biggest segment of your networks requires 30 IP addresses, the smallest size subnet you can utilize is a /27, which contains 32 total IP addresses and 30 usable IP addresses.

In the FLSM world, every Subnet in your topology must be the same size. Which means if one Subnet needs to be a /27, then all Subnets need to be a /27:

classful cidr flsm vlsm - network topology with FLSM assignment

In this particular topology, a total of 91 IP addresses is required, but the entire /24 (256 IP addresses) was allocated, leaving no additional room for expansion. This is a very inefficient utilization of the assigned IP address space.

The question remains though, if this was such an inefficient method of allocating IP address space, why did it ever exist? The reason: To save bits on the wire.

The early, early routing protocols (i.g., RIPv1 and its predecessors) saved bits on the wire by not included the subnet mask in advertisements — the subnet mask for all advertised networks was assumed to be the same mask assigned to the receiving interface.

That means the original iteration of RIP only needs to send: 9.9.9.0 , 9.9.9.32 , 9.9.9.64 , etc. Instead of: 9.9.9.0 255.255.255.224 , 9.9.9.32 255.255.255.224 , 9.9.9.64 255.255.255.224 , etc.

RIPv1’s behavior can be seen in this post I made on Reddit: What RIP Advertises – definitive proof.

In today’s high capacity networks, saving these few bits is entirely inconsequential, but there was a time in the early history of building computer networks (1960s, 1970s), where transmitting bits was comparatively expensive.

The key point being:  FLSM is not the same thing as Classful assignments. FLSM is simply using one size subnet mask on all the router interfaces, for all the routers in your topology.

Whether the IP address space you received from IANA/RIRs was a Classful or Classless assignment is irrelevant to FLSM.

VLSM

As we can see in the example above, FLSM leads to many wasted IP addresses. The evolution from FLSM is what brought us to VLSM, or Variable Length Subnet Mask.

classful cidr flsm vlsm - network topology with VLSM assignment

If FLSM is a subnet deployment strategy that requires all subnet masks to be the same size, then VLSM is a subnet deployment strategy that allows all subnet masks to be variable sizes.

The same IP assignment example above can be redone much more efficiently using VLSM.

Notice, we still required 91 host IP addresses, but we were able to accommodate that by only assigning 116 IP addresses, leaving another 140 IP addresses in our /24 to expand and scale this topology.

Granted, VLSM is not perfect — it doesn’t prevent all wasting of IP addresses, but it is a significant improvement over FLSM. VLSM is also the defacto standard for how every network is designed today.

Summary

To summarize:

  • Classful addressing is IANA/RIRs assigning IP space from Class A, B, or C blocks (legacy).
  • Classless or CIDR is IANA/RIRs assigning IP space in any size block, as required (modern standard).
  • FLSM mandates that every IP subnet within your deployment be the same size (legacy).
  • VLSM allows any IP subnet within your deployment to be any size (modern standard).

Hopefully now you understand of the individual definitions for each of these terms.

This blog post is the formalized version of an informal writeup I made on the CCNA Sub-Reddit a few years ago.

Speak Your Mind

*