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.