abh / geodns

DNS server with per-client targeted responses
Apache License 2.0
1.37k stars 191 forks source link

little issue with geoipcity #98

Open cxfcxf opened 7 years ago

cxfcxf commented 7 years ago

the default open type for geoip city is geoip.GEOIP_CITY_EDITION_REV1, with old GeoIPCity.dat, it will say Could not open city GeoIP database: Didn't open GeoIP database (2), digging through it is just assume using GEOIP_CITY_EDITION_REV1 MaxMind still supports old one, which we regularly update.

easy fix is just alter code at geoip.go and change it to be geoip.GEOIP_CITY_EDITION_REV0 or 6

maybe we should give options on configration file for this?

suedadam commented 7 years ago

Just ran into this myself. Here's what I found on how to fix it, these commands will download the databases from http://dev.maxmind.com/geoip/legacy/geolite/ and rename them appropriately:

wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz -O /usr/share/GeoIP/GeoLiteCity.dat.gz && gunzip --force /usr/share/GeoIP/GeoLiteCity.dat.gz;mv /usr/share/GeoIP/GeoLiteCity.dat /usr/share/GeoIP/GeoIPCity.dat

for ASNs:

wget http://download.maxmind.com/download/geoip/database/asnum/GeoIPASNum.dat.gz -O /usr/share/GeoIP/GeoIPASNum.dat.gz && gunzip --force /usr/share/GeoIP/GeoLiteCity.dat.gz