Wednesday, February 27, 2013

Calculate CIDR Netmask Manually

This is a quick tutorial on how to calculate the CIDR netmask number if you find yourself without a CIDR calculator(like taking a test or something).

1) understand the setup for CIDR i.g. 4 groups of 8 bits equaling  32 (example)

11111111.11111111.11111111.11111111 = 32  bits (4 groups of 8 separated by a "." )

2) total number in each group = 255

11111111 = 255

WTF? each group is easily calculated with these numbers(blocks)!

128+64+32+16+8+4+2+1 = 255 (each bit(block) has a number, add all of them to get 255)

-----------------------------------------------------------------------------------------------------------------------------------------------------

3) Calculate the CIDR netmask of /30

a) count out 30 bits of 1 one(s) and the rest are zero(s) equaling 32 bit(s)

 11111111.11111111.11111111.11111100

   30 one(s) and 2 zero(s) which equal = 32 bits

4) seperate and count each group:

11111111.11111111.11111111.11111100

group 1 = 11111111 = 255
128+64+32+16+8+4+2+1 = 255

group 2 = 11111111 = 255
128+64+32+16+8+4+2+1 = 255

group 3 = 11111111 = 255
128+64+32+16+8+4+2+1 = 255

group 4 = 11111100 = 252
128+64+32+16+8+4 = 252

NOTE: for each zero in a group remove a bit(block) starting from 1(right to left)
128+64+32+16+8+4+2+1 = 255

the calculated CIDR netmask of /30 = 255.255.255.252

------------------------------------------------------------------------------------------------------------------------------------------------------

diagram of CIDR:


Netmask              Netmask (binary)                 CIDR     Notes    
_____________________________________________________________________________
255.255.255.255  11111111.11111111.11111111.11111111  /32  Host (single addr)
255.255.255.254  11111111.11111111.11111111.11111110  /31  Unuseable
255.255.255.252  11111111.11111111.11111111.11111100  /30    2  useable
255.255.255.248  11111111.11111111.11111111.11111000  /29    6  useable
255.255.255.240  11111111.11111111.11111111.11110000  /28   14  useable
255.255.255.224  11111111.11111111.11111111.11100000  /27   30  useable
255.255.255.192  11111111.11111111.11111111.11000000  /26   62  useable
255.255.255.128  11111111.11111111.11111111.10000000  /25  126  useable
255.255.255.0    11111111.11111111.11111111.00000000  /24 "Class C" 254 useable

255.255.254.0    11111111.11111111.11111110.00000000  /23    2  Class C's
255.255.252.0    11111111.11111111.11111100.00000000  /22    4  Class C's
255.255.248.0    11111111.11111111.11111000.00000000  /21    8  Class C's
255.255.240.0    11111111.11111111.11110000.00000000  /20   16  Class C's
255.255.224.0    11111111.11111111.11100000.00000000  /19   32  Class C's
255.255.192.0    11111111.11111111.11000000.00000000  /18   64  Class C's
255.255.128.0    11111111.11111111.10000000.00000000  /17  128  Class C's
255.255.0.0      11111111.11111111.00000000.00000000  /16  "Class B"
     
255.254.0.0      11111111.11111110.00000000.00000000  /15    2  Class B's
255.252.0.0      11111111.11111100.00000000.00000000  /14    4  Class B's
255.248.0.0      11111111.11111000.00000000.00000000  /13    8  Class B's
255.240.0.0      11111111.11110000.00000000.00000000  /12   16  Class B's
255.224.0.0      11111111.11100000.00000000.00000000  /11   32  Class B's
255.192.0.0      11111111.11000000.00000000.00000000  /10   64  Class B's
255.128.0.0      11111111.10000000.00000000.00000000  /9   128  Class B's
255.0.0.0        11111111.00000000.00000000.00000000  /8   "Class A"
  
254.0.0.0        11111110.00000000.00000000.00000000  /7
252.0.0.0        11111100.00000000.00000000.00000000  /6
248.0.0.0        11111000.00000000.00000000.00000000  /5
240.0.0.0        11110000.00000000.00000000.00000000  /4
224.0.0.0        11100000.00000000.00000000.00000000  /3
192.0.0.0        11000000.00000000.00000000.00000000  /2
128.0.0.0        10000000.00000000.00000000.00000000  /1
0.0.0.0          00000000.00000000.00000000.00000000  /0   IP space



Note: I dont want to plagerise so i have to give most of the credit to the people in this forum who discussed on
how to get this calculated. I just(hopefully) made sense of the confusion!
http://www.techexams.net/forums/ccna-ccent/38980-help-figuring-out-cidr-notation-calculations.html

2 comments:

  1. Thanks for sharing such an important post on cidr calculator. Your post is very helpful for students to understand CIDR notation to calculate IP Address of Subnet.

    ReplyDelete
  2. cool glad it helps with students.. over here used it for the LPI exams. cheers!

    ReplyDelete