Most internet users are aware of the 2 types of IP addresses in use today. One is Internet Protocol Version 4 (IPv4) and the other is Internet Protocol Version 6 (IPv6). The introduction of IPv6 is due to the limited addressing provided by IPv4.
Example of an IPv4 IP address: 18.104.22.168
Example of an IPv6 IP address: 2404:6800:4003:c02::64
IPv6 has a special range designed to represent an IPv4 IP address but in a form similar to IPv6. This range is known as the IPv4-mapped IPv6 address.
Let’s revisit the earlier IPv4 IP address below and also show you its equivalent form in IPv4-mapped IPv6 address.
IPv4 IP address: 22.214.171.124
IPv4-mapped IPv6 address: ::ffff:126.96.36.199
All you have to do is add ::ffff: in front of your IPv4 address.
Since the IP2Location IPv6 CSV files contain IPv4-mapped IPv6 addresses, you will need to learn how to calculate the IP number in order to query IPv4 IP addresses using the IPv6 CSV files.
To calculate a normal IPv4 IP address (e.g. 188.8.131.52) to IP number, you will do the following:
(191 * 256 * 256 * 256) + (239 * 256 * 256) + (213 * 256) + 197 = 3220166085
To get the IP number for the IPv4-mapped IPv6 address, you just take the above total and add 281470681743360.
3220166085 + 281470681743360 = 281473901909445
So when you are querying an IPv4 IP address using the IPv6 CSV files, just follow the above calculations to get the IP number.