I made the attempt. No one can fault me for that. However, I was defeated by the twisted, anarchic madness that is the ARIN database.
A step back: I was considering refining the GrabIP database to more accurately reflect the true countries where IPs are used.
APNIC, LACNIC and AFRINIC are all sanely managed. Countries and IP blocks are accurately mapped. RIPE gets a little messier, but there is no real problem with it. Just have to watch out for the blocks tagged as EU instead of their host countries.
ARIN is complete madness. As the only IP registrar on the block for a long time, there are a number of archaic nooks and crannies to watch for. Like this gem: 18.104.22.168.
OrgName: Sprint OrgID: SPRN Address: 12502 Sunrise Valley Drive City: Reston StateProv: VA PostalCode: 20196 Country: US NetRange: 22.214.171.124 - 126.96.36.199 CIDR: 188.8.131.52/13, 184.108.40.206/14, 220.127.116.11/15, 18.104.22.168/16
Nothing too earth-shattering here…but wait, there’s more information!
OrgName: COMMUNICATION ENTERPRISES LTD OrgID: CEL-30 Address: KM # BLVD DEL NORTE City: SAN PEDRO SULA StateProv: SAN PEDRO SULA PostalCode: 00000 Country: HN NetRange: 22.214.171.124 - 126.96.36.199 CIDR: 188.8.131.52/21
A whole chunk in the middle is assigned to a company in Honduras? Oh great, so now I have to write exceptions to weed out the child CIDR blocks that are in completely different countries.
Needless to say, this attempt to refine the data lost its appeal quickly.
Just using the high-level data in the GrabIP database, it is clear that there is still a great deal of overlap in the ARIN data.
code country NUMBLOCK US UNITED STATES 30935 CA CANADA 4903 PR PUERTO RICO 29 GB UNITED KINGDOM 24 DE GERMANY 22 JM JAMAICA 18 BM BERMUDA 17 FR FRANCE 13 JP JAPAN 12 BB BARBADOS 9 CH SWITZERLAND 6 HK HONG KONG 5 NL NETHERLANDS 5 SE SWEDEN 4 IT ITALY 4 NO NORWAY 4 BS BAHAMAS 4 BE BELGIUM 4 VI VIRGIN ISLANDS, U.S. 3 ES SPAIN 3 AG ANTIGUA AND BARBUDA 3 AU AUSTRALIA 3 CZ CZECH REPUBLIC 2 SG SINGAPORE 2 DO DOMINICAN REPUBLIC 2 FI FINLAND 2 LU LUXEMBOURG 2 IE IRELAND 2 MX MEXICO 1 AT AUSTRIA 1 LC SAINT LUCIA 1 TR TURKEY 1 PL POLAND 1 LB LEBANON 1 GD GRENADA 1 HU HUNGARY 1 IL ISRAEL 1
However, when I originally started this project 2 years ago, some of the blocks for Iceland were listed as ARIN. Now, all of Iceland’s blocks are in the RIPE database.
Hopefully in the next year, the registries can get the counrty assignment mess sorted out.
A sidenote: Right now, ARIN is still the biggest fish in the sea.
arin 36051 ripencc 14588 apnic 10445 lacnic 1457 afrinic 437
Maybe I should post the Weekly Breakdown of IP Blocks by registry and country.