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:


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


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||256|20110811|assigned|A91872ED
B) apnic|JP|ipv4||16384|20110412|allocated|A9252414

I know I will be using the following parts:


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

256 = 2^8
32-8 = 24
so the CIDR range is

16384 = 2^14
32-14 = 18
so the CIDR range is

Is that correct?


Recommended Answers

All 2 Replies


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


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.


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, learning, and sharing knowledge.