CIDR and subnetting

CIDR – Classless Inter-Domain Routing, also called as supernetting.

IP addresses were originally assigned in four major address classes: A, B, C and D. CIDR was introduced CIDR in 1993 to replace classful network design for better to efficiently use IP addresses.

ClassIP RangeDefault Subnet MaskNumber of hostsCIDR Notation
  • For class A first 8 bits tells the network and remaining bits can be used to identify hosts in that network.
  • For class B first 16 bits are assigned for the network address and rest are used to identify hosts.
  • In CIDR notation /8 means last 8 bits are used to identify host address and remaining (32-8) are used to identify network.
  • Trailing zeroes in CIDR notation can be dropped, example can be written as 192.0.16/24.
  • CIDR is also used for IPv6 addresses but the prefix length will vary from 0 to 128.


Advantages of using CIDR Notation

  • Earlier companies were allocated Class B network block (most popular block for companies) which covered a lot of IPs and it was not very efficient because Class B block will provide 65,534 addresses and a company may not want to use all those IPs. With CIDR if a company needs just 15,000 addresses they can be assigned /18 prefix with will give them 16,384 addresses instead of taking a whole lot of 65,534 addresses.
  • Network descriptions can be represented by a single entry and reduces the number of network table entries.
  • Example: Comcast Corporation is assigned address.


How are IP address allotted? Who governs it?

  • Internet Assigned Numbers Authority (IANA) manages allocation of IP address globally. It allocates blocks of IPs to RIR.
  • Earth is divided into 5 regions. Each country belongs to one of these regions.
  • A regional Internet registry (RIR) is an organization that manages the allocation of IPs within a region.
  • Example ARIN (American Registry for Internet Numbers, an RIR) serves the US and Canada.
  • RIR further allocates IP blocks to LIR (Local Internet Registry). LIRs are local ISPs.


Subnetting: What are subnets?

Dividing a larger network into smaller networks is called subnetting. Why do we have to do it? You might have to assign a unique network to a set of business, application, etc. You would like the system to be maintainable a problem in one component should be isolated to that subnet only. There are security advantages. There are performance gains as well.


What is a subnet mask?

A subnet mask is a 32-bit value which helps to separate network address from the host address. Just by looking at an IP address you cannot determine the network ID of the IP. If a subnet is not defined then the default subnet mask is used which is in the above table for Class A, B, C addresses. A valid subnet mask consists of only consecutive 1’s and then 0’s.

The first (generally) address of any network is reserved for subnet address and the last one is reserved for broadcast address, that’s why for /27 network number of IPs available for using are 25-2 which is 30.

What is a subnet address?

In a subnet address, all host bits are set to the value 0. The network address is not assigned to any router or host.


For example: for subnet mask (default subnet mask for Class C): This means the first 3 octets will be the same for all IPs in the same network (note there are all 255). This subnet can have 256 addresses (or 254 host IPs). So IP and belong so same subnet but NOT, because 3rd octet of this IP is different.

What is a broadcast address?

In a broadcast address, all the host bits are set to the binary value 1. Broadcast as the name suggest is used to send data packets to all hosts in the subnet.

How to check if two IPs are in the same subnet?

If you have two IPs lets say and

If the subnet mask is /28 then it is, do they belong to the same subnet?

Subnet /28 means the first 28 bits of IP should be exactly the same, the last 4 bits can be anything. So let’s convert IP addresses of hosts in binary format. —>  11000000.10101000.00000001.00010001  —> 11000000.10101000.00000001.00001110

As we can see the first 28 bits are not the same so they do not belong to the same subnet.

PrefixNetwork mask/SubnetUsable hosts per subnet
Class A Network
Class B Network
Class C Network

+ There are no comments

Add yours