What is the calculation for converting an IP address to CIDR?
Hello Brano,
Thank you. I hope I have understood how this must be done now. In case this may assist anyone else , this is how I assume we have to proceed:
What is the CIDR equivalent for 255.255.255.224?
bits
8
7
6
5
4
3
2
1
binary
1
1
1
1
1
1
1
1
value
128
64
32
16
8
4
2
1
255
binary
1
1
1
0
0
0
0
0
value
128
64
32
0
0
0
0
0
224
To answer the above question in an examination it is necessary to learn the Value figures shown above, and then use them as follows:
An Octet of 255 value, always amounts to 8 bits.
So of our example subnet mask 255.255.255.224
We know that
255.255.255
converts to:
8 + 8 + 8 = 24 (24 bits).
This leaves (in this example) an Octet containing 224 value, requiring conversion as follows:
From your Table, keep adding the highest Values to each other (left to right).
128 + 64 + 32 = 224.
The number of Value figures you needed to add together to reach 224, was 3 (bits).
Now add these 3 bits to those of the rest of the subnet mask address (which was 24), to reach your CIDR total, thus:
24 + 3 = 27
255.255.255.224
= 8 + 8 + 8 + 3 = 27
CIDR = /27
March 24th, 2012 2:48pm
224 is equivalent to 128+64+32= 2^7+2^6+2^5 and 11100000 in binary.
19 is number of ones from left to right (8+8+3) that mask first 19 digits of IP address and the remnant digits are not taken into count because of multiplication by zeros.
More on this subject see http://tools.ietf.org/html/rfc4632
Regards
Milos
Free Windows Admin Tool Kit Click here and download it now
March 24th, 2012 3:26pm
Hello,
My MCTS book explains about "CIDR" ("Classless Inter-Domain Routing"), thus:
For example "/24".
The "CIDR" form shows the number of "bits" turned on in the "Subnet Mask":
255.255.224.0 is:
11111111.11111111.11100000.00000000, equalling 19 bits turned on, or "/19".
Unfortunately the book does not explain how you do the calculation.
I understand that 255 adds up to 8 turned-on bits.
However, what is the calculation that I need to know in order to convert that 224 figure into the 3 turned-on bits?
Robert339
Ps. I have tried inserting carrier returns to make spaces between the paragraphs in this message, but they are not saved.
March 24th, 2012 5:02pm
Hello Milos,
Thank you for the information. You say the "224" is equivalent to 128+64+32, but I am afraid I am missing something here. How did you calculate those figures?
What I am looking for is the method for answering the following example question
in an examination:
What is the CIDR equivalent for 255.255.255.224?
(MCTS 70:680 Assessment Test - Windows Configuration Study Guide by William Panek.)
Regards,
Robert339
Free Windows Admin Tool Kit Click here and download it now
March 24th, 2012 7:12pm
Everyone has different way of thinking but for exam purposes a table is a good way to go.
Just keep adding from left to right and ask a question if the current sum is bigger then 224 if it is then write down 0 and if it is not write down 1.
bits
8
7
6
5
4
3
2
1
value
128
64
32
16
8
4
2
1
255
binary
1
1
1
0
0
0
0
0
128
64
32
0
0
0
0
0
224
March 25th, 2012 12:28am