Database

IP to Location + ISP CSV format

Details of the IP to Location + ISP database CSV file downloads


IP to Location + ISP database CSV format


The format used in the IP to Location + ISP CSV database exports is compliant with the specification in RFC4180 : Common Format and MIME Type for Comma-Separated Values (CSV) Files.

The character encoding is standard Unicode UTF-8.




Fields


The IP to Location + ISP database downloads in the Comma Separated Values format contain the following fields :

1  ip_start
First IP address in the block
2  ip_end
Last IP address in the block
3  continent
Two-letter continent code [AF, AS, EU, NA, OC, SA, AN]
4  country
ISO 3166-1 alpha-2 country code
5  stateprov_code
ISO 3166-2 state or province code
6  stateprov
State or Province name
7  district
District name
8  city
City name
9  zipcode
Zip / Postal code
10  latitude
Decimal latitude
11  longitude
Decimal longitude
12  geoname_id
Unique ID of the place in the Geonames open database
13  timezone_offset
Offset from UTC in hours
14  timezone_name
Name of timezone in the IANA Time Zone Database
15  weather_code
Nearest international weather station code. These are as used by AOL Weather, The Weather Channel (weather.com), Yahoo! Weather and many more.
16  isp_name
Internet Service Provider name
17  as_number
Autonomous System number
18  usage_type
Usage type [corporate, consumer, hosting]
19  connection_type
Type of network connection [dialup, isdn, cable, dsl, fttx, wireless]
20  organization_name
Organization name

Sample row for the IP to Location + ISP CSV file :

8.8.8.0,8.8.8.255,NA,US,CA,California,"Santa Clara County","Mountain View",94043,37.4229,-122.085,5375480,-7,America/Los_Angeles,USCA0746,"Level 3 Communications",15169,hosting,fttx,"Google Inc."



How To


This packages contains the core DB-IP class, a CSV database import tool, and sample lookup code.


Here are the few steps needed to import a CSV file into your local database instance using the tools above :


Create a database table

The first step is to create a new database table to hold the imported data.

If you are updating an already populated and running database, it is recommended you create a new table and use an atomic rename to switch the old with the new once the import is finished.

This is the MySQL table creation statement for the IP to Location + ISP lookup table needed by our supported query library and import tool :

CREATE TABLE `dbip_lookup` (
  `addr_type` enum('ipv4','ipv6') NOT NULL,
  `ip_start` varbinary(16) NOT NULL,
  `ip_end` varbinary(16) NOT NULL,
  `continent` char(2) NOT NULL,
  `country` char(2) NOT NULL,
  `stateprov_code` varchar(15) DEFAULT NULL,
  `stateprov` varchar(80) NOT NULL,
  `district` varchar(80) NOT NULL,
  `city` varchar(80) NOT NULL,
  `zipcode` varchar(20) NOT NULL,
  `latitude` float NOT NULL,
  `longitude` float NOT NULL,
  `geoname_id` int(10) unsigned DEFAULT NULL,
  `timezone_offset` float NOT NULL,
  `timezone_name` varchar(64) NOT NULL,
  `weather_code` varchar(10) NOT NULL,
  `isp_name` varchar(128) NOT NULL,
  `as_number` int(10) unsigned DEFAULT NULL,
  `usage_type` enum('corporate','consumer','hosting') DEFAULT NULL,
  `connection_type` enum('dialup','isdn','cable','dsl','fttx','wireless') DEFAULT NULL,
  `organization_name` varchar(128) NOT NULL,
  PRIMARY KEY (`addr_type`,`ip_start`)
) DEFAULT CHARSET=utf8mb4;

Use dbip-update to load the database

dbip-update is the preferred way for loading and updating databases. The tutorial below will guide you through installation, initial database import and setup of automatic updates :

  Database import and update tutorial



Other resources


These packages are not maintained by the DB-IP team but we have selected them because they provide added functionnality or language support.


ZORAN.DB.IP.Importer

ZORAN.DB.IP.Importer is a tool that imports into Microsoft SQL Server the freely available geolocation database offered by www.db-ip.com.

  ZORAN.DB.IP.Importer


Geolocal

Geocode IP addresses with a single Ruby if statement. No network access, no context switches, no delay, just one low-calorie lookup like Geolocal.in_spain?(request.remote_ip).

500,000 individual lookups per second is fairly typical performance.

  Geolocal


geoip-dbip-rest-api

This project leverages a simple Java webapp that acts as a wrapper around the db-ip.com geoip databases.

  geoip-dbip-rest-api


Java DB-IP

A simple to use Java library for the freely available DB-IP IP address to city dataset. Requires Java 8

  Java DB-IP

  Spring-Boot-DB-IP



  Back to IP to Location + ISP