Daily updated free database of subnet-country and subnet-ASN pairs usable in various purposes. It is open, lightweight and less accurate alternative to Maxmind's GeoLite (without cities, latitude and longitude).
- same structure as GeoLite2-Country (database type
IPGeo), names in English only - example result
{"country": {"iso_code": "CZ", "names": {"en": "Czechia"}}, "continent": {"iso_code": "EU", "names": {"en": "Europe"}}}
- same structure as GeoLite2-ASN (database type
IPGeo-ASN) - example result
{"autonomous_system_number": 13335, "autonomous_system_organization": "CLOUDFLARENET - Cloudflare, Inc."} autonomous_system_organizationis missing for few ASNs without name in RIPE list- addresses not announced in BGP are not found
- combination of ipgeo-country.mmdb and ipgeo-asn.mmdb in one database (database type
IPGeo-Country-ASN) - example result
{"country": {"iso_code": "AU", ...}, "continent": {"iso_code": "OC", ...}, "autonomous_system_number": 13335, "autonomous_system_organization": "CLOUDFLARENET - Cloudflare, Inc."}
All .mmdb files can be read by any MaxMind DB reader (e.g. maxminddb for Python, mmdblookup). Libraries checking database type (e.g. Python geoip2) mostly refuse them, use generic reader there (maxminddb.open_database(...).get(ip)).
-
country data only, meant to be imported to sqlite3 with command:
sqlite3 ip.sqlite < db.sqlSubnets should be searched in
subnet_allview with normalized IP's converted to binary form like this:sqlite> select country_code, country_name, continent_code, continent_name from subnet_all where start <= X'291324F3' and `end` >= X'291324F3'; ZA|South Africa|AF|AfricaSame queries work for IPv4 (4 bytes) and IPv6 (16 bytes) in binary form
- comma delimited csv
continent,country,cidr - example
EU,CZ,104.254.80.0/21
- comma delimited csv
asn,cidr,organization(organization quoted when needed) - example
13335,1.0.0.0/24,"CLOUDFLARENET - Cloudflare, Inc." - prefixes may overlap (more specific routes inside less specific), mmdb lookup returns the most specific one
- one CIDR per line, file named by country (
by-country/CZ) or continent code (by-continent/EU), IPv6 in.ipv6files (by-country/CZ.ipv6) - ready for ipset, firewall rules etc.