How does geolocation based on IP address work?

7,076

Solution 1

Found some answers on WikiPedia:

There are a number of free and paid subscription geolocation databases, ranging from country level to state or city—including ZIP/post code level—each with varying claims of accuracy (generally higher at the country level). These databases typically contain IP address data which may be used in firewalls, ad servers, routing, mail systems, web sites, and other automated systems where geolocation may be useful. An alternative to hosting and querying a database is to obtain the country code for a given IP address through a DNSBL-style lookup from a remote server.

Some commercial databases have augmented geolocation software with demographic data to enable demographic-type targeting using IP address data.

The primary source for IP address data is the regional Internet registries which allocate and distribute IP addresses amongst organizations located in their respective service regions:

  • African Network Information Centre (AfriNIC)
  • American Registry for Internet Numbers (ARIN)
  • Asia-Pacific Network Information Centre (APNIC)
  • Latin American and Caribbean Internet Address Registry (LACNIC)
  • RIPE Network Coordination Centre (RIPE NCC)

Secondary sources include:

  • Data mining or user-submitted geographic location data. For example, a weather web site might ask visitors for a city name to find their local forecast. Another example would be to pair a user's IP address with the address information in his/her account profile.
  • Data contributed by internet service providers.
  • Merging databases from different suppliers.
  • Guesstimates from adjacent Class C range and/or gleaned from network hops.

Accuracy is improved by:

  • Data scrubbing to filter out or identify anomalies.
  • Statistical analysis of user submitted data.
  • Utilizing third-party tests conducted by reputable organizations.

Source: https://en.wikipedia.org/wiki/Geolocation_software#Data_sources

Solution 2

Your ISP gives you your IP address. They own a block of IP addresses that, in one way or another, originate from the IANA.

The business that purchases those IP blocks has a physical location/address that can help place them geographically. (it only helps because, for instance, they can hand out an IP address to someone living in a different geographical area)

On average though, that method generally works.

Additionally, the ISP may have their own DNS servers. When you navigated to that website, your ISP's DNS server helped your browser get there. That DNS server also has a public IP address that is owned and registered.

In the end, I think it often boils down the address of the owner of the IP address as registered with the IANA.

Share:
7,076

Related videos on Youtube

Erisksson J
Author by

Erisksson J

Updated on September 18, 2022

Comments

  • Erisksson J
    Erisksson J almost 2 years

    As all Internet users, I've visited web sites which appear to know in which country and city I'm located. I understand that these web sites typically look up my IP address in a database which maps IP address to country / city which works fairly well. I've also seen companies selling this type of database.

    How is this database, which maps an IP address to a country / city, created in the first place?

    Is there a central database somewhere where each ISP registers the link between IP address and country/city? Or does the companies selling geolocation databases contact different ISP's and purchase the mapping information from them? Or is there some organization 'above' ISP's who keeps track of this?

  • Erisksson J
    Erisksson J almost 12 years
    I don't think its as easy as that. Lets take an example. The Swedish ISP Comhem has customers in entire Sweden. According to ripe.net, the IP address I am currently using is owned by Comhem located in Stockholm (the entire range 83.249.0.0 - 83.249.255.255). But I'm located 600KM from Stockholm and if I perform a GEO lookup on my IP address, it will tell me what city I'm in. Just using the owners address would be far to vague to include city properly.
  • Erisksson J
    Erisksson J almost 12 years
    Also, I don't see what the DNS has to do with it. Yes, my PC will use my ISP's DNS server when performing a query. But this only resolves host name to a specific IP address. But that's not linked to geo location at all. Also, a geo lookup server won't know what DNS server I'm using.
  • Rossco Stringer
    Rossco Stringer almost 12 years
    Well sir, the Geolocation that runs in your browser is the one thats described there. Which answers "how geolocation based.on IP works" cause it works the same.for ip address and wireless devices.
  • Rossco Stringer
    Rossco Stringer almost 12 years
    And next time be a little bit more respectful.
  • user1686
    user1686 almost 12 years
    @Martin: It's partially related because some authoritative DNS servers (e.g. those which host google.com) are configured to return different results depending on the asker's address. Usually they only see the addresses of ISP caching servers, not the user's directly, but that's sufficient to redirect the user to a geographically close web server.
  • JoshP
    JoshP almost 12 years
    @Martin I take your point with the ISP being remote. However, and to be honest I'm speculating here, I would be surprised if the ISPs didn't distribute sub-blocks based on political geography (cities, etc.). Your linked article states the primary source of data is the registry itself, secondary is the ISP, and beyond that, just data mining and your own various user or account data. I still think the owner of the IP is the source for most of the data.
  • Baarn
    Baarn almost 12 years
    The content of a link might change (or even die completely). Please add information to your answer, eg by quoting the relevant parts of the article.