tags:

views:

312

answers:

3

I have around 20000 IP Addresses. and I am looking to find the network-block-ranges for these IP addresses. The purpose is to provide information to have hole in the firewall so that these addresses can be allowed. I can looking in a.b.c.d/x bits format. There could be several ranges.

Update: I have IP Addresses already in my apache log files, rather than creating new ones.

+5  A: 

You can't determine this from the addresses. You need to know the subnet masks.

John Saunders
A: 

I believe you're talking about CIDR. 20000 < 2^15. So you need a free A.B.C.D/15 block, but AFAIK /15 block is not common, while /16 is accepted one. So you need A.B.C.D/16.

dimba
I am trying to figure out ranges of the existing IP Addresses from my log files rather than requesting new ones.
aartist
Then you can sort the IP addresses and both biggest ans smallest one will give you a clue for the CIDR subnet mask.
dimba
I have existing IP Addresses and I can have easily more than one subnet.
aartist
So, there're no answer to your question :)
dimba
A: 
Guilherme
Hi, Can you care to explain the algorithm? I might be looking for recursive solution.
aartist
Sorry it appears that I've misunderstood your question. You want, given a set of IPs find the ranges that contains them all?
Guilherme