• IPv6 Geo Location Database

    by  • 7th May 2010 • post

    Would you like to be able to pinpoint where are IPv6 visitors coming from , just like with IPv4 ones ?

    Well, I wanted and I have created an IPv6 Geolocation database.  It holds Country code for every IPv6 subnet which was available on BGP last weekend. I am going to update it every 2 weeks.

    I’ve used Perl with Net::IP to convert address to an integer and I am using integers in a SQLite database to identify it.

    The flow is as simple as :

    • convert address to integer
    • run SQLite query
      SELECT country FROM ipcountry WHERE ip <= ? ORDER BY ip DESC LIMIT 1;
      ? – is your IP in integer format.
    • 2 letter country code will be returned

    Yes, if you will query for IPv6 address which is in a subnet which wasn’t advertised on the date when database was updated you will end up with a country code for other closest subnet.

    I am not releasing it publicly, yet. However if you are interested, contact me and we will see what can get arranged.