Ad

How Can I Convert Ip Ranges Formatted In Ip1-ip2 To Cidr Format?

- 1 answer

I have a long list of ips formatted like the following:

5.10.64.0-5.10.127.255
5.34.182.0-5.34.183.255
5.34.240.0-5.34.244.255
5.34.247.0-5.34.247.255
5.35.248.0-5.35.255.255
23.97.48.0-23.97.80.15
46.105.0.0-46.105.255.255
66.209.64.0-66.209.95.255

What I am trying to do is to get it into CIDR format, as such:

5.10.64.0-5.10.127.255 becomes:

5.10.64.0/24
5.10.65.0/24
...
5.10.127.0/24

Any advice on how to automate this process using a script is what I'm looking for.

Ad

Answer

Here you have the tool: http://ipconvertertools.com/iprange2cidr For this tool 2000 IP ranges is not a problem.

You have to select the "multiple ip ranges" tab and paste all of them there. You can start with few ranges to test the tool.

Ad
source: stackoverflow.com
Ad