Classless InterDomain Routing (CIDR)

Classful vs Classless Addressing

Classful Addressing

The “classful” IP addressing scheme divides the IP address space into five classes, A through E, of differing sizes. Classes A, B and C are the most important ones.

  • Class A: First octect 0-127 Mask /8
  • Class B: First octect 128-191 Mask /16
  • Class C: First octect 192-223 Mask /24

Determining Address Class From the First Octet

For example, consider Class B.

  • The first two bits of the first octet are “10”. The remaining bits can be any combination of ones and zeroes. This is normally represented as “10xx xxxx”.
  • Thus, the binary range for the first octet can be from “1000 0000” to “1011 1111”. This is 128 to 191 in decimal.
  • So, in the “classful” scheme, any IP address whose first octet is from 128 to 191 (inclusive) is a Class B address.

Note: In the “classful” IP addressing scheme, the class of an IP address is identified by looking at the first one, two, three or four bits of the address.

Classless Addressing (CIDR)

Classless Inter-Domain Routing (CIDR) is a system of IP addressing and routing that solves the many problems of “classful” addressing by eliminating fixed address classes in favor of a flexible, multiple-level, hierarchical structure of networks of varying size.

While classful networks make life simpler, they are not efficient in terms of IP address usage. What if you want a Class C network with only two hosts on it? Well, for that network, you would need to have four IP addresses, that is, two for the hosts, one for the network address, and one for the broadcast address. We would have 252 IP addresses sitting there unused. Admittedly, that does give you scope to grow your network, but it is still not ideal.

CIDR provides us with the means of escaping from default subnet masks, thus allowing us to be more flexible in sizing our networks. Do you only want two hosts? Not a problem – we can create a subnet mask for that. CIDR is based on Variable Length Subnet Masks (VLSMs), which enables network engineers to divide an IP address space into subnets of different sizes, making it possible to create subnetworks with different host counts without wasting large number of addresses. VLSMs offer you the ability to break your network down into smaller networks of various sizes (as opposed to having multiple smaller networks all of the same size). VLSM allow us to create subnets with different sizes.

Classful vs Classless Routing Protocols

The biggest distinction between classful and classless routing protocols is that classful routing protocols do not send subnet mask information in their routing updates. Classless routing protocols include subnet mask information in the routing updates.

The two original IPv4 routing protocols developed were RIPv1 and IGRP. They were created when network addresses were allocated based on classes (class A, B, or C). At that time, a routing protocol did not need to include the subnet mask in the routing update, because the network mask could be determined based on the first octet of the network address.

Classful routing protocols also create problems in discontiguous networks. A discontiguous network is when subnets from the same classful major network address are separated by a different classful network address.


  • Notice that the LANs of R1 ( and R3 ( are both subnets of the same class B network (
  • They are separated by different classful network addresses ( and
  • When R1 forwards an update to R2, RIPv1 does not include the subnet mask information with the update; it only forwards the class B network address

R1 Forwards a Classful Update to R2

  • R2 receives and processes the update. It then creates and adds an entry for the class B network in the routing table.
  • When R3 forwards an update to R2, it also does not include the subnet mask information and therefore only forwards the classful network address
  • R2 receives and processes the update and adds another entry for the classful network address to its routing table.
    • When there are two entries with identical metrics in the routing table, the router shares the load of the traffic equally among the two links. This is known as load balancing.

Two entries with identical metrics

Discontiguous networks have a negative impact on a network. For example, a ping to would return “U.U.U” because R2 would forward the first ping out its Serial 0/0/1 interface toward R3, and R3 would return a Destination Unreachable (U) error code to R2. The second ping would exit out of R2’s Serial 0/0/0 interface toward R1, and R1 would return a successful code (.). This pattern would continue until the ping command is done.


  • Classful routing protocols do not carry subnet masks; classless routing protocols do.
  • Older routing protocols, including RIP and IGRP, are classful. Newer protocols, including RIP-2, EIGRP, and OSPF, are classless.
  • Since RIP-2 updates carry subnet masks, it is possible to associate different subnet masks within a single classful network — in other words, RIP-2 supports VLSM. VLSM, a feature of classless routing protocols.

Understanding CIDR

People who developed this thought it would be enough to have 3 different classes, class A,B and C networks. There were only three subnet masks:

  • Class A: (16.777.216 addresses)
  • Class B: (65.536 addresses)
  • Class C: (256 addresses)

These networks are also known as classful networks.

When the internet started growing rapidly, large companies received entire Class A networks with millions of addresses. Smaller companies could get a Class B network with 65.536 addresses or Class C networks with 256 addresses. Many addresses were wasted so something had to be done.

The solution to this problem is Classless Interdomain Routing, in other words we stop working with the classful networks and start working with classless networks.

Classless networks means we don’t use the class A,B or C networks anymore but are free to use any subnet mask we like. Also instead of writing down the subnet mask like we often use a “bit” notation like /24. This represents the number of bits that are used for the subnet mask.


  • The primary use of CIDR is to reduce the size of routing tables by aggregating several classful addresses in a single route entry. Also decrease the rapid exhaustion of IPv4 addresses.

CIDR Notation

CIDR notation (Classless Inter-Domain Routing) is an alternate method of representing a subnet mask. It is simply a count of the number of network bits (bits that are set to 1) in the subnet mask.

The CIDR notation is easier to write down than typing the entire subnet mask. Unfortunately most operating systems and network devices still require you to type in the full subnet mask.

A little overview with subnet masks and CIDR notation:

CIDR Notation Subnet Mask
and so on..

Leave a Reply

Related Post