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)
相关问题
- IPAddress.[Try]Parse parses 192.168 to 192.0.0.168
- Doing ARP and Inverse ARP on Linux 2.6.21 (glibc 2
- How to transform IP addresses into geolocation in
- Location not updating on server when app enters st
- Mapbox 'setMyLocationEnabled' doesn't
相关文章
- How to resolve hostname to an ip address in node j
- PostgreSQL field data type for IPv4 addresses
- Parsing IP Address to string doesn't work for
- How to find that an IP address is a LAN IP or WAN
- Direct IP call android
- Automate ftp upload to ip
- Implementing Triangulation in android [closed]
- Retrieve IP Address of the Default Printer Driver
Yes, countries have specific IP address ranges as you mentioned.
For example, Australia is between 16777216 - 16777471. China is between 16777472 - 16778239. But one country may have multiple ranges. For example, Australia also has this range between 16778240 - 16779263
(These are numerical conversions of IP addresses. It depends whether you use IPv4 or IPv6)
More information about these ranges can be seen here: http://software77.net/cidr-101.html
We get the ip addresses of our website visitors and sometimes want to make relevant campaign for a specific country. We were using bulk conversion tools but later on decided to define the rules in an Excel file and convert it in the tool. And we have built this Excel template: https://www.someka.net/excel-template/ip-to-country-converter/
Now we use this for our own needs and also sell it. I don't want it to be a sales pitch but for those who are looking for an easy solution can benefit from this.
IP addresses are quite commonly used for geo-targeting i.e. customizing the content of a website by the visitor's location / country but they are not permanently associated with a country and often get re-assigned.
To accomplish what you want, you need to keep an up to date lookup to map an IP address to a country either with a database or a geolocation API. Here's an example :
Or you can use the full API to get complete location for IP address e.g.
You can try using https://ip-api.io - geo location api that returns country among other IP information.
For example with Node.js
May be these two links can help you Associate IP addresses with countries
http://en.wikipedia.org/wiki/Regional_Internet_Registry
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: