Geo::IP perl module is an alternative to Geo::IPfree which also allow to map IP
to country code, allowing to get country stats with IP logfiles.
It can be used as an alternative to reverse dns as the perl module
use a local database to map IP to country code.
(update are freely available on the maxmind website).
Making DNS queries can be very long, but this is the only way to
resolve IP to hostname, GeoIP doesn't do the same job, IP are not
translated to hostname.
Step 1 - Installation : GeoIP Library
- Get the library from http://www.maxmind.com/app/c
- download GeoIP.tar.gz
- ./configure
- make
- make check
- make install
if user's install, use ./configure --prefix /home/me/GeoIP instead of ./configure (where /home/me/GeoIP is the location where GeoIP will be installed).
Then if you want to map IP with country code, you'll need the Geo::IP module :
Step 2 - Installation : Geo::IP module
- Get the perl module from http://www.maxmind.com/app/perl
- Download Geo-IP-1.38.tar.gz (as 09/2009)
- perl Makefile.PL
- make
- make test
- make install
if user's install, use perl Makefile.PL LIBS='-L/home/me/lib' INC='-I/home/me/include' PREFIX=/home/me/GeoIP (where /home/me/GeoIP is the location where GeoIP have been installed).
Update the database file from http://www.maxmind.com/download/geoip/database/.
Download the latest GeoIP.dat.gz, uncompress the file and put it in /home/me/GeoIP/share/GeoIP/