13

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?

Chauskin Rodion
  • 1,204
  • 1
  • 11
  • 13

5 Answers5

15

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)

zvi
  • 3,677
  • 2
  • 30
  • 48
12

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

Sandor Marton
  • 344
  • 3
  • 5
6

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

Sean Booker
  • 101
  • 1
  • 1
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

peterlh
  • 51
  • 2
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.

ychaouche
  • 4,922
  • 2
  • 44
  • 52