How-To


To lookup the country code of a particular IP address, in this example 1.2.3.4, you need to retrieve the TXT record (TXT, not A record!) of 4.3.2.1.lookup.ip2.cc. This will return you the two-letter ISO country code of the IP address requested.

So to summarise there are two steps involved:

  1. Reverse the order of the IP address. Example: 1.2.3.4 becomes 4.3.2.1
  2. Lookup the DNS TXT record of "reversed IP address" + ".lookup.ip2.cc". Example: 4.3.2.1.lookup.ip2.cc
It is important your application only and exclusively requests the TXT record and nothing else. Requesting other records types (A, MX, CNAME, etc.) is pointless and wastes resources. Users or applications not following this simple point will unfortunately be blocked.



Comments