I am making an API call and that call requires Request IP address.
I am using ServletRequest.getRemoteAddr() to get the IP of the request.
For one user, getRemoteAddr() is returning IPv6 rather than IPv4 why is this??
From my understanding, IPv6 is extension to the IPv4, where users can choose to use IPv6
rather than IPv4. Does this means user or user’s ISP is using IPv6? How does this work….
Also is there a way to get IPv4 equivalent?
Thanks.
ipv6 is not an “extension” to ipv4, it’s an alternative addressing scheme. whether a client is using an ipv6 or ipv4 address is up to the client’s configuration alone (although the intermediaries between the client and your server will need to be compatible). there is no way to get an ipv4 “equivalent” to an ipv6 address as ipv6 addresses are not backwards compatible (on the flip side, though, there is a way to encode ipv4 addrs in an ipv6 compatible way).