从PHP中获取Ipv6 CIDR的IPv6地址数 [英] Getting number of IPv6 addresses from Ipv6 CIDR in PHP
本文介绍了从PHP中获取Ipv6 CIDR的IPv6地址数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有没有办法从Ipv6 CIDR获取IPv6地址数量?
例如:CIDR:2403:3E00: :/ 32
=>
需要得到IPv6地址的个数:79228162514264337593543950336
解决方案
2 ^(128-32)= 2 ^ 96 = 79228162514264337593543950336
是错误的,仍然需要
79228162514264337593543950336 - 1 = 79228162514264337593543950335主机
PS。抱歉,由于声誉,我无法评论Joachim的答案,这就是我对stackoverflow不太感兴趣的原因。
Is there a way to get the number of IPv6 addresses from a Ipv6 CIDR?
for example: CIDR: 2403:3E00::/32 => need get number of ipv6 addresses: 79228162514264337593543950336
解决方案
2^(128-32) = 2^96 = 79228162514264337593543950336
is wrong, you still need to
79228162514264337593543950336 - 1 = 79228162514264337593543950335 hosts
PS. sorry I could not comment it to the answer of Joachim because of reputation, this is why I am not much interested in stackoverflow.
这篇关于从PHP中获取Ipv6 CIDR的IPv6地址数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文