views:

178

answers:

5

I'm not looking for a service that does this. I'm just curious as to how geolocation works.

+3  A: 

As I understand it, IP subnets are assigned to the providers upstream of your service providers - each IP range is therefore flagged as being within the country of origin of that provider, so each IP within that range is assumed to be within that country.

This is not foolproof - we previously had satellite broadband provided to us (in the UK) by a Belgian provider. Each time we googled anything, we'd be offered to see only pages within Belgium.

adam
+1  A: 

There are a number of organizations that manage the allocation of IP addresses, such as the American Registry of Internet Numbers (ARIN). These organizations maintain master lists of allocated IP address blocks and where they are allocated to, and publish updated lists frequently.

Geolocation software takes full advantage of these lists and provides quick methods of mapping IP addresses to countries. Generally commercial products will strive for more accuracy and utilize other data sources as well.

Check out the Geolocation Software article on wikipedia for some interesting links on the topic.

zombat
+2  A: 

Mapping IP addresses to geolocations is done via tables, where an IP maps to a particular location. This location, however, does't need to be accurate, since IP addresses don't carry any information about their locations, these are approximated.

From http://en.wikipedia.org/wiki/Geolocation_software:

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:

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

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[2] and/or gleaned from network hops.

Accuracy is improved by:

  • Data scrubbing to filter out or identify anomalies.
  • Statistical analysis of user submitted data.
The MYYN
+1  A: 

There's in the internet infrastructure something called an Autonomous System, defintion here

Each provider has been assigned at least one of these. An AS has a unique ASN (Autonomous System Number), within that AS one can have networks (WAN & LAN).

These are assigned to providers, which off course have a location, so the routing protocols know by the ASN what zone they're in.

Using WHOIS services one can determine who an IP address belongs to, as most of us are assigned an IP address by our provider when going online, on WHOIS, you'll mostly find the town of the provider you're in. But WHOIS a website, you'll find it's owner, so Geolocation uses that service a lot.

Tony
A: 

For a quick start into geolocation, open a command line and enter tracert stackoverflow.com and pay close attention to the results. Mostly, the first few lines already give away important hints about your location.

Pekka