GeoIP: How To Get Country/City/ASN From IP Address

nabbisen - Apr 6 '19 - - Dev Community

Introduction

I found my servers were given several requests by unknown hosts.
I tried to find out who they were.
Their locations were one of the good information, which were got in the way written in this post.
GeoIP by MaxMind did a great job.

Preparation: Manjaro/Arch Linux

Install 3 packages via Pamac, the Manjaro package manager:

  • geoip
  • geoip-database
    • About Country
  • geoip-database-extra

AUR is also available.

Besides, installation for other distros is here.

How To Get It

It is a very simple task.
Just use geoiplookup:

$ geoiplookup %ip-or-fqdn%
GeoIP Country Edition: %Country Code%, %Country Name%
GeoIP City Edition, Rev 1: %Country Code%, ..., ..., ..., ..., %Latitude%, %Longitude%, ..., ...
GeoIP ASNum Edition: ...
Enter fullscreen mode Exit fullscreen mode

Happy computing :)

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .