How to tell the count of IP number in a CIDR notation
Task:
You have a CIDR notation and you want to quickly calculate how many ip numbers present in the range represented by the CIDR notation.
Step to answer:
- Subtract the CIDR prefix from 32. If it is an IPv6 address, subtract from 128
- Raise 2 to the power of the result of the above subtraction
Example:
How many IP addresses are in a /17, /25, /30 assuming IPv4?
/17 = 2 (32-17) = 2 15 = 32768 IP addresses
/25 = 2 (32-25) = 2 7 = 128 IP addresses
/30 = 2 (32-30) = 2 2 = 4 IP addresses
Previous post: How to tell the size of IP number in a CIDR notation
Next post: How to tell which CIDR notation is bigger
No comments:
Post a Comment