Pawan Mishra
by Pawan Mishra
1 min read

Table of Contents

  1. IP Addresses
  2. CIDR Notation
  3. Subnets

IP Addresses

Unless you are an absolute begineer, I will assume that you know what IP addresses(IPV4 specifically) are. For the sake of this article, all we need to know is that IP addresses are 32 bit integer values, grouped into 4 sections of 8 bits each(also known as octate) and represented in binary(dotted-decimal) & decimal(for human readbility purpose) format. IP addresses start from and go all the way upto

CIDR Notation

CIDR notation is a method for allocating IP addresses. Say you want to reserve the following IP address range : In total, we have 256 IP addresses. The first & the last IP address in the range are reserved. The first IP address( is reserved for identifying the network itself & the last IP address( is used as broadcast address. is the CIDR notation equivalent of the above range. Lets decipher the CIDR notation & try to understand how maps to the above range.

Below is the decimal-dotted representation of the above range: : 00001010.00001010.00001010.00000000 : 00001010.00001010.00001010.00000001 : 00001010.00001010.00001010.00000010
. : 00001010.00001010.00001010.11111111

Notice how the first 24 bits are same across the entire IP range. That’s one way to look at the value 24 i.e. mask-bits tells you the number of bits that remain constant in a given IP range. In more scientific term, is the subnet mask for the above range & in first 24 bits are set to 1.

We can extract the network address from a given ip address by bit &ing the address with its subnet mask. E.g.

00001010.00001010.00001010.00000001 & 11111111.11111111.11111111.00000000 = 00001010.00001010.00001010.00000000(

Let’s try again with another example. Suppose we have the following range: - Can you figure out the CIDR notation value just by looking at the range? Here’s a small tip: You can easily calculate the number of address in a given CIDR block by using the following formula : 2 power (address length - prefix length) e.g. 2 power (32 - 24) = 256 IP addresses.

In the above example, we have 32 addresses(0-31). And 32 is 2 power 5. Thus our prefix is 27 and our CIDR notation value is is our subnet mask.

You can read more about CIDR notation here or you can see them in action here.