Hi,

I am preparing IP ranges for countries to use in my script (.htaccess file) from the data provided by RIRs (Apnic, Afrinic, Arin, Lacnic, Ripencc). I have a couple of questions about how to read and understand the data they provide. For example, Apnic's public records for IP allocations/assignments can be found at:

ftp://ftp.apnic.net/pub/apnic/stats/apnic/delegated-apnic-extended-latest

1) Is this the most current file that I should use? Or should I use some other file from:

ftp://ftp.apnic.net/pub/apnic/stats/apnic/

2) Some ranges are "assigned" and some ranges are "allocated". What does that exactly mean? Are assigned ranges actively in use but allocated ranges are not in use yet and waiting to be assigned? Shall I use only the assigned records in my script?

3) How do I convert the IP range info into CIDR notation? For example, there are two records:

A) apnic|AU|ipv4|1.0.0.0|256|20110811|assigned|A91872ED
B) apnic|JP|ipv4|1.0.64.0|16384|20110412|allocated|A9252414

I know I will be using the following parts:

A) 1.0.0.0|256
B) 1.0.64.0|16384

First value is the starting IP, second value is the number of IPs in that range. Do I convert it like the following:

A)
256 = 2^8
32-8 = 24
so the CIDR range is
1.0.0.0/24

B)
16384 = 2^14
32-14 = 18
so the CIDR range is
1.0.64.0/18

Is that correct?

Thanks.

Hello,

First the CIDR notation information. I use the following chart which will confirm your beliefs:

http://doc.m0n0.ch/quickstartpc/intro-CIDR.html

About the assigned vs allocated based on everything I have read you can't really depend on the allocated address not being assigned and the documentation has simply not been completed. Again I am going to cop out and provide you a link to a site that will explain how addresses have been assigned.

http://www.ripe.net/ripe/docs/ripe-553

Thanks for the links. I read on one site that the assigned IPs are currently in use but allocated ones are not. I think this is not true because my IP was listed in an allocated range which means allocated IPs may also be in use. So, I will take into account all.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.