Find out the origin of any IP using geoiplookup

Geoiplookup is included in the Maxmind C library that you will probably already have installed in case you are using any geoip related applications. This also includes the free GeoLite Country database that is used for the lookups.
In case you don’t have the GeoIP C library already installed on a Debian system, you can install it very simple (you might have the libgeoip1 already installed but not geoip-bin; the later one includes the geoiplookup utility):

apt-get install libgeoip1 geoip-bin

Once installed you can use the geoiplookup utility from the command line to get the country of any IP (or hostname):

geoiplookup ipaddress|hostname

For example:

GeoIP Country Edition: US, United States

This shows me in one command line where the IP that resolves to that particular hostname is located.

The GeoLite Country database is quite accurate, but you should update it (they make available a new release each month). To see when the database you are using was build:

geoiplookup -v
GEO-106FREE 20060601 Build 1 Copyright (c) 2006 MaxMind LLC All Rights Reserved


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: