Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Identifying country by IP address

Is there a way to figure out the country name just by looking at an IP address? I mean, do countries have specific ranges of IP addresses? For example, Australia can have IP addresses only in the range of 123.45.56.89 - 231.54.65.98 (just an example)

like image 901
skos Avatar asked Mar 21 '12 09:03

skos


People also ask

Can I identify country from IP address?

Imp You can't get the country "just by looking at an IP address". Our service, IPinfo.io, infers the geographic location of IPs by pulling in many different data sources, and performing active scans across all IP addresses, and then publishes the results daily.


1 Answers

No you can't - IP addresses get reallocated and reassigned from time to time, so the mapping of IP to location will also change over time.

If you want to find out the location that an IP address currently maps to you can either download a geolocation database, such as GeoLite from MaxMind, or use an API like http://ipinfo.io (my own service) which will also give you additional details:

$ curl ipinfo.io/8.8.8.8 {   "ip": "8.8.8.8",   "hostname": "google-public-dns-a.google.com",   "loc": "37.385999999999996,-122.0838",   "org": "AS15169 Google Inc.",   "city": "Mountain View",   "region": "California",   "country": "US",   "phone": 650 } 
like image 120
Ben Dowling Avatar answered Oct 10 '22 01:10

Ben Dowling