In Java, given an IP Address range, return the minimum list of CIDR blocks that covers the range

后端 未结 5 1847
野趣味
野趣味 2021-01-03 02:04

I am having trouble with some of the logic in converting an IP Address range into a list of CIDR blocks. I do believe that this website is doing it right: http://ip2cidr.com

5条回答
  •  天命终不由人
    2021-01-03 03:04

    The following CIDR blocks contain (not limited to) the range of addresses 1.1.1.111 - 1.1.1.120

    /1 - /27

    address   prefix   network    DirectedBroadcast 
    1.1.1.111   /27    1.1.1.96   1.1.1.127
    1.1.1.111   /26    1.1.1.64   1.1.1.127
    1.1.1.111   /25    1.1.1.0    1.1.1.127
    1.1.1.111   /24    1.1.1.0    1.1.1.255
    

    etc.

提交回复
热议问题