How does geolocation based on IP address work

databasegeolocationip addressisp

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?

Best Answer

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.

Related Question