Find the Country of an IP

This is especially useful When a forum is often spammed. You can banish from contributions a country if it does not bring contributors, but only lots of spammers.

Addresses are allocated to ISPs which attribute them to subscribers based on their city, so the country or city may be known, as generally the location of the subscriber is in connection with the IP assigned to it.

Web Services

The simplest solution to find the country of an IP is to use a web service:

Depending on the service, you can enter an address or a list of addresses at once. In return it displays the country, the region, the city or more information.

If you want to block a country, the Country IP Block site provides a list of all IP addresses for the country or directly the code to insert into the .htaccess file.

Script

If we want to go further, that requires both a script and a database of geolocation.

A such set is included in the Awstats statistics tool.

Open source statistical tools, such as extensions for Wordpress, often include a geolocation module.

How to know its own IP

For your own IP address, you may simply visit: