CIDR format?
Contributed by Dru Lavigne, DNSstuff Contributing Writer
Wednesday, 28 March 2007
When reading IP addresses you’ll often see the subnet mask written in CIDR format, meaning there is a / followed by a
number.
That CIDR mask represents a whole block of addresses; the smaller the number, the larger the amount of addresses in
the block. The IP address given with the mask is usually the starting address in the block; the following chart can help
you to quickly find the last address in that block: Chart 1: Last Address in a CIDR block Mask Octet 1
Octet 2 Octet 3 Octet 4 /8 stays the same 255 255 255 /9 stays the
same add 127 255 255 /10 stays the same add 63 255 255 /11
stays the same add 31 255 255 /12 stays the same add 15 255 255
/13 stays the same add 7 255 255 /14 stays the same add 3 255 255
/15 stays the same add 1 255 255 /16 stays the same stays the same
255 255 /17 stays the same stays the same add 127 255 /18 stays the
same stays the same add 63 255 /19 stays the same stays the same add 31
255 /20 stays the same stays the same add 15 255 /21 stays the same
stays the same add 7 255 /22 stays the same stays the same add 3 255
/23 stays the same stays the same add 1 255 /24 stays the same stays the
same stays the same 255 /25 stays the same stays the same stays the same
add 127 /26 stays the same stays the same stays the same add 63 /27 stays
the same stays the same stays the same add 31 /28 stays the same stays the
same stays the same add 15 /29 stays the same stays the same stays the same
add 7 /30 stays the same stays the same stays the same add 3 A few examples
will familiarize you with the chart. In the Country IP Range Lookup tool, I’ll lookup the blocks of addresses which have
been assigned to the Bahamas: # # IP Ranges for BS [Bahamas] # Generated by www.DNSstuff.com using data last
updated on 20 Mar 2007. # We highly discourage people from blocking E-mail from entire countries. # 24.231.32.0/19
24.244.128.0/18 64.150.192.0/19 65.75.64.0/18 69.4.160.0/20 216.137.0.0/20 # END The first assigned block of
addresses is 24.231.32.0/19. From the chart, /19 looks like this: Mask Octet 1 Octet 2 Octet 3
Octet 4 /19 stays the same stays the same add 31 25 Meaning the end block be this: 24. 231. (32+31=) 63. 255 Therefore, this /19 block includes 24.231.63.255. Let’s take a look at the next address block, 24.244.128.0/18: Mask Octet 1 Octet 2
Octet 3 Octet 4 /18 stays the same stays the same add 63 255 (128+63=) 191. 255 This /18 address block includes all of the addresses between 24.244.128.0 and 24.244.191.255.
Lastly, try the address block 69.4.160.0/20: Mask Octet 1 Octet 2 Octet 3 Octet 4 /20
stays the same stays the same add 15 255 69. 4. block includes all of the addresses between 69.4.160.0 and 69.4.175.255. Now that you know the starting and ending
addresses, are you able to visualize how many addresses lie in between? IP addresses are 32 bits long and the CIDR
mask tells you how many bits have already been used. This means if you subtract the CIDR mask value from 32 you are
left with the number of bits that are still available to create IP addresses. For the address 24.231.32.0/19 there are 13
(32-19) bits available for addresses. Since bits have two possible values (a bit can either be set to 1 or be set to 0) there
are 2 to the power of 13, or 8192, possible addresses found within this address block. That seems like a lot of addresses
so take a closer look at the starting and ending addresses: 24.231.32.0 to 24.231.63.255 That range represents the
following: 24.231.32.0, 24.231.32.1, 24.231.32.2, etc. up to 24.231.32.25524.231.33.0, 24.231.33.0, etc. up to
24.231.33.25524.231.34.0, 24.231.34.0, etc. up to 24.231.34.255 See how we continue to cycle through all of the
possibilities between 0 and 255 in the 4th octet as the 3rd octet increases by one? This will continue until the 3rd octet
has cycled up to 63. Another way to visualize this is to consider that the 3rd octet will cycle through 32 numbers (32
through 63) as the 4th octet cycles through 256 numbers (0 through 255). Not surprisingly, 32 times 256 is 8192. You
can save yourself some math by referring to Chart 2: Chart 2: Number of IP addresses per CIDR address block
CIDR Mask Number of IP Addresses /8 16,777,216 /9 8,388,608 /10
4,194,304 /11 2,097,152 /12 1,048,576 /13 524,288 /14 262,144
/15 131,072 /16 65,536 /17 32,768 /18 16,384 /19 8192
/20 4096 /21 2048 /22 1024 /23 512 /24 256 /25 128
/26 64 /27 32 /28 16 /29 8 /30 4 So, how many IP
addresses are available for the Bahamas? There are two /18s, two /19s and two /20s: (16384*2) + (8192*2) + (4096*2)
= 57,344 Looks like there are 57,344 addresses in the 6 address blocks assigned to the Bahamas. Note: often when
you use a CIDR/subnet mask calculator you will see two subtracted from the number of possible addresses. This is
required when you assign IP addresses to hosts as you have to reserve one address for the subnet and one address for
the broadcast.
member.dnsstuff.com
http://member.dnsstuff.com/rc Powered by Joomla! Generated: 9 July, 2007, 00:26


