GeoIP.dat.gz and GeoLiteCity.dat.gz not longer available? Getting 404 trying to load it
Asked Answered
A

5

14

Started couple days ago i can't download

http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz

databases which i use to enable ngx_http_geoip_module module.

It was free and available all the time but now. Does anybody know anything about recent changes with this DB?

Archaeological answered 8/1, 2019 at 18:44 Comment(0)
P
12

Maxmind no longer supports Geolite legacy, just Geolite2 : https://blog.maxmind.com/2018/01/02/discontinuation-of-the-geolite-legacy-databases/

Pish answered 8/1, 2019 at 21:43 Comment(0)
I
18

You can convert MaxMind GeoLite2 Database to the old legacy format with this script:

Example: ./geolite2legacy.py -i GeoLite2-Country-CSV.zip -f geoname2fips.csv -o GeoIP.dat

BTW - there is a site where you can find new data on the legacy format, here: https://www.miyuru.lk/geoiplegacy (the files there were built using with this script)

Intramolecular answered 20/1, 2020 at 20:25 Comment(0)
P
12

Maxmind no longer supports Geolite legacy, just Geolite2 : https://blog.maxmind.com/2018/01/02/discontinuation-of-the-geolite-legacy-databases/

Pish answered 8/1, 2019 at 21:43 Comment(0)
I
5

you can use an alternative cdn site:

https://mirrors-cdn.liferay.com/geolite.maxmind.com/download/geoip/database/

Here you'll find:

https://mirrors-cdn.liferay.com/geolite.maxmind.com/download/geoip/database/GeoIP.dat.gz

Intercessor answered 14/7, 2019 at 3:32 Comment(3)
The database in CDN has not been updated for a while. You should remove this answer to avoid confusion.Televisor
@sean-booker I have downloaded that .gz file, but it is corrupted, do you have any other suggestion, Thanks!Drusy
JFYI. Found this site (miyuru.lk/geoiplegacy) hosting updated dat files.Wright
B
1

I published a docker image that hosts a legacy database you can use too, based on the geolite2legacy.py script, updated every week inside container.

https://hub.docker.com/r/peterlh/geoip-legacy

Bharal answered 22/11, 2020 at 17:44 Comment(0)
A
0

I use awk to parse country and network information from whois.

#!/bin/bash
IP=$1

if out=$(grep $IP /tmp/mygeoip)
then
    echo "$out" | awk '{$1="";print}'
    exit
fi

if [[ ($IP =~ ^10\.) || ($IP =~ ^192.168\.) || ($IP =~ ^172.16\.) ]]
then
    echo "LAN"
    exit 0
fi

#  __^__             __^__
# ( ___ )-----------( ___ )
#  | / | AWK version | \ |
#  |___|             |___|
# (_____)-----------(_____)

result=$(whois $IP | awk '/country/ {country=$2} /netname/ {netname=$2} END {print country,netname}')
echo $IP $result >> /tmp/mygeoip
echo $result

$ net.ip.geo 192.168.90.238
LAN
$ net.ip.geo 92.247.20.226
BG MTELNET
$ net.ip.geo 129.45.92.28
DZ Optimum-Telecom-Algeria
$

It uses a temporary cache in /tmp/mygeoip so that query on same IP is looked up in the cache not from whois.

Alverta answered 25/8, 2022 at 11:7 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.