Chauskin Rodion
Chauskin Rodion

Reputation: 1259

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

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?

Upvotes: 15

Views: 41315

Answers (5)

ychaouche
ychaouche

Reputation: 5092

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.

Upvotes: 0

peterlh
peterlh

Reputation: 71

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

Upvotes: 1

zvi
zvi

Reputation: 4756

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)

Upvotes: 19

Sandor Marton
Sandor Marton

Reputation: 354

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

Upvotes: 12

Related Questions