Hi guys - I was wondering if anyone knows how to (programmatically) generate a list of subnets from a list of discrete IP addresses?
We are currently receiving a looong list of IPs from an external provider which we need to input to one of our tools. Visually inspecting this list I can see that there are many common subnets, so rather than inputting each of these IPs individually we are exploring ways to process this list to determine a list of subnets which would cover all these IPs. Ideally the lowest common denominator so that we don't include anything that shouldn't be there.
After some googling, there seem to be a lot of resources out there to convert CIDR / IP & netmasks to IPs, but I'm struggling a bit with finding any good resources for going the other way. Has anyone come across this before and solved the problem, and if so, how did you go about doing it?
Edit: I've found this web utility but I'm looking to understand how this works so that we can implement it ourselves: https://ip2cidr.com/bulk-ip-to-cidr-converter.php
No comments:
Post a Comment