Matching IPv6 address to a CIDR subnet

前端 未结 7 2138
长情又很酷
长情又很酷 2020-12-15 12:24

Is there a good way to match an IPv6 address to an IPv6 subnet using CIDR notation? What I am looking for is the IPv6 equivalent to this: Matching an IP to a CIDR mask in PH

相关标签:
7条回答
  • 2020-12-15 13:19

    You can also use the IpUtils class from symfony/http-foundation package:

    IpUtils::checkIp6('2a01:8760:2:3001::1', '2a01:8760:2:3001::1/64')
    

    This will check the IPv6 validity and range match. Will return false if it's not the case.

    0 讨论(0)
提交回复
热议问题