Search code examples
phpipip-addressmalformedgethostbyaddr

PHP malformed IP address and host. What is this?


I track downloads from my website by adding a database entry for each download that contains the IP address and host of the downloading person.

I use this PHP code to retrieve the IP address

isset($_SERVER["HTTP_X_FORWARDED_FOR"]) ? $_SERVER["HTTP_X_FORWARDED_FOR"] : $_SERVER["REMOTE_ADDR"]

and the host with the PHP function gethostbyaddr, passing the IP address.

This has been working perfectly fine for years, until something weird happened:

Today I saw two download entries for which both the IP address and host are 2a02:2028:1aa:2dc1:854e:9ccc:b423:7c93.

Domaintools says it's a "Malformed Domain or IP".

Could someone tell me what that thing is and why it's malformed?

I don't think it's a bot or something because my stuff can only be downloaded by real persons, so I'm really confused?!


Solution

    1. It's not malformed.
    2. It's an IPv6 address.
    3. It's probably someone tunnelling or proxying from their IPv6 network into the IPv4 internet.
    4. DomainTools doesn't seem to be IPv6 aware, or at least not the tool you used, but this one is.