5

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?

3 Answers 3

3

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.

4
  • 1
    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.
    – Martin
    Jul 6, 2012 at 20:37
  • 3
    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.
    – Martin
    Jul 6, 2012 at 20:39
  • 1
    @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. Jul 6, 2012 at 20:58
  • @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.
    – JoshP
    Jul 6, 2012 at 21:01
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

1
  • 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.
    – Baarn
    Jul 6, 2012 at 21:22
0

Source Wikipedia: http://en.wikipedia.org/wiki/W3C_Geolocation_API#How_does_Geolocation_work.3F

Though the implementation is not specified, W3C Geolocation API is built on extant technologies, and is heavily influenced by Google Gears Geolocation API. Example: Firefox's Geolocation implementation[7] uses Google's network location provider.[8] Google Gears Geolocation works by sending a set of parameters that could give a hint as to where the user's physical location is to a network location provider server, which is by default the one provided by Google (code.l.google.com).[9] Some of the parameters are lists of sensed mobile cell towers and Wi-Fi networks, all with sensed signal strengths. These parameters are encapsulated into a JavaScript Object Notation (JSON) message and sent to the network location provider via HTTP POST. Based on these parameters, the network location provider can calculate the location. Common uses for this location information include enforcing access controls, localizing and customizing content, analyzing traffic, contextual advertising and preventing identity theft.[10]

2
  • 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.
    – Rhyuk
    Jul 6, 2012 at 20:41
  • And next time be a little bit more respectful.
    – Rhyuk
    Jul 6, 2012 at 20:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .