Understanding the CIDR notation for networking

Bharat Kalluri / 2020-11-01

A IP address is a identifier for a system on a network. So when someone says a machine has an IP of, this means that you can communicate to that machine using that address. IP stands for internet protocol. Currently there are two versions, IPv4 and IPv6. IPv6 came about to handle the problem of exhaustion of IPv4. IPv4 deserves a seperate note altogether since it is complicated.

One interesting point to note is that, some IP address are reserved for special purposes. For example, localhost actually internally maps to How does the system know that is localhost? Check /etc/hosts to understand the mapping. To understand how IP addresses are reserved, jump to the Special use addresses section of IPv4 wiki page. To represent a range of IP addresses, there is a notation used there (for example, or ). This format has an IP address and a slash followed by a number. This format actually represents a range of IP addresses and is called the CIDR.

Understanding the CIDR notation

One IP address can be written in multiple formats, what we use is the normal decimal format and what the system sees is the binary format.

Decimal format: 192      . 168      . 0        . 0
Binary format : 11000000 . 10101000 . 00000000 . 00000000

So, an IP address is 4 collections of 8 bits each. In the CIDR notion the second part after the slash is called a mask. Which in common speak means that those many bits from the beggining are fixed. So when the notation says, this means that the first 24 bits (which transalates to 8 bits * 3 normal digits) starting from the beggining as fixed. , and adhere to this notation. But does not, since 1 is in the masked place.

How is this useful

In networking, dividing the complete network into sub networks (also called subnets) is a common practice. When a subnetwork is defined, it is told a large amount of IP's belong to one subnet. And the notation used to describe these rules is CIDR. Defining any network as a group of IP's means CIDR will be used. It is important to have an intuition on the notation when working on anything related to networking.

Hand crafted by Bharat Kalluri