Saturday, April 19, 2008

C.I.D.R.

This topic may be something new to certain people but it might be something that you may see or heard it quite often ( if you are a IT guy ). Anyway, let me start up with some introductions.

C.I.D.R. is Classless Inter-Domain Routing and also know as supernetting ( pronounced as "cider" ). It was actually introduced about 15 years ago on the year 1993. CIDR is a new addressing scheme for the Internet which it is actually more efficient on allocating the IP address / subnet comparing to the old standard Class A, B and C addressing scheme.

Why CIDR is introduced ?

Running out of IP address

In the original state, IP addresses were separated into 2 parts which are the NETWORK and the HOST. This division is used to control how traffic was routed.

With this tradisional dividing subnet to Class A, B and C, we would actually divide the network into :

cidr01

Using the old Classfull IP addressing ( Class A, B, and C addressing )scheme the Internet could ONLY support the following:

  • 126 Class A networks that could include up to 16,777,214 hosts each
  • Plus 65,000 Class B networks that could include up to 65,534 hosts each
  • Plus over 2 million Class C networks that could include up to 254 hosts each
  • Some addresses are reserved for broadcast messages, etc

Because Internet addresses were generally only assigned in these three sizes, there was a lot of wasted addresses.

For example, if you needed 100 addresses you would be assigned the smallest address (Class C), but that still meant 154 unused addresses.

The overall result was that while the Internet was running out of unassigned addresses, only 3% of the assigned addresses were actually being used. CIDR was developed to be a much more efficient method of assigning addresses.

The "appearance" of NAT ( Network Address Translation ) has actually solved partially of this problem. Thus, a new scheme namely CIDR was developed to solve it.

How actually CIDR work and solve the problem ?

The class system is being replaced with a prefix anywhere from 13 to 27 bits which serves as a generalized network prefix. Thus a new IP address might look like this 192.168.0.48/25. The first 25 bit in the address are used to identify the network, while the remaining  7 bits are used to identify the host.

In the other words, it means that the old class system FORCED us to use either the last 8, 16 or 24 bits as HOST while the introduction of the CIDR, we may use like the last 7 bits ( /25 ) or even last 4 bits ( /28 ) as a network.

CIDR blocks and number of Host IDs per segment:

cidr02

With this, it should actually allows the owner especially the ISP(s) to be allocated with a pool of IP addresses ( e.g.  /21 = 2048 IP addresses ). Then the ISP is able to re-allocate to its user by a smaller block from /30, /29, /28 etc.

Example, 203.158.24.0/21 is being allocated to an ISP then the ISP can re-assign to its A user, 203.158.30.0/29 and to its B user, 203.158.30.8/29.

How can I calculate and get the CIDR ?

You must be thinking, calculations again?! Don't worry, it is actually far more easier than you think!

Example, Network : 192.168.26.0/29

Put all the 29 bits in binary format, 29 (1) bits and 3 (0) bits:

11111111111111111111111111111000   = Total must be 32 bits

Divide them into 4 octets:

1111 1111.1111 1111.1111 1111.1111 1000

Convert them to decimal ( refer :

255.255.255.248

Doesn't it sounds EASY ? What you need to remember is actually only :

  • Class A ( 255.0.0.0 ) = /8
  • Class B ( 255.255.0.0 ) = /16
  • Class C ( 255.255.255.0 ) = /24

Shall you be given a subnet of 255.255.255.192, then you may just need to do the reverse calculations :

255.255.255.192 = 1111 1111.1111 1111.1111 1111.1100 0000

Then, the prefix for this network = /26 ( Number of bit (1) )

For those who actually want to do some practice and verify, you get refers the below for the charts.

CIDR Conversion Table

Online IP Subnet Calculator

Download this PDF ---> Network and Subnet Helper

No comments: