Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CIDR is the number of contiguous one bits in the IPv4 mask(32 bits) starting at the most significant bit.
- 10000000 00000000 00000000 00000000 where 1 = most significant bit
- The common masks are /8, /16, /24 which all fall on an 8 bit(octet) boundary.
- 11111111 00000000 00000000 00000000 = /8 = 255.0.0.0
- 11111111 11111111 00000000 00000000 = /16 = 255.255.0.0
- 11111111 11111111 11111111 00000000 = /24 = 255.255.255.0
- 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.
- 11111111 11111111 11100000 00000000 = /19
- 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
- 11111111 11111111 11100000 00000000 = /19 = 255.255.?.0
- When looking at each octet remember it is an 8 bit value, 0 - 255.
- 0 0 0 0 0 0 0 0
- 1
- 2 6 3 1
- 8 4 2 6 8 4 2 1
- So the third octet (?) 11100000 is 128 + 64 + 32 = 224. That means
- 11111111 11111111 11100000 00000000 = /19 = 255.255.224.0
- 11111111 11111111 11110000 00000000 = /20 = 255.255.240.0
- (first 20 bits are taken above, leaving the remaining 12 available )
- ---------------------------------------------------------------
- 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