Advertisement
Guest User

Untitled

a guest
May 24th, 2016
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.37 KB | None | 0 0
  1. CIDR is the number of contiguous one bits in the IPv4 mask(32 bits) starting at the most significant bit.
  2.  
  3. 10000000 00000000 00000000 00000000 where 1 = most significant bit
  4.  
  5. The common masks are /8, /16, /24 which all fall on an 8 bit(octet) boundary.
  6.  
  7. 11111111 00000000 00000000 00000000 = /8 = 255.0.0.0
  8.  
  9. 11111111 11111111 00000000 00000000 = /16 = 255.255.0.0
  10.  
  11. 11111111 11111111 11111111 00000000 = /24 = 255.255.255.0
  12.  
  13. It isn't really hard when it is not octet aligned, but it does require some simple math and understanding of what an octet is.
  14.  
  15. 11111111 11111111 11100000 00000000 = /19
  16.  
  17. The first two octets of the mask are 255.255 (/16 is less than /19). The last octet is 0(/19 is less than /24). So far we know
  18.  
  19. 11111111 11111111 11100000 00000000 = /19 = 255.255.?.0
  20.  
  21. When looking at each octet remember it is an 8 bit value, 0 - 255.
  22.  
  23. 0 0 0 0 0 0 0 0
  24. 1
  25. 2 6 3 1
  26. 8 4 2 6 8 4 2 1
  27. So the third octet (?) 11100000 is 128 + 64 + 32 = 224. That means
  28.  
  29. 11111111 11111111 11100000 00000000 = /19 = 255.255.224.0
  30.  
  31. 11111111 11111111 11110000 00000000 = /20 = 255.255.240.0
  32. (first 20 bits are taken above, leaving the remaining 12 available )
  33. ---------------------------------------------------------------
  34. To figure up the available hosts/ips subtract the CIDR from 32. For example /20 would be 32-20=12 which would be 2^12 power or 4096 IP minus 2 totaling 4094
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement