Location detecting techniques for IP addresses

You can’t do this without a database that maps IP addresses to cities/countries/providers. There are commercial offerings such as ip2location that you could use. AFAIK there is no free alternative though, as maintaining such a IP database is quite a lot of work. Free alternative: GeoIP2

Update:
There are several things that allow you to create such a db, if you invest enough time:

  1. Use the databases provided by regional and local registries to find an IP’s owner.
  2. Many ISPs use a naming schema that allows you to locate the user. Sometimes you can
    even read the city name in plain text if you do a reverse-DNS lookup. Sometimes it is
    more cryptic. For example I currently have p5dcf6c4a.dip.t-dialin.net , and I have no
    idea that the naming scheme is..
  3. Use a traceroute. If you can’t identify the location of a user, you can still find out
    the location of its uplink

Leave a Comment